User Tools

Site Tools


linux-packet-forwarding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux-packet-forwarding [2018/02/11 17:41] baumilinux-packet-forwarding [2022/01/29 11:27] (current) – [Basic outgoing masquerding script] baumi
Line 10: Line 10:
 ext_if=eth0 ext_if=eth0
 ext_ip=$(ip address show $ext_if | awk -F "[ /]" '/inet / { print $6 }') ext_ip=$(ip address show $ext_if | awk -F "[ /]" '/inet / { print $6 }')
-  + 
 +# Turn off forwarding 
 +echo 0 > /proc/sys/net/ipv4/ip_forward 
 +# Create NAT rule 
 +iptables -t nat -I POSTROUTING -s $network -o $ext_if -j SNAT --to-source $ext_ip 
 +# Create FW rules to allow traffic 
 +iptables -I FORWARD -s $network -j ACCEPT 
 +iptables -I FORWARD -m conntrack --ctstate ESTABLISHED -j ACCEPT 
 +# Turn on forwarding
 echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_forward
-iptables -t nat -A POSTROUTING -s $network -o $ext_if -j SNAT --to-source $ext_ip 
 </code> </code>
  
linux-packet-forwarding.1518367286.txt.gz · Last modified: 2018/02/11 17:41 by baumi

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki