在CentOS 7 mini版中使用ifconfig

2025-03-08 11:16:09

1、7版系统查看网络信息的命令CentOS 7最小化系统,使用“ip addr”和“ip link”命令来查找网卡详情。要知道统计数据,可以使用“ip -s link”。要查看网卡细节:ip addr[root@linuxprobe ~]#ip addr1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWNlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host loinet6 ::1/128 scope hostvalid_lft forever preferred_lft forever2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWNlink/void inet 127.0.0.1/32 scope host venet0inet 192.168.1.101/32 brd 192.168.1.101 scope global venet0:0要查看网络接口统计数据:ip link[root@linuxprobe ~]#ip link1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULTlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:002: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULTlink/void或者使用:ip -s link[root@linuxprobe ~]#ip -s link1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULTlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00RX: bytes packets errors dropped overrun mcast 0 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns0 0 0 0 0 0 2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULTlink/voidRX: bytes packets errors dropped overrun mcast 8515667 6667 0 0 0 0TX: bytes packets errors dropped carrier collsns300403 4249 0 0 0 0

2、在CentOS 7最小化服务器版本中启用“ifconfig”命令如果你不知道在哪里可以找到ifconfig命令,请按照以下简单的步骤来找到它。首先,让我们找出哪个包提供了ifconfig命令:[root@linuxprobe ~]# yum provides ifconfigLoaded plugins: fastestmirror Loading mirrorspeeds from cached hostfile* base: centos.aol.in* extras: centos.aol.in *updates: centos.aol.innet-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking toolsRepo : @baseMatched from: Filename : /usr/sbin/ifconfig或者你也可以使用以下命令yum whatprovides ifconfig这里,“provides”或者“whatprovides”开关用于找出某个包提供了某些功能或文件。net-tools包提供了ifconfig命令。因此,安装net-tools包也可以使用ifconfig命令。安装net-tools包yum install net-tools现在,你就可以像以往一样使用ifconfig命令了。[root@linuxprobe ~]# ifconfig -alo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 0 (Local Loopback)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500inet 127.0.0.1 netmask 255.255.255.255 broadcast 0.0.0.0 destination 127.0.0.1unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)RX packets 7073 bytes 8549159 (8.1 MiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 4611 bytes 359201 (350.7 KiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500inet 192.168.1.101 netmask 255.255.255.255 broadcast 192.168.1.101 destination 192.168.1.101unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)

猜你喜欢