3

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.

2
  • Why not define the network adapter as NAT for all VMs and let your router handle the DHCP?
    – harrymc
    Commented Oct 25, 2012 at 11:51
  • I have it like that because I need it for school project.
    – Bibo
    Commented Oct 25, 2012 at 13:56

3 Answers 3

4
+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.

1
  • 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
    Commented Oct 29, 2012 at 13:08
2

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.

3
  • 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
    Commented Oct 23, 2012 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
    Commented Oct 24, 2012 at 2:09
  • Putting the NAT adapter first may help.
    – harrymc
    Commented Oct 25, 2012 at 14:15
0

For your guests have access the internet through "host-only", you need to have some firewall rules enabled. Full details on...

https://superuser.com/a/1238065/195840

NOTE: I did not answer completely your question here because in this way we will have a duplicate answer in the superuser.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .