VirtualBox Network
Last one year, I am not setting my VirtualBox in the right way. So I need to switch the IP address between my working environment and home wifi environment.
Actually it is not necessary. I knew this long time ago. VirtualBox support the VM using 2 network Adapters. So the best way to set up the VM is that, one adapter with NAT Network and one with Host-only Adapter. Then we can access the outside network via NAT, and our host machine can access the VM from the Host-only Adapter.
Open the VirtualBox —> References ——> Network —> Add NAT Networks ——> Host-only Networks Tab, add One vboxnet0 —> Edit that —> Setting the DHCP Server with these information
Server Address: 192.168.56.100
Server Mask: 255.255.255.0
Lower Address Bound: 192.168.56.101
Upper Address Bound: 192.168.56.254
Then start the Virtual Machine.
> sudo vi /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
It works pretty well.
References:
https://technology.amis.nl/2014/01/27/a-short-guide-to-networking-in-virtual-box-with-oracle-linux-inside/
Last one year, I am not setting my VirtualBox in the right way. So I need to switch the IP address between my working environment and home wifi environment.
Actually it is not necessary. I knew this long time ago. VirtualBox support the VM using 2 network Adapters. So the best way to set up the VM is that, one adapter with NAT Network and one with Host-only Adapter. Then we can access the outside network via NAT, and our host machine can access the VM from the Host-only Adapter.
Open the VirtualBox —> References ——> Network —> Add NAT Networks ——> Host-only Networks Tab, add One vboxnet0 —> Edit that —> Setting the DHCP Server with these information
Server Address: 192.168.56.100
Server Mask: 255.255.255.0
Lower Address Bound: 192.168.56.101
Upper Address Bound: 192.168.56.254
Then start the Virtual Machine.
> sudo vi /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
It works pretty well.
References:
https://technology.amis.nl/2014/01/27/a-short-guide-to-networking-in-virtual-box-with-oracle-linux-inside/

本文介绍如何在VirtualBox中为虚拟机设置两个网络适配器:一个使用NAT网络,另一个使用宿主机仅适配器。通过这种方式,可以在不影响外部网络连接的情况下,实现宿主机与虚拟机之间的直接通信。
2989

被折叠的 条评论
为什么被折叠?



