1

enter image description here

EDIT: I have added a topology diagram to make it clearer.

I want to access the subnet 172.19.X.X (BLUE) from LAN->M2

I am already able to do via M1 which has a static route.

I trying to solve a specific situation and dont know how to think about it. I have a LAN which wants to listen to UDP packets and establish TCP connections on a different subnet 172.19.X.X where a static IP 10.2.4.81 acts as a gateway. The gateway and LAN are on different network interfaces.

I am able to listen to this

I have a Ubuntu 20.04LTS server which has 2 network interfaces

ETH0 -> Static IP -> 10.2.4.82 / Gateway 10.2.4.81

ETH1 -> Gets DHCP from a Router and is on a LAN -> 10.13.100.X

10.2.4.81 acts as a gateway for another network 172.19.X.X

I have added a static route route add -net 172.19.0.0 netmask 255.255.0.0 gw 10.2.4.81

This allows me to access software bound to 10.13.100 subnet access 172.19.X.X subnet

I have other computers on LAN which also need to reach 172.19.X.X but has only 1 network interface

I am basically looking for a way where any traffic destined for 172.19 from LAN is routed to ETH1 interface and any response is routed back to the machine.

Question:

  1. Is this a IP forwarding problem that I need to think about ?
  2. Is there a bridging solution where somehow I bridge ETH0 and ETH1 and they appear to be on the same network and hence local lan machines can also add a similar static route to access the 172.19.0.0 subnet ?
  3. What is the most optimal way to solve this ?
DrBug
  • 111
  • 2

1 Answers1

0

If your M1 is the default GW for M2 and M3 and ip forward is enabled, you dont need to do anything... but you can add static route on them, something like route add -net 172.19.0.0 netmask 255.255.255 gw 10.13.100.143 (ip of ubuntu box)

  • Can you please elaborate a bit more ? – DrBug Sep 29 '22 at 06:54
  • So IP 10.13.100.M1 will be a static route for 10.13.100.M2 on the LAN. Can I do route add -net 172.19.0.0 netmask 255.255.0.0 gw 10.13.100.M1 on machine with IP 10.13.100.M2 and this will ensure M2 can see all networks M1 sees ? – DrBug Sep 29 '22 at 07:05