在 CentOS 系统中,ifconfig 命令用于配置、激活和查询网络接口。其基本格式如下:
ifconfig [interface] [options]
[interface]:指定要操作的网络接口名称,例如 eth0、ens33 等。[options]:可选参数,用于指定对网络接口的操作。以下是一些常用的 ifconfig 命令示例:
ifconfig
eth0):ifconfig eth0
eth0):ifconfig eth0 up
eth0):ifconfig eth0 down
eth0 分配 IP 地址 192.168.1.100,子网掩码为 255.255.255.0):ifconfig eth0 192.168.1.100 netmask 255.255.255.0
eth0):ifconfig eth0 down
请注意,ifconfig 命令在较新的 CentOS 版本中可能已被弃用,建议使用 ip 命令来替代。