# How to get network working under virtualbox?



## bigtoque (Nov 28, 2011)

I'm trying to get FreeBSD 9-RC2 running in VirtualBox and during the install (using the net install iso), I am able to get a network connection and the install works.

After rebooting and loading up the newly installed system, I am unable to get a network connection.

The system automatically added to /etc/rc.conf:


```
ifconfig_em0="DHCP"
```

So what is the BSDinstall application running to configure the network during install that I need to do to get a connection after the install?


----------



## SirDice (Nov 29, 2011)

bigtoque said:
			
		

> So what is the BSDinstall application running to configure the network during install that I need to do to get a connection after the install?


There isn't any. You use tools like dhclient(8), ifconfig(8) and route(8).

Can you post the output of dmesg(8) just after boot?


----------



## wblock@ (Nov 29, 2011)

bigtoque said:
			
		

> I'm trying to get FreeBSD 9-RC2 running in VirtualBox and during the install (using the net install iso), I am able to get a network connection and the install works.
> 
> After rebooting and loading up the newly installed system, I am unable to get a network connection.



Could you be more specific about what you mean by that?  What errors?  If you're testing with ping... well, pings don't make it through VirtualBox's NAT.  So try another protocol.



> The system automatically added to /etc/rc.conf:
> 
> 
> ```
> ...



That should work, although I prefer SYNCDHCP.



> So what is the BSDinstall application running to configure the network during install that I need to do to get a connection after the install?



Could it be that when bsdinstall ran, the VirtualBox networking kernel module had been loaded manually, but now it's after a reboot of the host?  That would apply if you have the VM set to bridged networking.


----------



## bigtoque (Nov 29, 2011)

I didn't know an easy way to post the output of dmesg, so I just stitched together a few screenshots:

http://imageshack.us/photo/my-images/526/dmesg.png/

To be more specific, the virtual network device in FreeBSD gets an IP address of 10.0.2.15, and when you do something like ping a website (which I know doesn't work), it knows the destination IP address.

I can't run a command like 
	
	



```
pkg_add -r xorg
```
 because it can't find any external addresses.


----------



## wblock@ (Nov 29, 2011)

The zoom on that image doesn't work for me.  The question is what error message is returned from the pkg_add.  RC2 needs to have the PACKAGESITE variable set or it won't find any packages.

That it gets an IP address and DNS says the network is working.


----------



## bigtoque (Nov 30, 2011)

Setting the packagesite fixed the issue.

Thanks for the help. Out of curiosity, was this information posted somewhere that I should have checked first?


----------



## wblock@ (Nov 30, 2011)

Not that I know of, it's just something that happens with non-release installs.


----------

