Simple NAT using IPtables

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.

inherent unpatti nat

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 eth0 -s -j SNAT –to-source

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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s