Ubuntu安裝時默認沒有安裝net-tools
,也就是說,你沒辦法直接通過ifconfig
查看ip地址,使用如下命令以安裝net-tools並查看虛擬機ip地址:
sudo apt-get install net-tools
ifconfig
輸出將類似如下:
hadoop@ubuntu:/usr/local/hadoop$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.232.131 netmask 255.255.255.0 broadcast 192.168.232.255
inet6 fe80::ea5e:285c:206:9acb prefixlen 64 scopeid 0x20
ether 00:0c:29:d0:db:3b txqueuelen 1000 (Ethernet)
RX packets 777911 bytes 1140658779 (1.1 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 137255 bytes 8401615 (8.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> 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 2787 bytes 1816194 (1.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2787 bytes 1816194 (1.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0由此你可以獲得你的ip,我當前的ip為 192.168.232.131。
如果你安裝的Ubuntu帶有GUI界面,你也可以在Settings中在以下位置查看ip地址:

