# bhyve vm gets random hostname



## paw (Jul 16, 2017)

I have a VM named fortress.crystalforest this is within DNS and has PTR records too.
nslookup from any of my other hosts come back with the valid answer.

hostname="fortress.crystalforest" is also set within rc.conf.

The funky bit,
Host: FreeBSD11
This is FBSD11 running as an bhyve vm. upon reboot it seems to be randomly choosing a random DNS record, not its own. This VM does host jails and I know I can run jails on the host, but I don't want to. 


```
sky@host:~ % nslookup 10.10.0.3
3.0.10.10.in-addr.arpa  name = fortress.fortress.
3.0.10.10.in-addr.arpa  name = fortress.crystalforest.

sky@host:~ % ssh 10.10.0.3
Password for sky@web_php.crystalforest:
```


```
sky@web_php:~ % ifconfig
vtnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether 58:9c:fc:0b:0e:74
        inet 10.10.0.3 netmask 0xffff0000 broadcast 10.10.255.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet 10Gbase-T <full-duplex>
        status: active

sky@web_php:~ % nslookup 10.10.0.3
3.0.10.10.in-addr.arpa  name = fortress.crystalforest.
3.0.10.10.in-addr.arpa  name = fortress.fortress.
```

Whats even more strange, I dont host a jail named *web_php *and nor does a DNS record exist.
Its sounding like an DNS issue, but i'm not sure it is. 

rc.conf

```
#Security
clear_tmp_enable="YES"
syslogd_flags="-ss"
sendmail_enable="NONE"

#Set hostname
hostname="fortress.crystalforest"
keymap="uk.iso.kbd"

#Network and DNS
ifconfig_vtnet0="inet 10.10.0.3 netmask 255.255.0.0"
defaultrouter="10.10.0.x"
gateway_enable="YES"

#Secure Stuff
sshd_enable="YES"
dumpdev="NO"

#ZFS magic goes here
zfs_enable="YES"

#Jail magic
jail_enable="YES"
jail_list="paw web_php7"
```

There's a bug somewhere.


----------



## gfx (Jul 17, 2017)

I'm no expert of bhyve, but is there a docker/container like "web_php7" somewhere in the setup ?


----------



## SirDice (Jul 17, 2017)

You might want to double check reverse DNS lookups. It should really only return one PTR record, not multiple ones. And it looks like your VM is using either a different DNS, resulting in different results. Or you're mixing up different /etc/hosts files. Remember that a hosts file will overrule everything, the DNS itself may be in order but your hosts file may not.


----------



## paw (Jul 18, 2017)

Thanks for the assistance. I realize it was a silly mistake of mine.
I was trying to set the jail's host-name but had added the line to the pre-startup rather then to the jail startup.

I also now have a another funky problem where one jail can ping all other jails including access the outside world apart from the last started jail. The prision cannot ping the jail and nor can any of the other hosts. Strange thing was it was working absolutely fine until this morning. I am using vnet too

edit: now working magically

And now pkg is broken.


```
root@fortress:/var/db # pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   6.1MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 26598 packages processed.
All repositories are up to date.
root@fortress:/var/db # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (3 candidates): 100%
Processing candidates (3 candidates): 100%
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        mesa-libs: 17.1.2 -> 17.1.4
        libxshmfence: 1.2_1 -> 1.2_2

Number of packages to be upgraded: 2

372 KiB to be downloaded.

Proceed with this action? [y/N]: y
pkg: http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/All/mesa-libs-17.1.4.txz: Not Found
```


```
pkg update -f
```

also doesn't fix the issue. I've deleted all cache and db's too. DNS is fine. as I've been using this without any issues :/


----------



## SirDice (Jul 18, 2017)

Odd. The package servers seem to be missing all packages starting with 'm' and onward. It has everything up to 'l' but nothing after it. The latest repository is complete, just the quarterly isn't.


----------

