3.Host-only模式(仅主机模式)

    Host-only模式:是一种封闭的网络模式,虚拟机只能与宿主机通过VMnet1进行通信。这种模式适合于在一个独立的环境中进行各种网络实验。这种模式与NAT模式的区别是没有地址转换服务,虚拟机只能访问到宿主机。

    下面是一个关于Host-only使用的例子:

①虚拟机中编辑网络模式,选择Host-only模式:

wKiom1P_-eWwQWrnAAJFkagMt-o013.jpg

②将虚拟机中网络连接的IP地址设置为:

wKiom1QAB4vBiURgAAF6S85tcbU358.jpg

③宿主机的VMnet1的网络连接IP设置为:

wKioL1P_-7HiNi39AAH4OArKZ6U313.jpg

④网络拓扑图:

    虚拟机通过VMNet1与宿主机进行通讯,但不能与172.16.1.x这个网段进行通讯。

wKiom1QABc_wutM9AADyweArFmw722.jpg


⑤测试:

在虚拟机中ping宿主机:

C:\Documents and Settings\Administrator>ping 192.168.181.1
Pinging 192.168.181.1 with 32 bytes of data:
Reply from 192.168.181.1: bytes=32 time<1ms TTL=64
Reply from 192.168.181.1: bytes=32 time<1ms TTL=64
Reply from 192.168.181.1: bytes=32 time<1ms TTL=64
Reply from 192.168.181.1: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.181.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

在虚拟机中ping外界网络:(不能访问)

C:\Documents and Settings\Administrator>ping 172.16.1.73
Pinging 172.16.1.73 with 32 bytes of data:
Destination host unreachable.
Destination host unreachable.
Destination host unreachable.
Destination host unreachable.
Ping statistics for 172.16.1.73:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

#结束