In this blog I will show you how to configure a RHEL 6 server as router for LAN (eth1) and WAN (eth0).
Enable IP forwarding
First we need to enable IP forwarding.
And to verify.
To make it permanent, you need to edit /etc/sysctl.conf.
Configure Router Server Network
Before we begin, we disable NetworkManager.
Then we manually edit our network configuration files.
We begin with our WAN (eth0) card.
And continue with our LAN (eth1) card.
The above HWADDR is different for your environment. To get yours use ifconfig.
Finally restart network service and check new ip addresses are set, via ip or ifconfig command.
Now we are ready to configure iptables. First flush existing rules.
Then add the MASQUERADE roule to the WAN (eth0) card
Finally save iptables configuration.
I have connected a separate machine on LAN and configure it manually with static IP.
Now we can ping 192.168.2.100 (gateway), 192.168.1.100 (rhel 6 router), 192.168.1.1 (WAN GATEWAY) and finally www.google.com.