Configure the Linux Instances as Routers
To create the Linux instances as routers,
complete the following task.
The following task has
you configuring iptable changes. These iptable changes do not persist
across a system reboot. Palo Alto Networks recommends that you have
a method to save these iptable changes to make them persistent across
a reboot (for example, install a Linux package).
- Configure the Router 1 instance in VPC 1 located in mainland China.You can also configure Router 1 as a VM-series next-generation firewall; these steps show a configuration using two Linux instances as routers.
- Open a secure CLI session with the router 1 instance by entering thessh -ikey-fileroot@instance-ip, wherekey-fileis the file location where you saved the key andinstance-ipis the IP address of the router 1 instance.
- Using an editing program such as vi, edit the /etc/sysctl.conf file and add the following line to the file, then save and close the file:net.ipv4.ip_forward = 1
- Entersysctl -pto load the new configuration.
- Add an iptables rule to allow this instance to accept and forward IPSec tunnel packets by creating a shell script with the nameiptables-rule.shand adding the following lines to the file, substitutingrouter-1-private-ip-addresswith the private IP address of Router 1 androuter-2-private-ip-addresswith the private IP address of Router 2.#!/bin/shiptables -t filter -A FORWARD -i eth0 -j ACCEPTiptables -t filter -A FORWARD -o eth0 -j ACCEPTiptables -t nat -A PREROUTING -i eth0 -p udp -m udp --dport 500 -j DNAT --to-destinationrouter-2-private-ip-addressiptables -t nat -A PREROUTING -i eth0 -p udp -m udp --dport 4500 -j DNAT --to-destinationrouter-2-private-ip-addressiptables -t nat -A POSTROUTING -drouter-2-private-ip-address/32 -o eth0 -p udp -m udp --dport 500 -j SNAT --to-sourcerouter-1-private-ip-addressiptables -t nat -A POSTROUTING -drouter-2-private-ip-address/32 -o eth0 -p udp -m udp --dport 4500 -j SNAT --to-sourcerouter-1-private-ip-address
- Save and close the file.
- Enter thechmod +x iptables-rule-shcommand to make the file executable.
- Enter the./iptables-rule.shshell script to execute the iptables rule.
- Enter theiptables-savecommand to verify that the rules have been added.
- Configure the Router 2 instance in VPC 2 located outside of mainland China.
- Open a secure CLI session with the router 2 instance by entering thessh -ikey-fileroot@instance-ip, wherekey-fileis the file location where you saved the key andinstance-ipis the IP address of the router 1 instance.
- Using an editing program such as vi, edit the /etc/sysctl.conf file and add the following line to the file, then save and close the file:net.ipv4.ip_forward = 1
- Entersysctl -pto load the new configuration.
- Add an iptables rule to allow this instance to accept and forward IPSec tunnel packets by creating a shell script with the nameiptables-rule.shand adding the following lines to the file, substitutingremote-network-service-ip-addresswith theService IP Addressof the Prisma Access remote network () andPanoramaCloud ServicesStatusNetwork DetailsRemote NetworksService IP Addressrouter-2-private-ip-addresswith the private IP address of Router 2.#!/bin/shiptables -t filter -A FORWARD -i eth0 -j ACCEPTiptables -t filter -A FORWARD -o eth0 -j ACCEPTiptables -t nat -A PREROUTING -srouter-2-private-ip-address/32 -i eth0 -p udp -m udp --dport 500 -j DNAT --to-destinationremote-network-service-ip-addressiptables -t nat -A PREROUTING -srouter-2-private-ip-address/32 -i eth0 -p udp -m udp --dport 4500 -j DNAT --to-destinationremote-network-service-ip-addressiptables -t nat -A POSTROUTING -dremote-network-service-ip-address/32 -o eth0 -p udp -m udp --dport 500 -j SNAT --to-sourcerouter-2-private-ip-addressiptables -t nat -A POSTROUTING -dremote-network-service-ip-address/32 -o eth0 -p udp -m udp --dport 4500 -j SNAT --to-sourcerouter-2-private-ip-address
- Save and close the file.
- Enter thechmod +x iptables-rule-shcommand to make the file executable.
- Enter the./iptables-rule.shshell script to execute the iptables rule.
- Enter theiptables-savecommand to verify that the rules have been added.
Most Popular
Recommended For You
Recommended Videos
Recommended videos not found.