Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Linux computer and an eth0 interface with 2 IPs:

ip :
mask :
gw :

ip :
mask :
gw :

I would like to add a specific gateway for network, so this is what I did:

route add -net gw dev eth0

This doesn't work, and I can't reach machines on anymore. Here is the routing table:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         U     0      0        0 eth0     U     1      0        0 eth0     UG    0      0        0 eth0   U     0      0        0 eth0     U     1000   0        0 eth0

Does it fail because is a subpart of

share|improve this question means directly connected, is behind a router? – NickW May 22 '14 at 9:08
Yes, the network is directly reachable (no routing needed) – user220746 May 22 '14 at 9:10
Route will tend to chose the closest match, so only - will be routed towards Otherwise it would chose I'd check if 1. the machines in have any routes, and 2. that is configured correctly to route. – NickW May 22 '14 at 9:15
There's no doubt that is correctly configured and machines in don't have routes. I also thought that it took the closest match, but it doesn't seem to do so :( – user220746 May 22 '14 at 9:18
When did the problem start? I'm wondering if the issue isn't due to the fact that the 10.22 IP falls into the 10.10 network, so when it sends traffic, it will fall back to originating from . – NickW May 22 '14 at 9:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.