在 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
命令进行网络诊断。