Adding a second network interface to VMs, host has only one

This is for discussing general topics about how to use VirtualBox.
Post Reply
pdesjardins
Posts: 3
Joined: 15. Feb 2014, 23:21

Adding a second network interface to VMs, host has only one

Post by pdesjardins »

Hi.

I am installing software that requires multiple network interfaces. I am running VirtualBox on a laptop that has only one network interface (eth0). Is there a way to configure my VMs so that they will have two network interfaces (eth0 and eth1)?

I am using a bridged network adapter for the VMs. They need access to the internet and must be reachable from the host. The second interface handles connections between the VMs only so I could use a more restricted type of virtual network.

I have tried enabling adapter two for the VMs and restarting. I tried a few different configuration for adapter two but the ifconfig command never shows an eth1 interface, only the existing eth0.

Am I misunderstanding the way VirtualBox networking interacts with the Linux network configuration? If I enable a host-only adapter two for each VM, do I need to tell Ubuntu to configure it as eth1? I thought/hoped making the adapter available would prompt Ubuntu to add it to the list of network interfaces automatically.

The guest OS I am using is Ubuntu Server 12.04. I am using VirtualBox 4.2.16_UBUNTU and the host OS is Ubuntu 13.10.

Thanks for your help!

Peter Desjardins
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Adding a second network interface to VMs, host has only

Post by noteirak »

If you only need the VMs to talk to each other, but not to the host, simple set the network interface mode to "Internal" and set the same network name on all the VMs.
Since you already have bridge interface, you can use that one to talk to the host. Else, you would need to use Host-Only.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
pdesjardins
Posts: 3
Joined: 15. Feb 2014, 23:21

Re: Adding a second network interface to VMs, host has only

Post by pdesjardins »

Thanks for the advice. I enabled adapter two on each of the VMs, set the "attached to" to "internal network", and used the same name "eth3" for each of the interfaces.

I reinstalled the guest Ubuntu Server OS after making these configurations but the ifconfig command does not show eth3 on any of the VMs. There's no sign of the eth3 interface in /etc/network/interfaces either.

Do you know how I can get the Linux guest OS to see the new interface as if it had two physical interface cards? Or does it sound like I didn't configure the VM correctly?

Thanks for your help.

Peter
pdesjardins
Posts: 3
Joined: 15. Feb 2014, 23:21

Re: Adding a second network interface to VMs, host has only

Post by pdesjardins »

I figured out what was happening here. The new network interfaces were configured but I didn't realize that they need to be brought up explicitly. Using ifconfig -a I can see the new interfaces but they only appear in the ifconfig output after issuing a command such as:

ifconfig eth3 192.168.1.15 netmask 255.255.255.0 up

Thanks again for the help.
Post Reply