嗨我正在尋找命令行來顯示與接口相關的接口和ip。我運行命令ifconfig -a | grep -inet ..但我需要打印的界面也。我怎樣才能打印接口名稱?如何列出使用接口名稱配置IP的網絡接口
命令
ifconfig -a | grep inet
輸入
eth1 Link encap:Ethernet HWaddr 40:A8:F0:2D:B3:98
inet addr:10.33.211.67 Bcast:10.33.211.79
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth2 Link encap:Ethernet HWaddr 8C:DC:D4:AD:A6:EF
inet addr:64.15.238.227 Bcast:64.15.238.239
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3532763832 errors:0 dropped:0 overruns:0 frame:0
eth8 Link encap:Ethernet HWaddr 40:A8:F0:2D:B3:9A
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:3532763832 errors:0 dropped:0 overruns:0 frame:0
所需的輸出
eth1 inet addr:10.33.211.67 Bcast:10.33.211.79 Mask:255.255.255.240
eth2 inet addr:64.15.238.227 Bcast:64.15.238.239 Mask:255.255.255.240
eth8 ---------- blank because it has not been configured
能否請你幫忙嗎?
Mask應該從哪裏來? – Marged
我無權訪問dev/net,但未以root身份登錄 - 掩碼也來自上面的命令ifconfig -a | grep inet - – theuniverseisflat