月份:十一月 2018

virtual box network how to

Posted on Updated on

  1. 靜態配置 Host 機器上的 Virtual Box Host only 的網路介面ip : ex: 10.0.2.16
  2. 配置 Client (VM) 裏頭的兩張介面卡 IP
    1. NAT: (第一個介面, eth0) 10.0.2.15
    2. Virtual Host Only: (第二個介面, eth3) 10.0.2.17
  3. 將 Windows 上 的 LAN/Wifi 網路卡開放分享給 Virtual Box Host Only。
  4. Client 裏頭的 routing table

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.0.2.16 255.255.255.0 UG 0 0 0 eth0
10.0.2.0 * 255.255.255.0 U 1 0 0 eth3
10.0.2.0 * 255.255.255.0 U 1 0 0 eth0

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=58 time=7.33 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=58 time=7.48 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=58 time=10.7 ms
— 8.8.8.8 ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 7.336/8.534/10.779/1.591 ms

廣告