November 25, 2024, 04:27:38 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Gateway server  (Read 4559 times)

Offline samim_bd

  • New Member
  • Posts: 1
Gateway server
« 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.

Offline kaushalpatel1982

  • LST CareTaker
  • Linux Learner
  • *****
  • Posts: 87
Re: Gateway server
« Reply #1 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