VM how to connect Internet via Host

Discussions related to using VirtualBox on Linux hosts.
Post Reply
satimis
Posts: 506
Joined: 12. Jun 2007, 03:41

VM how to connect Internet via Host

Post by satimis »

Hi all

Host Debian 7.3
VM Ubuntu 12.04
Oracle VirtualBox

Cable connection of Host
ISP -> PC
Static IP address
2 NICs

Host can access Internet

/etc/network/interfaces

Code: Select all

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
     address xxx.xxx.xxx.xxx
     netmask xxx.xxx.xxx.xxx
     broadcast xxx.xxx.xxx.xxx
     gateway xxx.xxx.xxx.xxx
/etc/resolv.conf

Code: Select all

nameserver  xxx.xxx.xxx.xxx
nameserver  xxx.xxx.xxx.xxx

Please advice how to make VM connect Intenet via Host?

Would following document relevant?
VirtualBox: Make your virtual machine accessible from your host system but not from the local network
http://slopjong.de/2013/05/14/virtualbo ... l-network/

Thanks

Rgds
satimis
kvasnicka
Posts: 6
Joined: 12. Apr 2014, 21:26

Re: VM how to connect Internet via Host

Post by kvasnicka »

use bridge mode....
satimis
Posts: 506
Joined: 12. Jun 2007, 03:41

Re: VM how to connect Internet via Host

Post by satimis »

kvasnicka wrote:use bridge mode....
Hi,

Thanks for your advice.

I did that before behind a router. But now there is no router I could not figure out how set Br0 on both Host and VM (a webserver). I want VM assigned a static IP so that it can be browsed on Internet.

Here below is my suggestion:

Host

Code: Select all

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
     address xxx.xxx.xxx.xxx
     netmask xxx.xxx.xxx.xxx
     broadcast xxx.xxx.xxx.xxx
     gateway xxx.xxx.xxx.xxx

auto br0
iface br0 inet static
	address		192.168.0.100 ?
	network		192.168.0.0    ?
	netmask		255.255.255.0  ?
	broadcast	192.168.0.255  ?
	gateway		192.168.0.1 ?
	bridge_ports	eth1 ?
	bridge_fd	9
	bridge_hello	2
	bridge_maxage	12
	bridge_stop	off
On VM

Code: Select all

# The loopback network interface
auto lo
iface lo inet loopback

auto br0
iface br0 inet static
	address		192.168.0.101  ?
	network		192.168.0.0	?
	netmask		255.255.255.0  ?
	broadcast	192.168.0.255  ?
	gateway		192.168.0.1  ?
	bridge_ports	eth1   ?
	bridge_fd	9 
	bridge_hello	2  
	bridge_maxage	12
	bridge_stop	off
Please advise. Thanks

Rgds
satimis
Post Reply