# vm-bhyve cloud image (ubuntu server) cannot obtain IP address



## klu (Apr 10, 2020)

I create a vm using the ubuntu template and the ubuntu server cloud image. However the started VM doesn't seem to be able to obtain an IP address. For networking, I use the vm-bhyve's guidance of virtual switch and tap devices.

I know my network is working because I have also set up a Ubuntu server using the ISO and went through the installation process. That guest is able to obtain a LAN IP address as I expected.

Below are useful information:


```
>>> vm img https://cloud-images.ubuntu.com/bionic/20200407/bionic-server-cloudimg-amd64.img
>>> vm create -t ubuntu_server -i bionic-server-cloudimg-amd64.img -C -k ~/.ssh/id_rsa.pub ub3
>>> cat .templates/ubuntu.conf
loader="grub"
cpu=1
memory=512M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"

>>> vm switch list
NAME    TYPE      IFACE      ADDRESS  PRIVATE  MTU  VLAN  PORTS
public  standard  vm-public  -        no       -    -     em0

>>> vm switch info public
------------------------
Virtual Switch: public
------------------------
  type: standard
  ident: vm-public
  vlan: -
  physical-ports: em0
  bytes-in: 366873698 (349.878M)
  bytes-out: 748466373 (713.793M)

  virtual-port
    device: tap5
    vm: ub3

  virtual-port
    device: tap4
    vm: ub

  virtual-port
    device: tap3
    vm: ub2

  virtual-port
    device: tap2
    vm: centos

  virtual-port
    device: tap1
    vm: centos

  virtual-port
    device: tap0
    vm: centos

>>> vm info ub3
------------------------
Virtual Machine: ub3
------------------------
  state: running (44115)
  datastore: default
  loader: grub
  uuid: 8195de28-7ab0-11ea-b2b9-6c626dc3dded
  uefi: default
  cpu: 1
  memory: 512M
  memory-resident: 276422656 (263.617M)

  console-ports
    com1: /dev/nmdm-ub3.1B

  network-interface
    number: 0
    emulation: virtio-net
    virtual-switch: public
    fixed-mac-address: 58:9c:fc:05:b7:a3
    fixed-device: -
    active-device: tap5
    desc: vmnet-ub3-0-public
    mtu: 1500
    bridge: vm-public
    bytes-in: 0 (0.000B)
    bytes-out: 0 (0.000B)

  virtual-disk
    number: 0
    device-type: file
    emulation: virtio-blk
    options: -
    system-path: /zroot/vm/ub3/disk0.img
    bytes-size: 2361393152 (2.199G)
    bytes-used: 465765376 (444.188M)

>>> ifconfig tap5
tap5: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet-ub3-0-public
        options=80000<LINKSTATE>
        ether 00:bd:92:5f:f7:05
        hwaddr 00:bd:92:5f:f7:05
        inet6 fe80::2bd:92ff:fe5f:f705%tap5 prefixlen 64 tentative scopeid 0xb
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        groups: tap vm-port
        Opened by PID 44115

>>> ifconfig vm-public
vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 06:b3:5f:a8:b6:2c
        nd6 options=1<PERFORMNUD>
        groups: bridge vm-switch viid-4c918@
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: tap5 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 11 priority 128 path cost 2000000
        member: tap4 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 10 priority 128 path cost 2000000
        member: tap3 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 9 priority 128 path cost 2000000
        member: tap2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 8 priority 128 path cost 2000000
        member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 7 priority 128 path cost 2000000
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 6 priority 128 path cost 2000000
        member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 200000

>>> cat ub3/vm-bhyve.log
Apr 09 16:11:27: initialising
Apr 09 16:11:27:  [loader: grub]
Apr 09 16:11:27:  [cpu: 1]
Apr 09 16:11:27:  [memory: 512M]
Apr 09 16:11:27:  [hostbridge: standard]
Apr 09 16:11:27:  [com ports: com1]
Apr 09 16:11:27:  [uuid: 8195de28-7ab0-11ea-b2b9-6c626dc3dded]
Apr 09 16:11:27:  [utctime: yes]
Apr 09 16:11:27:  [debug mode: no]
Apr 09 16:11:27:  [primary disk: disk0.img]
Apr 09 16:11:27:  [primary disk dev: file]
Apr 09 16:11:27: initialising network device tap5
Apr 09 16:11:27: adding tap5 -> vm-public (public addm)
Apr 09 16:11:27: bring up tap5 -> vm-public (public addm)
Apr 09 16:11:27: booting
Apr 09 16:11:27: create file /zroot/vm/ub3/device.map
Apr 09 16:11:27:  -> (hd0) /zroot/vm/ub3/disk0.img
Apr 09 16:11:27: /usr/local/sbin/grub-bhyve -c /dev/nmdm-ub3.1A -m /zroot/vm/ub3/device.map -M 512M -r hd0,1 ub3
Apr 09 16:11:38:  [bhyve options: -c 1 -m 512M -AHP -U 8195de28-7ab0-11ea-b2b9-6c626dc3dded -u]
Apr 09 16:11:38:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/zroot/vm/ub3/disk0.img -s 5:0,virtio-net,tap5,mac=58:9c:fc:05:b7:a3]
Apr 09 16:11:38:  [bhyve console: -l com1,/dev/nmdm-ub3.1A]
Apr 09 16:11:38: starting bhyve (run 1)
```


----------



## siempie (Jun 1, 2020)

Im having the same situation here. Did you manage to solve it?
I might have some time this week to dive into this too. If I know anything more, I will post an update here.

UPDATE: Using the latest image from cloud-images.ubuntu.com resolved all of my network connectivity issues...


----------

