Link to home
Start Free TrialLog in
Avatar of Michael Berend
Michael BerendFlag for Germany

asked on

Access a third machine via a second machine

I've got three machines:
1. Linux PC:
    - NIC #1: 192.168.0.241, netmask 255.255.255.0, gateway: 192.168.0.100
      (so this is connected over a switch to the Windows machine (2.))
2. Windows 10 PC:
    - NIC #1: 192.168.0.100, netmask 255.255.255.0, no gateway
    - NIC #2: 10.16.109.100, netmask 255.0.0.0, gateway: 10.254.0.230
3. Linux machine
    - NIC #1: 10.254.0.230, netmask 255.0.0.0, gateway: 10.254.0.1 (Internet)

What do I have to do on which machine to get access from the Linux machine (1.) to the 10.x.x.x network (over the Windows machine (2.)?
I got above scenario working with Internet Connection Sharing on the Windows machine (2.) sharing its NIC #2 on its NIC #2.
However, it is extremely buggy (when restarting the Windows machine it is not working, have to switch on/off to make it work again, etc.)
So, I need a different solution just based on a few static routes perhaps?
Many thanks in advance,
Michael
ASKER CERTIFIED SOLUTION
Avatar of Cliff Galiher
Cliff Galiher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Windows PCs will not do routing by default.  I haven't done it since XP days, but you should still be able to turn on routing on the Windows machine by editing the registry.  I see by the following link it still worked with Win7.
https://www.wikihow.com/Enable-IP-Routing

It's not an ideal solution but does work.

Once done then you need to create static routes on the machines on each subnet showing the gateway for the other subnet as your modified PC.
Avatar of Michael Berend

ASKER

Hi Rob,
Many thanks for your quick answer.
I understood the first part, which I did already (enabled IP Routing on the Windows machine).
Could you just give me one more hint on what machine I would have to set which route then?
Sorry for bothering you with probably something trivial, but I always get confused about these routes.
The routing PC can only see networks directly connected to it, so assume it has 2 NIC's 192.168.100.1 and 192.168.200.1.  It knows the devices on those 2 subnets, but the devices on those two subnets do not know how to route traffic to the other subnet.  By default they use the default gateway and it does not have an answer.  That is actually where the routes should be added, but if wanting to use a PC to route the traffic...….

On every pc on subnet 192.168.100.x you have to add a route such as
route add -p 192.168.200.0 mask 255.255.255.0  192.168.100.1

then on every PC on subnet 192.168.200.x you have t add a route such as
route add -p 192.168.100.0 mask 255.255.255.0  192.168.200.1

You have to have routes in both directions, so that the packet knows how to get there, and then how to find its way back.

If a device's default gateway happens to be it's respective IP192.168.100.1 or 192.168.200.1 address, the rout is not necessary.

As Cliff said this is not an efficient way to handle routing, but in a pinch I have done so for temporary set ups in the past.
I added a route on the Linux-PC (1.):
- route add -p 10.0.0.0 mask 255.0.0.0 192.168.0.100
so it a "ping 10.x.x.x" would hit Windows machine (2.), which is connected with the 10.x.x.x network
however, I don't get an answer back.
What additional route (if any) do I have to set on the Windows machine then, so that the 10.x.x.x answer can find its way back?
As mentioned the device you are pinging can only respond if you add the return route to it.  The windows device acting as a router, does not need any routes added to itself.

On all devices on the 10.x.x.x network you would have to add
route -p 192.168.0.0 mask 255.255.255.0 mask 10.254.0.230
Hi Rob and Cliff,
I'd like to thank you for the great and timely answers.
You helped me a great deal.
I decided finally to go with "WinGate" to handle the required routing, since the individual routes on both sides of the networks is impossible to maintain.
Best regards,
Michael