May 20, 2014

Configure RHEL 6 as Router


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 (gateway), (rhel 6 router), (WAN GATEWAY) and finally