Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Network Troublshooting => Linux Servers Support => Topic started by: samim_bd on July 20, 2009, 07:57:06 AM

Title: Gateway server
Post by: samim_bd on July 20, 2009, 07:57:06 AM
I want to configure a gateway server in centos 5, I will be pleased if you give me the process of configuration a gateway server.
Title: Re: Gateway server
Post by: kaushalpatel1982 on October 01, 2009, 02:41:37 PM
There are two ways to configure linux as gateway.

1. For Local use. When you have multiple networks inside your organization and you want to do routing between networks.

I assume that you have configured all your network interface as per your requirement and you have administrative rights.
Open /etc/sysctl.conf file
change the line from "net.ipv4.ip_forward = 0 " to "net.ipv4.ip_forward = 1" and run following command :
#sysctl -p

All of the PC should have this router as their default gateway. That is it.

2. You want to access internet using this Linux router.

You have to follow the above steps plus few more steps. Let say you have eth0 as your LAN and eth1 as your WAN. You have to masquerade all your traffic coming from LAN and going to WAN using IPTables. Just run the following command as per your requirement.

# iptables -t nat -I POSTROUTING -i eth0 -o eth1 -j MASQUERADE

You have done it. Now check internet access from the client PC. If it works properly just save iptables command using following command :

#service iptables save

Best of luck