Emm*_*uel 4 linux networking ethernet
我必须通过设置绑定接口来保护 Linux 服务器上的接口。布线信息不准确。
有没有一种简单的方法可以知道两个接口是否连接到同一个 LAN?
有些接口没有 IP,如果可能的话,我宁愿不设置虚拟 IP。
我终于使用了它arping,它已经安装在服务器上:
ifconfig eth2 up
ifconfig ethO up
tcpdump -i eth2 -c 3 arp net 10.10.10.10
Run Code Online (Sandbox Code Playgroud)
并在另一个终端:
arping -D -I eth0 10.10.10.10
Run Code Online (Sandbox Code Playgroud)
tcpdump 应该显示这样的行:
16:15:43.032103 arp who-has 10.10.10.10 (Broadcast) tell 0.0.0.0
16:15:44.032277 arp who-has 10.10.10.10 (Broadcast) tell 0.0.0.0
16:15:45.032441 arp who-has 10.10.10.10 (Broadcast) tell 0.0.0.0
Run Code Online (Sandbox Code Playgroud)
*-D是可选的,但它提供了一个很好的 0.0.0.0 源地址。
一些想法,假设接口是eth0和eth1:
同时在两个接口上嗅探非单播流量。您应该看到所有数据包两次
( tcpdump -nni eth0 -c 10 broadcast or multicast & tcpdump -nni eth1 -c 10 broadcast or multicast & ) | sort
Run Code Online (Sandbox Code Playgroud)使用无 IP 协议进行探测。
例如使用此工具生成 DHCP 请求:http : //www.latinsud.com/pub/dhd/dhd.c
( sleep 1; ./dhd eth1 > /dev/null ) & tcpdump -nni eth0 udp and port 68
Run Code Online (Sandbox Code Playgroud)
您应该会看到如下内容:
14:46:16.449738 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 300
14:46:16.650330 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:50:56:99:76:cb, length 300
Run Code Online (Sandbox Code Playgroud)