Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have two VMs in my VirtualBox. Both are FreeBSD and should communicate between each other. I have created network with DHCP enabled and set like this:

Server Address  10.10.10.1
Server Mask 255.255.255.0
Lower Address Bound 10.10.10.100
Upper Address Bound 10.10.10.200

My VMs are pinging each other and getting right ip adress. This is what I must have and can´t change.

Now I want to access internet from one VM and I found that I must use two network cards but I don´t know how to set the second one. I am new with VirtualBox and this stuff so if you count with this in you answer I would appreciate that. And I have Windows 8 as host system if it´s matter.

share|improve this question
    
Why not define the network adapter as NAT for all VMs and let your router handle the DHCP? –  harrymc Oct 25 '12 at 11:51
    
I have it like that because I need it for school project. –  Bibo Oct 25 '12 at 13:56

2 Answers 2

up vote 2 down vote accepted
+50

Make sure the second network adapter is enabled. Also check the Advanced section for the second network adapter (Attached to: NAT) to make sure it's the same Adapter Type as the first network adapter (not a requirement but this way you will know the driver is loaded for it) and that Cable Connected is checked.

Verify in the FreeBSD guest that the /etc/rc.conf file has an entry to enable the added adapter. You'll see a line such as:

ifconfig_dc0="DHCP"

for the first and make sure there's an entry for the added adapter as well, example:

ifconfig_dc1="DHCP"

(replace the "dc" before the "1" with the same thing the current line has before the "0") then reboot the guest OS.

share|improve this answer
    
This was exactly what I was looking for. I knew that I must set something it settings and that It can´t be hard. Thank you very much. –  Bibo Oct 29 '12 at 13:08

Adding a network card is quite easy.

In the Networking section of the Virtual Machine's settings, choose an adapter tab. Tick Enable Network Adapter. For internet access, a NAT adapter is the easiest option. Then just click OK and you should be good to go!

Screenshot
Click for full size


See the VirtualBox networking documentation for detailed descriptions of what each adapter does.

Note that the GUI for VirtualBox only supports four adapters. To add more, you can use the VBoxManage modifyvm command (modifyvm networking documentation). VBoxManage list systemproperties will show the max number of network adapters available:

Maximum PIIX3 Network Adapter count:   8
Maximum ICH9 Network Adapter count:   36

PIIX3 and ICH9 are the two chipset options available on VirtualBox. PIIX3 is a very old chipset (and therefore does not support as many peripherals), but is the default for new VMs. You can change this in the System settings of the VM.

share|improve this answer
    
This is what I tried when I found that I must use two cards. Just added second card with NAT adapter but it didn´t help. I don´t know if it is because for Host-only I get dynamic ip from dhcp or something else. I just must set more settings for internet. –  Bibo Oct 23 '12 at 12:17
    
@Bibo Anything else is probably a configuration issue on the guest side. Make sure the guest can see the adapter (ifconfig), and take a look at the FreeBSD documentation on adding a network adapter. Win7/Kubuntu/OpenSUSE guests always detected the adapter automatically for me, but I've never used FreeBSD before. –  Bob Oct 24 '12 at 2:09
    
Putting the NAT adapter first may help. –  harrymc Oct 25 '12 at 14:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.