To implement NAT on a server with two network cards (eth0:192.168.1.1/24 connected to the Internet and eth1:192.168.2.1/24 connected to the internal network) several steps are required.
Edit the /etc/sysctl.conf file and assign 1 to the ‘net.ipv4.ip_forward‘ option:
net.ipv4.ip_forward = 1
Update the system:
# sysctl -p
Add a new rule to the firewall:
# iptables -t nat -I POSTROUTING -o eth0 -s 192.168.2.0/24 -j MASQUERADE
Save the firewall configuration:
# service iptables save
Leave a Reply
You must be logged in to post a comment.