How to use a gateway on another subnet

routingsubnet

I'm trying my first attempts at routing and hitting the "Network is unreachable" message.

My goal is to successfully ping frome one machine (subnet 10.56.34.0) to a machine on a completely different network (10.1.201.0) even though my 10.56.34.0 subnet's gateway can't get there.

Here's what I have.

  • A business has created 3 subnets (don't know why): 10.56.33.0 / 10.56.34.0 /10.56.35.0.
  • I have a Linux box on the 10.56.34.0 subnet with a default gateway at 10.56.34.1.
  • That same Linux box can ping a gateway on the 10.56.35.0 subnet (at 10.56.35.253)
  • A Windows machine on the 10.56.35.0 subnet can successfully ping the server at 10.1.201.157 going through the gateway at 10.56.35.253 (I ran tracert).

In my first bumbling efforts I tried setting up a route directly from the 10.56.34.209 Linux box to the 10.1.201.0 network using the 10.53.35.253 gateway. That's when I first hit the "Network is unreachable" message. In the interim I've found out that you can't use a gateway on another subnet. (the .34 subnet can't use the .35 gateway). I tried adding a default gateway using the 10.56.35.253 gateway and got the same "Network is unreachable" message.

Okay. So then how DO i get my Linux box on the .34 subnet to send specific traffic (traffic to 10.1.201.0 subnet) through the 10.56.35.253 gateway?

Best Answer

Assuming your subnet mask is 255.255.255.0, you shouldn't need to do anything. Your default gateway (10.56.34.1) should know the way to forward the packets to the destination host. You get the unreachable when you are setting 10.56.35.253 as gateway because your machine is not connected on the 10.56.35.0 network, so your tcp/ip stack can not reach the gateway through layer 2 communication.

Maybe there is some kind of firewall / access lists that prevents your machine from reaching the destination?

Leave your default gateway to 10.56.34.1, try to ping 10.1.201.157 while you run on a different window tcpdump -n icmp . Do you get icmp network unreachable or something like icmp 3/13 admin prohibited filter ? If you try to traceroute to the destination what do you get?