Gateway Server Configuration

Gateway server configuration is the easiest thing in Linux server configuration. For this we have to follow the following steps.

1. We have to ensure that the server computer two NICs. Then we have to configure the NICs. I think most of us can do this thing. To configure interface eth1 we have to create a file /etc/sysconfig/network-scripts/ifcfg-eth1 (If there is no such file; if there exist the file then we have to edit this file) as follows:

vi /etc/sysconfig/network-scripts/ifcfg-eth1

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)






Here the network is

This is the LAN side.

We will configure WAN side at eth0 with the following command:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)





Now we will restart the interfaces.

/etc/init.d/network restart
2. Now we have to do minimum two things.

* IP forwarding

* NAT (Network Address Translation)

3. For IP forwarding we can chose any one procedure as follows:

* Procedure 1: We can write only one command as follows :

# echo 1>/proc/sys/net/ipv4/ip_forward

and then entry this line at /etc/rc.local file.

* Procedure 2: We can edit the /etc/sysctl.conf file and do there we will change the value 0 of net.ipv4.ip_forward to 1.

# vi /etc/sysctl.conf


Then we have to restart the file with the following command:

# sysctl -p
4. For NAT we can add only two line at /etc/rc.local file:

iptables -t nat -F

iptables -t nat -A POSTROUTING -s -d 0/0 -j SNAT –to-source

Thats all. Our Gateway server is configured. Now we can check whether its working or not.

Any suggestions ?


  1. Blake said

    Can you give info on setting up a transparent firewall? Basically, not using NAT, but having servers with public IP addresses use a firewall as a gateway for internet traffic?

  2. Boss said

    Boss kapilacen

RSS feed for comments on this post · TrackBack URI

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


Get every new post delivered to your Inbox.

%d bloggers like this: