Lesson 13

Date: 6/28/2017
Linux Network Security
Linux System Administration

NAT table

Enable packet forwarding:
echo "1" > /proc/sys/net/ipv4/ip_forward

Then add iptables rule:
iptables -t nat -A POSTROUTING -o $INET_IFACE \
     -j SNAT --to-source $INET_ADDRESS
where $INET_IFACE is an external interface (eth0)

Port forwarding:
iptables -t nat -A PREROUTING -p tcp \ 
         -i $INET_IFACE --dport (port-num) \
         -j DNAT --to (dest-addr):(port-num)

Check iptables filter configuration:

/sbin/iptables -L -t nat

Reference: NAT-HOWTO

Take me to the Course Website