I have a Linux computer and an eth0
interface with 2 IPs:
ip : 10.10.1.1
mask : 255.128.0.0
gw : 0.0.0.0
ip : 10.22.32.1
mask : 255.255.255.0
gw : 10.22.32.254
I would like to add a specific gateway for network 10.22.0.0/16, so this is what I did:
route add -net 10.22.0.0/16 gw 10.22.32.254 dev eth0
This doesn't work, and I can't reach machines on 10.10.0.0 anymore. Here is the routing table:
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0
10.0.0.0 0.0.0.0 255.128.0.0 U 1 0 0 eth0
10.22.0.0 10.22.32.254 255.255.0.0 UG 0 0 0 eth0
10.22.32.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
Does it fail because 10.22.0.0/16 is a subpart of 10.10.0.0/9?
Best Answer
The network layout has several issues:
You'll need to sort out subnet addresses and masks. If you use 10.10.0.0/16 you can use 10.22.0.0/16 as a distinct subnet but you'll need a router with an interface within each subnet.