4
3
When I down the loopback interface and try to ping my own IP, it's showing 100% packet loss, even when my eth0
is up. Why is this?
Here's what I did:
root@faisal-desktop# ifconfig lo down
root@faisal-desktop# ping -I eth0 172.16.10.112 -c 2
PING 172.16.10.112 (172.16.10.112) from 172.16.10.112 eth0: 56(84) bytes of data.
--- 172.16.10.112 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1007ms
root@faisal-desktop# ifconfig
eth0 Link encap:Ethernet HWaddr 6c:f0:49:f6:82:03
inet addr:172.16.10.112 Bcast:172.16.10.255 Mask:255.255.255.0
inet6 addr: fe80::6ef0:49ff:fef6:8203/64 Scope:Link
.
.
Check the ifconfig TX packets count
root@faisal-desktop# ifconfig
eth0 Link encap:Ethernet HWaddr 6c:f0:49:f6:82:03
inet addr:172.16.10.112 Bcast:172.16.10.255 Mask:255.255.255.0
inet6 addr: fe80::6ef0:49ff:fef6:8203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25822 errors:0 dropped:0 overruns:0 frame:0
TX packets:24825 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19581301 (19.5 MB) TX bytes:4013322 (4.0 MB)
Interrupt:26 Base address:0x6000
root@faisal-desktop# ping -c 1 -I eth0 172.16.10.112
PING 172.16.10.112 (172.16.10.112) from 172.16.10.112 eth0: 56(84) bytes of data.
--- 172.16.10.112 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
root@faisal-desktop# ifconfig
eth0 Link encap:Ethernet HWaddr 6c:f0:49:f6:82:03
inet addr:172.16.10.112 Bcast:172.16.10.255 Mask:255.255.255.0
inet6 addr: fe80::6ef0:49ff:fef6:8203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:25840 errors:0 dropped:0 overruns:0 frame:0
TX packets:24845 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19588641 (19.5 MB) TX bytes:4017338 (4.0 MB)
Interrupt:26 Base address:0x6000
It doesn't say "*pinging to the same interface." it says "Anything sent to one of the host's own IP addresses is sent to the loopback interface." It also says "a loopback interface [...] allows a client and server on the same host to communicate with each other using TCP/IP.*" The implication is that without a loopback interface this is not possible. – RedGrittyBrick – 2011-08-16T09:31:49.470
Yea thats it. I have a doubt, do you know in which module / function that comparison happens? – Faisal – 2011-08-16T10:05:33.360
Alright, but i couldn't find it. Can anyone point out the file/function which is responsible for comparing packets(sending out) destination ip with interfaces ip, and changing to loopback !!. – Faisal – 2011-08-17T06:27:09.257
I doubt its in $(KERNEL_SOURCE)/net/ipv4/route.c – Faisal – 2011-08-17T12:38:21.157