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?