# Can't get internet to work in virtual environment



## BillBelamy (Mar 19, 2013)

Hi:

I am trying to get my internet connection to work in Virtualbox.  I am studying Unix system administration and I can't for the life of me figure out how to get the internet to work in freebsd FreeBSD in the virtual environment.  I have a virtual windows running as well as virtual Ubuntu and Debian, and both run fine. My host system is Ubuntu 12.10 if that matters.

Any and all help will be appreciated.

Looking through the forums, I found a couple of solutions, none of which have worked for me yet.

I need the internet in place so I can practice networking and network security--as well as to install bash.


----------



## wblock@ (Mar 19, 2013)

It is no different than other VMs.  Set the host to provide a network connection, usually NAT, then configure the VM to use DHCP to set up the network.

If you accepted the defaults, the second can be done in FreeBSD by editing /etc/rc.conf:

```
ifconfig_em0="SYNCDHCP"
```

About the second part: please do not change root's shell to bash.


----------



## BillBelamy (Mar 20, 2013)

*still having issues.*

Just changed the line of text, but still can't ping out or use the network commands.


----------



## drhowarddrfine (Mar 20, 2013)

Are you using the bridged adapter set in the VirtualBox Network settings?


----------



## wblock@ (Mar 20, 2013)

That setting will make no difference until you restart the VM or do `# service netif restart`.


----------



## _martin (Mar 20, 2013)

Hi, 

Please try using e.g. telnet to check the internet connection, don't use ping in VirtualBox VM.

For example, you can do: 

`$ telnet google.com 80`

ping doesn't work in VirtualBox if you are using DHCP.


----------



## X3RNAL9AN1C (Mar 24, 2013)

I had a similar issue today. I was attempting to test the latest GhostBSD(i386/lxde) in virtualbox. network did not work so i rebooted and set it to use NAT. well the little bugger still would not work right. through the following error message at me.


```
dhcpdiscover on pcn0 to 255.255.255.255 port 67 interval #
```

im sure i could of went in and ran an _ifconfig pcn0 up_ and set it up manually, but this is GhostBSD its supposed to do that automatically. a little more effort than what i was willing to put in just for a check up on a derivative.

i was able to fix this buy going into virtualbox's settings changing the adapter type. It was set as PCnet-FAST III (Am79c973), i changed it to intel PRO/1000 MT Desktop (82540EM). after that it did work. im not saying this is your problem. GhostBSD is just FreeBSD "pre-cooked" for a desktop, so it might apply, im no expert though.

I'm sure I could have gone in and ran an `ifconfig pcn0 up` and set it up manually, but this is GhostBSD, it's supposed to do that automatically. A little more effort than what I was willing to put in just for a check-up on a derivative.

I was able to fix this by going into Virtualbox's settings changing the adapter type. It was set as PCnet-FAST III (Am79c973), I changed it to Intel PRO/1000 MT Desktop (82540EM). After that it did work. I'm not saying this is your problem. GhostBSD is just FreeBSD "pre-cooked" for a desktop, so it might apply, I'm no expert though.


----------

