# DHCP 1, VM or FreeBSD 0



## sevenk (Feb 16, 2015)

I wish to know how fix my DHCP network on FreeBSD 11.0 Current that works in a VM. I tested network sharing on the VM: no results, host only on VM: no results, Ethernet 1 (em0) where is the cable: no results. There is a detail set up because on FreeBSD 10, as I can remember, it worked. Once again I have been curious to BSD instead to coding.
But coding on systems like mindom or epple is an error that I can't do. I have to code to have a better life because nowadays it doesn't make it as you know.


----------



## wblock@ (Feb 16, 2015)

Many things are not clear.  FreeBSD 11 is running in a VM.  What is the virtualization software, and what kind of host is it running on?

By "no results", do you mean the FreeBSD VM does not get a DHCP lease?  What messages are shown?


----------



## sevenk (Feb 16, 2015)

I'm almost ashamed: Parallels 10 on Mac OS X, there is an option called "host only" which different that "shared network" as you say it's not clear, I have the option also to choose "ethernet 1" "ethernet 2" because I have a double network output on hardware.
if I do an `ifconfig` my ethernet is active. when I do a `portsnap fetch` it fails.


----------



## junovitch@ (Feb 17, 2015)

Can you show the output of `ifconfig`?


----------



## wblock@ (Feb 17, 2015)

Parallels has three network modes, like VirtualBox.  Host only is not the right one, it will not give the VM outside access.  Bridged gives the VM direct access to the network.  Shared puts the VMs on their own subnet and the Mac acts as the host with its own DHCP server.

In addition to the output of `ifconfig` as requested by junovitch above (on the VM, not the host), please show the ifconfig lines in /etc/rc.conf.


----------



## sevenk (Feb 17, 2015)

So ifconfig part in /etc/rc.conf is:

```
ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"
ifconfig_em0="inet 192.168.10.100 netmask 255.255.255.0"[code]
```
[/code]


----------



## wblock@ (Feb 17, 2015)

That will not work.  Those three lines assign different values to the same variable.  Each one overwrites the previous value, so only the last counts.  The first and last are opposite anyway.  Try just the first, or better, use SYNCDHCP:

```
ifconfig_em0="SYNCDHCP"
```


----------



## sevenk (Feb 18, 2015)

I have to precise that I'm running mac os x 10.10 with parallels 10. I tried 
	
	



```
ifconfig_em0="SYNCDHCP"
```
 but 
	
	



```
portsnap fetch
```
 failed 
	
	



```
no mirrors remaining, giving up
```


----------



## tobik@ (Feb 18, 2015)

This is all pretty vague.

Please post the output of `ifconfig`, `route get default` and the contents of /etc/resolv.conf after a fresh VM reboot.


----------



## sevenk (Feb 19, 2015)

`ifconfig`

```
em0: flags=8843<UP,BROADCOAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
 ether 00:1c:42:6f:51:1c 
inet 192.168.1.3 netmask 0xffffff00 broadcast 192.168.1.255 
nd6 options=29<PERFORMNUD, IFDISABLED,AUTO_LINKLOCAL 
media: Ethernet autoselect (1000baseT <full-duplex>) status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
 options=60003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> 
inet6 ::1 prefixlen 64 scopeid 0x2 
inet 127.0.0.1 netmask 0xff000000 
nd6 options=21<PERFORNUD,AUTO_LINKLOCAL>
groups: lo
```
`route get default`

```
route to: default 
destination: default 
mask: default 
gateway: 192.168.1.1 
fib: 0 
flags: <UP,GATEWAY,DONE,STATIC> 
recvpipe 0 sendpipe 0 ssthresh 0 rtt,msec mtu 1500 weight 1 expire 0
```
`less /etc/resolv.conf`

```
search local domain 
name server 127.0.0.1 
options edns0
```
That's all without reboot, after boot no updates


----------



## tobik@ (Feb 19, 2015)

sevenk said:


> ```
> search local domain name server 127.0.0.1 options edns0
> ```


This looks wrong. Try replacing /etc/resolv.conf with

```
nameserver 8.8.8.8
```
maybe? 

Can you also post your complete /etc/rc.conf?


----------



## junovitch@ (Feb 19, 2015)

Does your local DNS resolve names correctly?  Try `drill www.FreeBSD.org`  Otherwise that looks right, you can step out from the closest hop to something outside your network. Can you ping your gateway?  `ping 192.168.1.1`.  Can you ping an outside site?  `ping 8.8.8.8`.  I see you are running local DNS.

If you can update your post with the exact copy/paste output that would be great.  It's very difficult to read without all the line breaks removed and I'm not even going to try to edit and format it correctly.


----------



## sevenk (Feb 19, 2015)

junovitch: I corrected with line breaks but it's an hand typo, I can't copy/paste text I checked drill www.freebsd.org it gives me output and finally I have my network connection up, I can do a portsnap fetch.
Thank you all (it could be the tobik's solution, I don't know).
dedicated to rage against machine & the black widow


----------



## wblock@ (Feb 19, 2015)

Note that 8.8.8.8 is Google DNS, and they will see everywhere you go.

The question is why your DHCP server is not handing out valid DNS server addresses.  That should be fixed.


----------

