阅读量:0
在 CentOS 系统中,使用 ifconfig 命令可以查看网络接口的 IP 地址信息。以下是具体步骤:
-
打开终端。
-
输入以下命令并按下回车键:
ifconfig -
终端会显示系统中所有网络接口的详细信息,包括 IP 地址、子网掩码、广播地址等。每个网络接口的信息通常以接口名称(如
eth0、ens33等)开头。
例如,输出可能类似于以下内容:
eth0: flags=4163 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
ether 08:00:27:4e:66:a1 txqueuelen 1000 (Ethernet)
RX packets 1003411 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 321 bytes 24321 (23.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 321 bytes 24321 (23.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在这个例子中:
eth0是一个网络接口。inet 192.168.1.100表示该接口的 IPv4 地址是192.168.1.100。inet6 fe80::a00:27ff:fe4e:66a1表示该接口的 IPv6 地址是fe80::a00:27ff:fe4e:66a1。
如果你只想查看特定接口的 IP 地址,可以使用 grep 命令来过滤输出。例如,查看 eth0 接口的 IP 地址:
ifconfig eth0 | grep 'inet '
或者使用 ip 命令,它提供了更现代和灵活的网络配置工具:
ip addr show eth0
这将显示 eth0 接口的详细信息,包括 IP 地址。
以上就是关于“centos里ifconfig命令怎么查看ip”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm