防火墙一定要关闭,否则ping不成功 在linux虚拟机里面使用ifconfig ens33一直未显示ip。找了一堆博客始终未能解决,由于之前修改虚拟机网络ip一直使用reboot命令来生效,导致耗费时间长。我 man nmcli 后想重启网络,也不成功。后来找到如下三个命令。 先来这三个命令
[root@localhost network-scripts]# nmcli c up ens33 连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/4) [root@localhost network-scripts]# nmcli d reapply ens33 成功重新应用连接到设备 "ens33"。 [root@localhost network-scripts]# nmcli d connect ens33 成功用 "ens330f4ba42f-41df-4d98-ab36-9e7b226df28f" 激活了设备 ""。nmcli c up ens33 把我ens33这个设备的连接激活 nmcli d reapply ens33 把设备的变更更新到当前的激活连接状态 nmcli d connect ens33 连接设备ens33
再次使用ifconfig命令终于ip出来了,下面的第三行的inet终于显示, 前面一直不显示。
[root@localhost network-scripts]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.137.145 netmask 255.255.255.0 broadcast 192.168.137.255 inet6 fe80::20c:29ff:fe66:7c5b prefixlen 64 scopeid 0x20<link> ether 00:0c:29:66:7c:5b txqueuelen 1000 (Ethernet) RX packets 485 bytes 52209 (50.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 169 bytes 22428 (21.9 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 3648 bytes 307816 (300.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3648 bytes 307816 (300.6 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:a5:56:6d 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再次ping本机ip就ok了,但是出现重复文件 我这里就不列出。本机拼linux虚拟机也OK 如下:
C:\Users\TMY-ssd>ping 192.168.137.145 正在 Ping 192.168.137.145 具有 32 字节的数据: 来自 192.168.137.145 的回复: 字节=32 时间<1ms TTL=64 来自 192.168.137.145 的回复: 字节=32 时间<1ms TTL=64 来自 192.168.137.145 的回复: 字节=32 时间=1ms TTL=64 来自 192.168.137.145 的回复: 字节=32 时间=1ms TTL=64 192.168.137.145 的 Ping 统计信息: 数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失), 往返行程的估计时间(以毫秒为单位): 最短 = 0ms,最长 = 1ms,平均 = 0ms