# WiFi network doesn't work



## eddie1985 (Mar 6, 2016)

Hi
I'm new on FreeBSD, and I run it on a Virtual Machine.
The problem is that, after the installation, my network doesn't work.
The network adapter of the VM is set to NAT (I think this is the right choice)....obviusly the network on the host is working.

This is the output of the ifconfig command:






These are etc/hosts, /etc/rc.conf files









The output of ping www.google.com is:

```
ping: cannot resolve www.google.com: Host name lookup failure
```

The output of `ifconfig em0 up scan` is:

```
ifconfig: unable to get scan results
```

Someone could be help me?
Thanks


----------



## tingo (Mar 6, 2016)

Why do you think that your virtual machine have a WiFi network card?
Your output shows that it has an em(4) network adapter. It also shows that your network adapter got an ip address, which is good.
Can you ping the ip address of any other machine? Or Google DNS servers? (8.8.8.8 or 8.8.4.4)
If so, the problem you have is with (domain) name resolution.
Does /etc/resolv.conf have any nameservers in it?


----------



## eddie1985 (Mar 6, 2016)

Hi, you are right, obviusly VM has a network adapter.
So, file /etc/resolv.conf is:






I ping 192.168.66.2, and it pings it.
I also ping 8.8.8.8, and it pings it.

So what is the problem?


----------



## wblock@ (Mar 6, 2016)

192.168.66.2 is not really a DNS server, then.
Step A: edit /etc/resolv.conf, entering the IP address of a real DNS server.  8.8.8.8 will work, but it is Google, and it must be assumed that they monitor and track every query.  This file will be overwritten by dhclient(8) each time the system boots.

Step B: figure out why 192.168.66.2 is being advertised by DHCP as a DNS server.


----------



## eddie1985 (Mar 6, 2016)

I'm not sure to understood...
Step A: I should add a new line to /etc/resolv.conf entering

```
nameserver 8.8.8.8
```
 ?
Step B: didn't understand


----------



## wblock@ (Mar 6, 2016)

eddie1985 said:


> I'm not sure to understood...
> Step A: I should add a new line to /etc/resolv.conf entering
> 
> ```
> ...


Yes.  But it will be overwritten the next time the system is restarted.  And Google will keep track of all of the sites you visit.


> Step B: didn't understand


A DHCP server is saying that 192.168.66.2 is a DNS server, but it is not.  It might be your VM software that is saying this, but it is obviously wrong because DNS does not work.

One way around this is to run the VM interface in bridged mode instead of NAT.  The VM will appear on the local network as if it were another machine plugged in next to the VM host, and talk to the real DHCP server, which is going to provide the address of a real, working DNS server.


----------



## kpa (Mar 7, 2016)

That 192.168.66.* address space smells like VirtualBox's host only network. Is this on VirtualBox? If it is make sure you don't have any host only networks configured and the VM is not attached to one.


----------



## eddie1985 (Mar 7, 2016)

Using the first solution it works, thanks. But it is a temporarly solution.

If I set the VM interface in bridged mode, instead, it doesn't work. I try also to ping 8.8.8.8 but it doesn't work.


----------



## wblock@ (Mar 7, 2016)

Let's start with the basics.  Which VM software is being used?  What nameservers are being used by the host?


----------



## eddie1985 (Mar 7, 2016)

wblock@ said:


> Let's start with the basics.  Which VM software is being used?  What nameservers are being used by the host?


I use VMWare as Virtual Machine.
The content of the /etc/resolv.conf file of the host is:

```
# Generated by resolvconf
domain m.unipi.it
nameserver 131.114.33.20
nameserver 131.114.33.21
```


----------



## wblock@ (Mar 7, 2016)

All right, those should also work with the VM network in bridged mode.  I don't know what settings are required in VMware, though.

Still, the host is getting those from DHCP.  Why doesn't the VM?


----------



## eddie1985 (Mar 9, 2016)

wblock@ said:


> All right, those should also work with the VM network in bridged mode.  I don't know what settings are required in VMware, though.
> 
> Still, the host is getting those from DHCP.  Why doesn't the VM?



Sorry, but I didn't understand. VM isn't set with DHCP?


----------



## SirDice (Mar 9, 2016)

Yes, but there's a DHCP server running on the VMWare side and it's this DHCP server that's supplying the wrong information.


----------



## eddie1985 (Mar 9, 2016)

So, should I "turn off" the DHCP server running on the VMWare side? I'm a little bit confused...with the VM network in bridged mode I use the DHCP of the host?


----------



## SirDice (Mar 9, 2016)

No, sorry. Just to be clear. With bridged networking your VM will be connected directly to your LAN. DHCP would then be served by a server (your router?) on your LAN. If you use Host-only or NAT network it will be the VMWare server that provides DHCP.


----------

