首页 > 代码库 > Virtual Box VM network configuration - Virtual Box VM 配置上网

Virtual Box VM network configuration - Virtual Box VM 配置上网

Limitations:

Network: company

Host: DHCP

Host NIC bridge: disabled

Network access: limited

========================

Based on that, it might not be possible to set the VM to access Internet, & visible to host at the same time.

========================

1. Set the VM IP to "DHCP"

vi /etc/network/interfaces

Set the VM‘s NIC in Virtual Box as 网络地址转换(NAT)

Reboot VM.

Now VM can access public Internet via host‘s NIC. But host cannot access VM. You can use apt-get now.

--------------------------------

2. Set the VM IP to "static", make it in the same domain as VBox‘s NIC in host

Set the VM‘s NIC in Virtual Box as 仅主机(Host-Only)网络

Reboot VM.

Now VM cannot access Internet, but host can ping this VM‘s IP. You can do your dev work using this VM now.

Virtual Box VM network configuration - Virtual Box VM 配置上网