4

The system I'm trying to set up has an IP address 172.31.2.1. Its default gateway is 172.31.254.1. This works fine, and I can reach anything the gateway allows me to go to (172.31.0.0/16 + 149.244.178.0/24).

There is another gateway at 149.244.178.1 which will allow me to reach anything in 149.244.0.0, and I'm trying to add that to the table so I can access 149.244.64.250.

This is what my routing table currently looks like:

Kernel IP Routing table
Destination    Gateway      Genmask      Flags    Metric    Ref    Use    Iface
172.31.0.0     *            255.255.0.0  U        0         0        0    eth0
169.254.0.0    *            255.255.0.0  U        0         0        0    eth0
default        172.31.254.1 0.0.0.0      UG       0         0        0    eth0

route add 149.244.0.0/16 gw 149.244.178.1 gives the error:

route: netmask 0000ffff doesn't make sense with host route.

route add -net 149.244.0.0/16 dev eth0 changes the route table to:

Kernel IP Routing table
Destination    Gateway      Genmask      Flags    Metric    Ref    Use    Iface
172.31.0.0     *            255.255.0.0  U        0         0        0    eth0
169.254.0.0    *            255.255.0.0  U        0         0        0    eth0
149.244.0.0    *            255.255.0.0  U        0         0        0    eth0
default        172.31.254.1 0.0.0.0      UG       0         0        0    eth0

However, trying to add the gateway still gives me the same error. Sorry if it sounds convoluted, and any help is appreciated!

Sagar
  • 524
  • 3
  • 7
  • 20

1 Answers1

6

The 149.x.x.x host wouldn't be on your local subnet, so your computer would have no way of contacting it. A router between your subnet and that subnet should have both a 149.x and a 172.x address (on two different NICs hopefully), it would route between the two subnets.

Chris S
  • 77,337
  • 11
  • 120
  • 212
  • Or to put it a different way. Your routes always should specify a gateway on the directly attached networks that will be the next hop. – Zoredache Aug 24 '10 at 20:51
  • Ok. I thought that was the case, but was hoping against hope. Oh well. – Sagar Aug 24 '10 at 20:59