3

Here is my route -n output:


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

And if I try to add a static route by this command:

route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.50.1

I get the following output:

SIOCADDRT: No such process

Why that? Can anybody explain my the concept of adding static routes in linux.

If I also have a route-eth0 file under the /etc/sysconfig/network-scripts/ directory, with this line in it: 123.123.123.0/24 via 123.123.124.1, no effect is achieved after I restart the network.

So, can anybody give me some explanations, links or related stuff to read on this?

Thanks!


NOTE: What I observed: if I have added the 192.168.50.0 network and points to 'default' gateway (0.0.0.0), my command works good. But if I haven't it, I got the already mentioned ERROR. So, can you show me what I need to do more and where I'm wrong?

P.S. I'm a kind of a newbie in linux networking.

  • Are your IP's in network-scripts valid ? – Lucas Kauffman Jan 13 '12 at 12:55
  • there is probably something wrongly configured in your networking. post your /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/sysconfig/network files – thanosk Jan 13 '12 at 12:55
  • @thanosk I don't have a /etc/sysconfig/network-scripts/ifcfg-eth0 file. And my network file looks like:NETWORKING=yes HOSTNAME=artaxerxe. So, if I need more on this, just suggest me what I need to do. Thanks. – artaxerxe Jan 13 '12 at 13:00
  • What do you have under? Also, can you run the following and paste it into your paste: "ip addr" – Rilindo Jan 13 '12 at 13:30
  • 1
    The posted output seems to be taken from 'route -n' not from 'ifconfig'. – Khaled Jan 13 '12 at 17:39
2

The route you're trying to add is recursive.

route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.50.1

This translate to the following:

The next hop for 192.168.50.0/24 is 192.168.50.1

Ok. What is the next hop for 192.168.50.1?

The next hop for 192.168.50.0/24 is 192.168.50.1

> Uh? But this ain't possible. Then outputs the cryptic SIOCADDRT: No such process

This is confirmed by the second route you added:

route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.122.x

Your default gateway should be in the 192.168.122.0/24 network to be reachable from your computer.

1

You can get the "SIOCADDRT: No such process" error if "You attempted to set a route for a network before setting a host route for the gateway which handles traffic for that network."

ANSWER: First create a host route, then create a net route.

e.g. for network in question: local -> 192.168.50.1 -> 192.168.50.xx

route add -host 192.168.50.1 dev eth0
route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.50.1

This helped me https://support.symantec.com/en_US/article.TECH142841.html

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.