Linux通过ifconfig命令ens33没有显示ip地址解决方式
一、问题:登录linux输入ifconfig, ether 00:0c:29:8f:a8:72
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:55:f5:0b txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
二、解决方式
重启红框里面的服务
使用reboot重启Linux。
reboot
再次使用 ifconfig
查看还是失败。
[master@localhost ~]$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:55:f5:0b txqueuelen 1000 (Ethernet)
RX packets 48 bytes 4912 (4.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 73 bytes 8466 (8.2 KiB)
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 304 bytes 26384 (25.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 304 bytes 26384 (25.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:17:39:86 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
最后发现因为虚拟机IP模式是dhcp而不是static,dhcp只有在联网时才会有IPV4分发的IP。