【Vmware】NAT模式下网络无法连接

虚拟机无法ping通主机ip,看了网上的一些教程,重置了虚拟网络编辑器,但是还是连不上,虚拟机上查看网络IP如下:

a@ubuntu:~$ ifconfig
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  (本地环回)
        RX packets 289  bytes 21301 (21.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 289  bytes 21301 (21.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

那就是没有获取ip,所以从网上看到dhclient -v命令获取ip,使用后结果如下:

root@ubuntu:~# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.32.128  netmask 255.255.255.0  broadcast 192.168.32.255
        inet6 fe80::20c:29ff:fe4d:81bc  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:4d:81:bc  txqueuelen 1000  (以太网)
        RX packets 615  bytes 742729 (742.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 323  bytes 34986 (34.9 KB)
        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  (本地环回)
        RX packets 2505  bytes 191141 (191.1 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2505  bytes 191141 (191.1 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

dhclient命令的作用是:使用动态主机配置协议动态的配置网络接口的网络参数,也支持BOOTP协议。

虽然对该命令不是非常了解,但是完美解决了我的问题。

posted @ 2020-11-01 18:02  炮火覆盖  阅读(1007)  评论(0编辑  收藏  举报