【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協議。

雖然對該命令不是非常了解,但是完美解決了我的問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM