Turning a CentOS/RHEL 6 or 7 machine into a router

In this tutorial we are going to learn to convert RHEL/CentOS 6 & 7 machines into a router by using NATting. Router as we know is layer 3 networking device that is used to connect 2 or more networks i.e. either connecting LAN to WAN or LAN to LAN etc. Router devices are quite expensive & especially for small organizations, that might be a reason for concern. So rather than using a dedicated Hardware, we can use any Linux machine & convert it into a router. We will be discussing process for both RHEL/CentOS 6 & 7. But before we do that, let’s discuss the things we will be needing for our setup.

Prerequisite

1- A machine with either RHEL/CentOS 6 or 7 installed2- Two NICs to assign local IP address & WAN IP address respectively

We must assign IP address to both network interface cards, one IP should be for local area network (information regarding it will be provided by our Network administrator) & other IP should be to access internet, information for WAN IP will be provided by ISP. For example

Here, XXXX is the name of the network interface with the WAN IP address. This completes configuration of Linux machine as router, next we will test our router after configuring a client machine.

Step 3 Configuring the client machine

To test the router, we need to assign the internal (LAN) IP address as gateway on our client machine, its 192.168.1.1 in our case. So whether using a Windows machine or linux machine as client, make sure that we have 192.168.1.1 as our gateway. Once that’s done, open terminal/CMD run a ping test against a website to make sure that internet is accessible on client machine,

$ ping google.com

We can also check by browsing websites via our web browser.

If you think we have helped you or just want to support us, please consider these :-