在 CentOS 中,ifconfig
是一個用于配置和顯示網絡接口的命令行工具
ifconfig
eth0
的接口):ifconfig eth0
ifconfig eth0 | grep 'inet '
ifconfig eth0 | grep 'broadcast'
ifconfig eth0 | grep 'ether'
eth1
的接口):sudo ifconfig eth1 up
eth1
接口配置 IP 地址 192.168.1.10
和子網掩碼 255.255.255.0
):sudo ifconfig eth1 192.168.1.10 netmask 255.255.255.0
eth1
接口):sudo ifconfig eth1 down
eth1
接口):sudo ifconfig eth1 up
eth1
接口):sudo ifconfig -d eth1
請注意,CentOS 7 及更高版本中的網絡管理工具已從 ifconfig
更改為 ip
。在這些系統上,您需要使用 ip
命令進行網絡診斷。