AIX下,如何判断某个网口是否连接了网线
这个例子中,en0没接网线,用如下命令可以帮助判断。
myaix#/> netstat -v en0 | grep -p "Specific Statistics"
2-Port 10/100/1000 Base-TX PCI-X Adapter (14108902) Specific Statistics:
--------------------------------------------------------------------
Link Status : Down
Media Speed Selected: Auto negotiation
Media Speed Running: Unknown
PCI Mode: PCI-X (100-133)
PCI Bus Width: 64-bit
Latency Timer: 144
Cache Line Size: 128
Jumbo Frames: Disabled
TCP Segmentation Offload: Enabled
TCP Segmentation Offload Packets Transmitted: 11
TCP Segmentation Offload Packet Errors: 0
Transmit and Receive Flow Control Status: Enabled
XON Flow Control Packets Transmitted: 0
XON Flow Control Packets Received: 0
XOFF Flow Control Packets Transmitted: 0
XOFF Flow Control Packets Received: 0
Transmit and Receive Flow Control Threshold (High): 45056
Transmit and Receive Flow Control Threshold (Low): 24576
Transmit and Receive Storage Allocation (TX/RX): 16/48
如果认为某个网口长时间没有收发数据包,就是这个网口没连接网线,那下面的命令也可以。
myaix#/> tcpdump -i en0
tcpdump: listening on en0
^C
0 packets received by filter
0 packets dropped by kernel
myaix#/>
myaix#/> netstat -s -Z -I en1; netstat -s -s -I en1
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
en1 1500 link#3 0.2.55.2f.74.63 0 0 0 0 0
en1 1500 9.186.183 myaix 0 0