VirtualBox Network

本文介绍如何在VirtualBox中为虚拟机设置两个网络适配器:一个使用NAT网络,另一个使用宿主机仅适配器。通过这种方式,可以在不影响外部网络连接的情况下,实现宿主机与虚拟机之间的直接通信。
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/
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值