Simple NAT using IPtables

posted in: Networking | 0

It was needed to do NAT (Network Address Translation) in the network of INHERENT Universitas Pattimura (UNPATTI). In this case, it was decided to do NAT of one INHERENT’s IP which is The purpose is to be able to connect several client computers assigned with class C private IP in through

The machine used to handle this task is an IBM x3650 which also serves  as a multipurpose server as web server and database server. The operating system installed is CentOS 5, and as far as it was tried, centOS is the only Linux distro that can be installed in this machine and nothing else of open source distro works.

The NAT application implemented is very straight forward, network schema is as shown in the picture below.


It is needed to pass inbound and outbound trafics from/to eth0 from/to eth1 and to achieve this task, IPtables is used.

Here are the IPtables commands that were used to configure the NAT for and

[inherent@hotumese ~]$/sbin/iptables -t nat -A POSTROUTING -o eth1 -s -j SNAT –to-source

[inherent@hotumese ~]$/sbin/iptables-save > /etc/sysconfig/iptables