Page 1 of 1

Make host and guest use two internet connections

Posted: 4. Mar 2012, 14:55
by Bercy
Hi,

I'm trying to create a setup where I have one physical machine running Ubuntu.

The physical machine will run virtualbox, and will have one guest machine, also running Ubuntu.

I have two DSL connections available.

The physical machine has two network cards.

I'd like for the Ubuntu host to use the first DSL connection, and for the guest to use the second DSL connection.

Finally, I want both host and guest to use static internal (LAN) IPs, because I'll want both the guest and host to run web services that need to be accessible from outside, and so I need to know what IP to target in the DSL modems' port forwarding setups.

In other words, I'm trying to make one machine do the equivalent of what could be done with two physical machines using their own internet connection.

I've already tested simple bridged networking where the guest gets assigned its IP through DHCP, but going to a static ip on the guest has me stumped ?

Thanks for your help.

Re: Make host and guest use two internet connections

Posted: 4. Mar 2012, 15:00
by mpack
To make a guest also a particular host NIC, use bridged networking and choose which NIC you want to bridge too: exactly as you've already found (so not sure why you ask this and even make it the topic title).

As to how to configure a static IP address for a PC - that's a standard networking problem, nothing to do with VirtualBox.

Re: Make host and guest use two internet connections

Posted: 1. Apr 2012, 16:17
by Bercy
I succeeded in having the host and the guest each have its own external connection.

I have one modem at 172.24.101.1, the other one at 192.168.1.1.

The PC has two physical ethernet cards.

eth0 is set as a static IP : 192.168.1.10, with gateway and dns at 192.168.1.1
eth1 is set as a static IP : 172.24.101.10, with gateway and dns at 172.24.101.1

The guest is using bridged networking, on eth0. Inside the VM, the ip is also static at 192.168.1.10.

The ultimate goal is to be running web services in Tomcat on both the host and the guest, and I want to be able to access the host's web services from the guest, and vice versa, but, I don't want to go through the internet to do it, I want to be able to do it locally.

I'm a bit stumped at to what the guest's IP is from within the host, and what the host's IP is from within the guest ?

Tks for your help.

Re: Make host and guest use two internet connections

Posted: 2. Apr 2012, 09:01
by BillG
No, you should never have two systems using the same IP address. If the guest has a static IP set to use an Internet connection, the host does not need an IP address at all for that NIC.

So the guest has a static 192.168 address and uses an Internet connection at 192.168.1.1 and is bridged to eth0 on the host. The host has a static 172.14 address and uses an Internet connection at 172.24.101.1 through eth1 on the host. That is fine.

Use a separate network to access the host from the guest and vice versa. Set up a second NIC in the vm and link it to the host using host only networking. You can communicate using the host only IP addresses.