# netgraph ng_bridge: can't ge an IP using DHCP when creating a vlan



## benoitc (May 7, 2022)

I am using a bridge `bridge0` that will contain a native nic interface ixl3  and add a tap interface in it:

```
ifconfig bridge0 create
ifconfig bridge0 addm ixl3 addm tap0
ifconfig bridge0
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 58:9c:fc:10:e7:20
    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: ixl3 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 6 priority 128 path cost 2000
    member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 12 priority 128 path cost 2000000
    member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 11 priority 128 path cost 2000000
    groups: bridge vm-switch viid-73f50@
    nd6 options=1<PERFORMNUD>
```

When I create a bhyve vm `test` with a network interface on this bridge, it is able to access to the vlan101:

```
root@test:~ # ifconfig vtnet1 up
root@test:~ # dhclient vtnet1.101
DHCPDISCOVER on vtnet1.101 to 255.255.255.255 port 67 interval 4
DHCPOFFER from 10.101.1.1
DHCPREQUEST on vtnet1.101 to 255.255.255.255 port 67
DHCPACK from 10.101.1.1
bound to 10.101.1.14 -- renewal in 300 seconds.
```

I can access  to this machine using SSH and ping it with success. But when I try to do the same using netgraph (initial bridg0 has been destroyed), my VM is not able to retrieve the IP using DHCP. It is only possible to do it on the untagged vlan. Is there something wrong in the configuration below? Why the behaviour is not the same using a bridge created with if_bridge?


```
ngctl -f- <<EOF
mkpeer ixl3: bridge lower link0
name ixl3:lower bridge0
connect ixl3: bridge0: upper link1
msg ixl3: setpromisc 1
msg ixl3: setautosrc 0
EOF
```


----------

