阅读量:2
ifconfig 是一个用于配置和显示 Linux 内核中网络接口的命令行实用程序。通过 ifconfig,你可以查看网络接口的状态、IP 地址、子网掩码等信息。以下是如何使用 ifconfig 查看网络接口的步骤:
-
打开终端(Terminal)。
-
输入以下命令并按 Enter 键:
ifconfig -
你将看到系统中所有活动的网络接口及其相关信息。输出结果类似于以下内容:
eth0: flags=4163mtu 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 ether 08:00:27:4e:66:a1 txqueuelen 1000 (Ethernet) RX packets 1003456 bytes 123456789 (117.7 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 987654 bytes 987654321 (941.5 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 12345 bytes 123456 (120.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12345 bytes 123456 (120.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 在这个例子中,有两个网络接口:
eth0和lo。eth0是一个以太网接口,lo是一个本地回环接口。 -
你可以查看特定网络接口的信息,例如
eth0,只需在ifconfig命令后添加接口名称:ifconfig eth0
请注意,在某些 Linux 发行版中(如 Ubuntu 18.04 及更高版本),ifconfig 可能已被弃用,建议使用 ip 命令替代。要使用 ip 命令查看网络接口,请输入以下命令:
ip addr show
以上就是关于“如何通过ifconfig查看网络接口”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm