我无法使用,localhost
因为从我的虚拟机的角度来看,localhost
它是虚拟机本身,而不是它所运行的底层主机。我如何从虚拟机连接到主机?
我尝试回答一个相关问题:https://superuser.com/a/310745/157900但我无法解读 的输出netstat -rn
。我的输出如下:
$ netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 172.28.0.1 UGSc 34 0 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 23 636160 lo0
169.254 link#4 UCS 0 0 en0
172.28/24 link#4 UCS 20 0 en0
172.28.0.1/32 link#4 UCS 1 0 en0
172.28.0.1 0:14:a9:69:86:d9 UHLWIir 36 24 en0 1190
172.28.0.31 a4:4e:31:19:89:58 UHLWI 0 3 en0 1088
172.28.0.32 74:e5:43:6:1e:f7 UHLWI 0 8 en0 1040
172.28.0.47 f0:db:e2:e5:f1:ad UHLWI 0 0 en0 1142
172.28.0.57 78:3a:84:a:c3:2b UHLWI 0 0 en0 701
172.28.0.63 88:1f:a1:2:fc:16 UHLWI 0 0 en0 1200
172.28.0.66 78:31:c1:be:da:46 UHLWI 0 0 en0 1148
172.28.0.70 64:76:ba:8d:b1:32 UHLWI 0 0 en0 854
172.28.0.73 78:31:c1:bb:7:3e UHLWI 0 0 en0 995
172.28.0.83/32 link#4 UCS 0 0 en0
172.28.0.90 2c:d0:5a:44:b0:6d UHLWI 0 14 en0 1166
172.28.0.97 30:59:b7:10:5f:ea UHLWIi 1 1 en0 1175
172.28.0.133 70:56:81:b9:b:3f UHLWI 0 0 en0 1095
172.28.0.137 a4:4e:31:1c:92:4c UHLWI 0 6 en0 976
172.28.0.138 90:72:40:90:57:b6 UHLWI 0 0 en0 963
172.28.0.152 b8:e8:56:10:bb:16 UHLWIi 1 0 en0 1106
172.28.0.157 a4:4e:31:1b:98:14 UHLWI 0 50 en0 1089
172.28.0.167 7c:d1:c3:e0:9d:77 UHLWI 0 0 en0 521
172.28.0.175 68:96:7b:49:c7:89 UHLWI 0 0 en0 456
172.28.0.212 18:f6:43:4a:ee:8f UHLWI 0 0 en0 21
172.28.0.229 7c:e9:d3:f6:3f:c8 UHLWI 0 51 en0 1136
172.28.0.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 en0
192.168.33 link#11 UC 2 0 vboxnet
192.168.33.1 a:0:27:0:0:1 UHLWIi 1 62 lo0
192.168.33.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 vboxnet
Internet6:
Destination Gateway Flags Netif Expire
::1 ::1 UHL lo0
fe80::%lo0/64 fe80::1%lo0 UcI lo0
fe80::1%lo0 link#1 UHLI lo0
fe80::%en0/64 link#4 UCI en0
fe80::1c5a:b8ac:59f0:4078%en0 7c:d1:c3:15:1a:ab UHLWI en0
fe80::3e15:c2ff:fec3:ecc4%en0 3c:15:c2:c3:ec:c4 UHLI lo0
fe80::%awdl0/64 link#8 UCI awdl0
fe80::444e:b5ff:fe10:887a%awdl0 46:4e:b5:10:88:7a UHLI lo0
ff01::%lo0/32 ::1 UmCI lo0
ff01::%en0/32 link#4 UmCI en0
ff01::%awdl0/32 link#8 UmCI awdl0
ff02::%lo0/32 ::1 UmCI lo0
ff02::%en0/32 link#4 UmCI en0
ff02::%awdl0/32 link#8 UmCI awdl0
尽管看起来空间中发生了一些事情,但上述内容对我来说大多毫无意义192.168.33
。
netstat -rn | grep "^0.0.0.0"
没有返回任何结果。
此外,我是否应该担心公开发布上述信息?
谢谢。
答案1
从网络角度来看,主机和虚拟机仍然带有不同的 LAN IP。您可以使用这些 IP 地址进行连接