ifconfig
命令在 CentOS 系统中用于配置、激活和查询网络接口参数。它的基本格式如下:
ifconfig [interface] [options]
interface
是可选参数,用于指定要操作的网络接口名称,如 eth0
、wlan0
等。如果不指定接口,ifconfig
将显示所有活动网络接口的信息。options
是可选参数,用于指定要对网络接口执行的操作,如设置 IP 地址、子网掩码、广播地址等。以下是一些常用的 ifconfig
命令示例:
ifconfig
eth0
):ifconfig eth0
eth0
):ifconfig eth0 192.168.1.100 netmask 255.255.255.0
eth0
):ifconfig eth0 up
eth0
):ifconfig eth0 down
请注意,ifconfig
命令在某些 CentOS 版本中可能已被弃用,建议使用 ip
命令替代。ip
命令提供了更强大的功能和更好的性能。