我的embedded式Linux板有3个接口:
ifconfig显示如下:
eth1 Link encap:Ethernet HWaddr AA:BB:CC:DD:EE:FF inet addr:169.254.1.1 Bcast:169.254.255.255 Mask:255.255.255.255 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Base address:0x8000 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:16436 Metric:1 RX packets:14 errors:0 dropped:0 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1561 (1.5 KiB) TX bytes:1561 (1.5 KiB)
而且, route产量:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 169.254.1.1 * 255.255.255.255 UH 0 0 0 eth1 ABC96 * 255.255.255.240 U 0 0 0 eth0 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default ABC110 0.0.0.0 UG 0 0 0 eth0
我可以ping eth1接口的分配的IP,如下所示:
PING 169.254.1.1 (169.254.1.1): 56 data bytes 64 bytes from 169.254.1.1: seq=0 ttl=64 time=0.143 ms 64 bytes from 169.254.1.1: seq=1 ttl=64 time=0.067 ms
但是,根据ifconfig报告的RX / TX计数器, 所有的数据包出现在lo接口上,而不是eth1。
为什么? stream量是真正进入和离开eth1端口,但在lo界面下进行计算? 或者,交通真的都stream经了吗?
谢谢!
本地stream量不通过以太网接口。 基本上,本地stream量通过本地接口。 操作系统不知道你的eth1接口有硬件回送。
Linux的TCP / IP协议栈非常灵活。 看到:
# — let's add dummy IP-address to Wi-Fi NIC # ip ad ad 11.1.2.3/24 dev wlan0 # — Now chage its scope from 'local' to 'link' # ip ro replace 11.1.2.3 dev wlan0 scope link table local
…
# — with tcpdump we can see now that's traffic to that dummy # ex-local IP-address actually tries to go out of Wi-Fi NIC: 00:15:22.807607 ARP, Request who-has 11.1.2.3 tell 10.0.0.7, length 28