Lesson 12

Date: 4/12/2017
Basics of Linux 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)
FILTER TABLE



Check iptables filter configuration:

/sbin/iptables -L -t nat


Reference: NAT-HOWTO



Take me to the Course Website