1819796 Members
3106 Online
109607 Solutions
New Discussion юеВ

IP forwarding in Linux

 
Shyam Sundar
Advisor

IP forwarding in Linux

Hello,

We have a cluster setup with NIS configured on it. All nodes run Redhat linux (7.3)

The master node has 2 NIC's, one with the IP of 3.212.228.220(eth0) and the other with 192.168.1.1(eth1), the default gateway for the system is 3.212.228.96

All the other nodes in the cluster has one NIC and act as NIS clients with their IP range in 192 series and gateway as 192.168.1.1

Now from all the clients we are able to ping to 3.212.228.220 (eth0 of master node). But at the same time we are not able ping to other resources of 3.212.228.X network, even all nodes don't ping 3.212.228.96 (which is the default gateway of master node).

In the 3.212.228.96 router, return path is defined properly.

In this scenario, on the master node, whether IP forwarding should be enabled from 192.168.1.1 to 3.212.228.220?
If so, please guide me as how to do the same.

If there is anything else, which has to be done to access 3.212.228.X network from all clients, please advice.

Thanks & Regards,
Shyam
2 REPLIES 2
Ron Kinner
Honored Contributor

Re: IP forwarding in Linux

Your problem is that only the firewall knows how to get to your private ip addresses. (192.168.x.x is not allowed on the internet) In order for this to work your firewall has to do Network Address Translation (NAT). This substitutes a good ip address (in this case the router's) for the "bad" 192.168.x.x address in the source address of the packet. This allows the packet to go onto the internet and return. NAT is sometimes called masquerading in the LINUX world.

http://www.netfilter.org/unreliable-guides/NAT-HOWTO/NAT-HOWTO.linuxdoc.html

Gives a good overview of the process.

Ron
Jerome Fenal_1
Valued Contributor

Re: IP forwarding in Linux

Hello,

on the router 3.212.228.96, which I suppose is also the default gateway for all your clients, do you have a route defined to access 192.168.1.0/24 via 3.212.228.220 ?

If not, or if your organisation included more than one (default) router, do ask your network admin to add the needed route.

Remember that ip_forwarding on your gateway should be enabled (echo "1" > /proc/sys/net/ipv4/ip_forwarding)

Another option could also, as specified by the previous answer, to map the nodes' addresses (192.168.1.x) to the main network addresses, by using NAT (and not PAT/masquerading which would not help).
This sould be done on your master node, ip_forwarding should be enabled as well (packets going from an interface to the others, eth0 to eth1 and return)

HTH, regards,

J??r??me

Bienvenue chez moi