Lesson 10

Date: 4/2/2014
Basics of Linux Security
Linux for Engineering and IT Applications


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