介面細節
IFCONFIG
列出機器上可用的所有介面
$ ifconfig -a
列出特定介面的詳細資訊
語法:$ ifconfig <interface>
例:
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:x.x.x.x Bcast:x.x.x.x Mask:x.x.x.x
inet6 addr: xxxx::xxx:xxxx:xxxx:xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4426618 errors:0 dropped:1124 overruns:0 frame:0
TX packets:189171 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:382611580 (382.6 MB) TX bytes:36923665 (36.9 MB)
Interrupt:16 Memory:fb5e0000-fb600000
Ethtool - 查詢網路驅動程式和硬體設定
語法:$ ethtool <interface>
例:
$ ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: on (auto)
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
ip - 顯示/操作路由,裝置,策略路由和隧道
語法:$ ip { link | ... | route | macsec }
(請參閱 man ip
獲取完整的物件列表)
例子
列出網路介面
$ ip link show
將介面 eth0 重新命名為 wan
$ ip link set dev eth0 name wan
介面 eth0 向上(或向下)
$ ip link set dev eth0 up
列出介面的地址
$ ip addr show
新增(或 del)ip 和掩碼(255.255.255.0)
$ ip addr add 1.2.3.4/24 brd + dev eth0