1

I have four linux hosts networked together on a private 172.16.x.x/16 network. One of these hosts, call it host 1, has two NIC interfaces, one on the 172 network, and a second NIC which is attached directly to a single device on a 192.168.40.0/24 network. The network ip on this second NIC is 192.168.40.1, the attached device is 192.168.40.2. From host 1, I can ping any host on the 172 network and I can ping the device at 192.168.40.2. I want the other hosts on the 172 network to be able to connect to the device at 192.168.40.2. It seems like a simple problem but I cannot figure out how to do it. I have added a route on one of the hosts on the 172 network, which has ip address 172.16.101.20 as follows:

ip route add 192.168.40.0/24 via 172.16.101.20

This allows me to now ping 192.168.40.1 from the 172.16.101.20 host but I cannot ping 192.168.40.2.

Also, for other reasons, firewalld is disabled on all of these hosts, and ip forwarding is enabled on all hosts.

How can I provide network connectivity between the other hosts on the 172 network and the device attached to host 1?

1 Answers1

1

You need to add a specular route on the device with IP address 192.168.40.2 to tell it how to reach the 172.16 network, otherwise it will receive packets but it will not know how to reply to them.

How to do that depends on the device (since you insist on calling it "device", I assume it's not simply another Linux box).

Massimo
  • 68,714
  • 56
  • 196
  • 319
  • That's not possible as this is not a host you can login to. This device understands its only interface as the default gateway. The solution must involve the linux hosts. – Ray Roberts Sep 04 '20 at 19:24
  • The Linux host is already configured correctly, the problem is in the device. Can you tell it to use the Linux host as its default gateway? That would allow it to reach *any* network through it, including the one you want. – Massimo Sep 05 '20 at 05:32
  • Anyway, if you can't manage the route table in that "device", there is no solution. Routing needs to be bidirectional, devices in network A need to know how to reach network B, and devices in network B need to know how to reach devices in network A. – Massimo Sep 06 '20 at 23:59