bhyve Can't add vm-public to em0

When trying to add vm-public to em0 I get the following error:

doas vm switch add public em0
/usr/local/sbin/vm: ERROR: failed to add member em0 to the virtual switch public


My guess is that the problem is linked with the fact that I am also using sysutils/bastille to manage jails. This has already created a bridge where em0 is a member:

Bash:
 em0bridge: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 58:9c:fc:10:c1:1b
    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: e0a_bastille0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 7 priority 128 path cost 2000
    member: e0a_bastille2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 6 priority 128 path cost 2000
    member: e0a_bastille1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 5 priority 128 path cost 2000
    member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
            ifmaxaddr 0 port 1 priority 128 path cost 20000
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>

I'm not sure how to resolve it. Should I add vm-public to em0bridge? My vm switch info shows:
Bash:
local: _netgraph,: bad variable name
------------------------
Virtual Switch: public
------------------------
  type: standard
  ident: vm-public
  vlan: -
  physical-ports: -
  bytes-in: 0 (0.000B)
  bytes-out: 0 (0.000B)
 
Came across this 2-year-old thread while searching for solutions to my situation.
I'm seeing the same error as OP when trying to add re1 to public. Now the member section is missing in the vm-public. I suspect it is because there is a bhyve vm already running. Maybe I need a smart way for bhyve and vm-byhave to co-exist?
vm-public: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=0
ether 1e:85:6d:63:18:22
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
groups: bridge vm-switch viid-4c918@
nd6 options=9<PERFORMNUD,IFDISABLED>
 
one network physical interface can only join one bridge . so you can use vm-bhyve create a public bridge interface and add em0 to the member ..then you use bastille create a jail with public bridge ...wish to help you.
 
You can add a manual bridge also.

This is very helpful. Althoug I'm thinking to migrate bhyve VM to vm-bhyve, being able to proceed with installing Win11 via vm-bhyve quickly is a great experience.
 
Back
Top