ip route add: RTNETLINK answers: Network is down

6,488

Ok after actually trying some of this ...

ip addr add aa.aa.aa.aa/24 dev eth0 label eth0:0
ip addr add dd.ad.aa.aa/27 dev eth0 label eth0:1
ip addr add gg.gg.gg.gg/14 dev eth0 label eth0:2
ip addr add 9.23.23.23/8 dev eth0 label eth0:3

All that's fine, and my machine thinks it's now on IBM's /8.

But there's actually no functional difference between eth0, eth0:0, eth0:1, eth0:2, eth0:3 that I can see. "ip route" and "netstat -nr" don't distinguish between the interfaces, they both report eth0. (although route and " ip route will accept the eth0:X alias label as a dev argument). "tcpdump -ni eth0" and "tcpdump -ni eth0:2" send and recieve the same traffic...however, if I do this

ip route replace to 9.23.23.23/8 src dd.ad.aa.aa dev eth0:1

my (unsuccessful) pings to 9.23.23.23.2 now appear to coming from my alias IP dd.ad.aa.aa. Which if I'm not mistaken, is what you were trying to accomplish before I distracted you with a bunch of irrelevant and wrong thinking.

I hope this helps.

Share:
6,488

Related videos on Youtube

samgreeneggsham
Author by

samgreeneggsham

Updated on September 18, 2022

Comments

  • samgreeneggsham
    samgreeneggsham almost 2 years

    I'm quite new to networking and I really can't figure this out.

    I am trying to add a static route so that all traffic to aa.aa.aa.aa goes through eth0:0 interface

     root@LSW-199:~# ifconfig
     eth0      Link encap:Ethernet  HWaddr 80:c1:6e:6f:f8:68  
               inet addr:xx.xx.xx.xx  Bcast:xx.xx.xx.xx  Mask:255.255.255.224
               inet6 addr: fe80::82c1:6eff:fe6f:f868/64 Scope:Link
               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
               RX packets:93598294 errors:0 dropped:0 overruns:0 frame:0
               TX packets:95074908 errors:0 dropped:0 overruns:0 carrier:0
               collisions:0 txqueuelen:1000 
               RX bytes:23532770742 (23.5 GB)  TX bytes:27395117749 (27.3 GB)
               Memory:c0400000-c0420000 
    
     eth0:0    Link encap:Ethernet  HWaddr 80:c1:6e:6f:f8:68  
               inet addr:bb.bb.bb.bb  Bcast:xx.xx.xx.xx  Mask:255.255.255.192
               UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
               Memory:c0400000-c0420000 
    
     lo        Link encap:Local Loopback  
               inet addr:127.0.0.1  Mask:255.0.0.0
               inet6 addr: ::1/128 Scope:Host
               UP LOOPBACK RUNNING  MTU:65536  Metric:1
               RX packets:107 errors:0 dropped:0 overruns:0 frame:0
               TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
               collisions:0 txqueuelen:0 
               RX bytes:9416 (9.4 KB)  TX bytes:9416 (9.4 KB)
    

    The eth0:0 is definitely working because when I use cURL to test it can successfuly use the device and the IP is correct:

     root@LSW-199:~# curl --interface eth0:0 api.ipify.org
     bb.bb.bb.bb
    

    But when I try to add a static route I get this error message:

     root@LSW-199:~# ip route add aa.aa.aa.aa via bb.bb.bb.bb
     RTNETLINK answers: Network is down
    

    I have tried it service networking restart and ifconfig eth0:0 down/up with no luck.

    Any ideas?

  • samgreeneggsham
    samgreeneggsham about 7 years
    The first one is giving me this error: SIOCADDRT: No such device The second is giving me this error: route: netmask doesn't match route address My eth0:0 interface has a different netmask, could this cause any problems?