ping to local interface v4 address works, even though it's admin/line down

Discussion in 'Linux Networking' started by anjanish, Sep 13, 2012.

  1. anjanish

    anjanish Guest

    Can somebody help me understand why ping works to a local interface, even if it's admin and line protocol down in linux.

    I have a eth1 interface, i assign v4 address to it.
    I make the interface down.
    try ping to the v4 address, and ping is success.

    Please find the logs for the bahaviour.

    [email protected]:/home/avinash# uname -a
    Linux avi 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux
    [email protected]:/home/avinash#

    [email protected]:/home/avinash# ifconfig eth1 22.0.0.1
    [email protected]:/home/avinash# ifconfig eth1
    eth1 Link encap:Ethernet HWaddr 00:30:48:b1:ee:33
    inet addr:22.0.0.1 Bcast:22.255.255.255 Mask:255.0.0.0
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:65 errors:0 dropped:0 overruns:0 frame:0
    TX packets:17082 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:5926 (5.9 KB) TX bytes:3841723 (3.8 MB)
    Interrupt:44 Base address:0xe000

    [email protected]:/home/avinash# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 10.16.48.1 0.0.0.0 UG 100 0 0 eth0
    10.16.48.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    22.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
    169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
    [email protected]:/home/avinash# ifconfig eth1 down
    [email protected]:/home/avinash# route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 10.16.48.1 0.0.0.0 UG 100 0 0 eth0
    10.16.48.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
    [email protected]:/home/avinash# ifconfig eth1
    eth1 Link encap:Ethernet HWaddr 00:30:48:b1:ee:33
    inet addr:22.0.0.1 Bcast:22.255.255.255 Mask:255.0.0.0
    BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:65 errors:0 dropped:0 overruns:0 frame:0
    TX packets:17082 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:5926 (5.9 KB) TX bytes:3841723 (3.8 MB)
    Interrupt:44 Base address:0xe000

    [email protected]:/home/avinash# ping 22.0.0.1
    PING 22.0.0.1 (22.0.0.1) 56(84) bytes of data.
    64 bytes from 22.0.0.1: icmp_req=1 ttl=64 time=0.027 ms
    64 bytes from 22.0.0.1: icmp_req=2 ttl=64 time=0.019 ms
    ^C
    --- 22.0.0.1 ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 999ms
    rtt min/avg/max/mdev = 0.019/0.023/0.027/0.004 ms
    [email protected]:/home/avina
     
    anjanish, Sep 13, 2012
    #1
    1. Advertisements

  2. anjanish

    Jorgen Grahn Guest

    I guess the kernel doesn't bother to check eth1's state. The address
    exists and is local, so traffic to it will not touch the actual eth1
    -- it will behave almost as the loopback.

    I am pretty sure that tcpdump -ieth1 will not show anything either,
    even if eth1 is up.


    /Jorgen
     
    Jorgen Grahn, Sep 13, 2012
    #2
    1. Advertisements

  3. anjanish

    Rick Jones Guest

    Indeed. Pinging a local IP address will not even get to the driver,
    let along the NIC itself. I suppose that can be thought of as
    consistent with taking a "weak end system model" point of view whereby
    IP addresses are properties of the system rather than the NICs
    themselves. That manifests itself when one connects multiple NICs to
    the same broadcast domain (switch set) - traffic can end-up traveling
    in/out just any of the interfaces so connected regardless of the IP
    addresses involved.

    rick jones
     
    Rick Jones, Sep 13, 2012
    #3
  4. anjanish

    Jorgen Grahn Guest

    And indeed, it's lo's counters that are increased by that traffic.

    Is this somehow a problem for you, or is it a matter of understanding?

    /Jorgen
     
    Jorgen Grahn, Sep 13, 2012
    #4
  5. anjanish

    anjanish Guest


    I don't see a issue due to it, but was trying to understand why does it behave in this manner.

    When i try configuring global ipv6 address on same interface, and bring down the interface the ipv6 address is removed, so the behavior is different compared to v4.

    What this difference in between v4 Vs v6.

    Thanks
    Anjanish
     
    anjanish, Sep 14, 2012
    #5
  6. anjanish

    anjanish Guest

     
    anjanish, Sep 14, 2012
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.