Static route in Centos 6

9,523
# ip route add xxx.xxx.xxx.0/ via xxx.yyy.zzz.qqq

Is also valid syntax, but methinks that the error you are getting is a fouled up way of telling you:

"cannot route 192.168.50.0 through 192.168.50.1, because i don't know how to get to 192.168.50.1 in the first place."

Note that 192.168.50.1 is in the 192.168.50.0 network.

Share:
9,523

Related videos on Youtube

artaxerxe
Author by

artaxerxe

Updated on September 18, 2022

Comments

  • artaxerxe
    artaxerxe over 1 year

    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?

  • Warren Young
    Warren Young over 12 years
    This answer is plausible, but I'd need artaxerxe to show his interface table (ifconfig -a) to be sure.
  • Alien Life Form
    Alien Life Form over 12 years
    Look, if you had an (up) interface already configured on 192.168.50.0, you would not need to manually add routes, because it would already be there (ip route show) as a part of the interface activation process. "ifconfig -a", of course, should tell the same story, as should "ip addr show". What is preventing you from running these commands?