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 [2022/01/29 11:27] baumilinux-packet-forwarding [2022/01/29 11:27] (current) – [Basic outgoing masquerding script] baumi
Line 13: Line 13:
 # Turn off forwarding # Turn off forwarding
 echo 0 > /proc/sys/net/ipv4/ip_forward echo 0 > /proc/sys/net/ipv4/ip_forward
-# Flush NAT rules +# Create NAT rule 
-iptables -t nat -F POSTROUTING +iptables -t nat -POSTROUTING -s $network -o $ext_if -j SNAT --to-source $ext_ip
-# Create NAT rules +
-iptables -t nat -POSTROUTING -s $network -o $ext_if -j SNAT --to-source $ext_ip+
 # Create FW rules to allow traffic # Create FW rules to allow traffic
-iptables -I FORWARD -m conntrack --ctstate ESTABLISHED -j ACCEPT 
 iptables -I FORWARD -s $network -j ACCEPT iptables -I FORWARD -s $network -j ACCEPT
 +iptables -I FORWARD -m conntrack --ctstate ESTABLISHED -j ACCEPT
 # Turn on forwarding # Turn on forwarding
 echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_forward
linux-packet-forwarding.1643452034.txt.gz · Last modified: 2022/01/29 11:27 by baumi

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki