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!


Solution 1:

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.