在 CentOS 系统中,你可以使用 ifconfig 命令来查看网络接口的状态。以下是使用 ifconfig 查看网络接口状态的步骤:
打开终端:
你可以通过快捷键 Ctrl + Alt + T 打开终端。
输入命令: 在终端中输入以下命令并按下回车键:
ifconfig
查看输出:
ifconfig 命令会显示系统中所有网络接口的详细信息,包括接口名称(如 eth0、ens33 等)、IP 地址、子网掩码、广播地址、MAC 地址、接口状态(如 UP 或 DOWN)等。
例如,输出可能类似于以下内容:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:fe4e:66a1 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:4e:66:a1 txqueuelen 1000 (Ethernet)
RX packets 1000000 bytes 100000000 (95.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1000000 bytes 100000000 (95.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1000000 bytes 100000000 (95.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1000000 bytes 100000000 (95.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在这个例子中:
eth0 是一个以太网接口,状态为 UP(运行中)。lo 是一个本地回环接口,状态也为 UP(运行中)。查看特定接口: 如果你只想查看特定接口的状态,可以使用以下命令:
ifconfig eth0
这将只显示 eth0 接口的详细信息。
通过这些步骤,你可以轻松地使用 ifconfig 命令来查看 CentOS 系统中网络接口的状态。