Bug 257969

Summary: Bridging / TAP interface does not work with bhyve if I want to emulate any linux distro with bhyve
Product: Ports & Packages Reporter: mario felicioni <marietto2008>
Component: Individual Port(s)Assignee: freebsd-virtualization (Nobody) <virtualization>
Status: Closed FIXED    
Severity: Affects Many People    
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
it shows the route added by vm-bhyve that it's missing when I emulate linux with bhyve none

Description mario felicioni 2021-08-20 12:06:09 UTC
Created attachment 227341 [details]
it shows the route added by vm-bhyve that it's missing when I emulate linux with bhyve

'm trying to understand why there aren't any linux vm that can connect to internet if emulated with bhyve (it's level 2 hypervisor which run on freebsd 13). Instead,if I use vm-bhyve (a wrapper for bhyve) they can.

I've compared the routes added by vm-bhyve and by bhyve,to try to understand why the first one allows any linux distro to connect to internet and the second one,doesn't,and I found that the route below is added by vm-bhyve but not by bhyve. I tried to add it manually inside ubuntu using this command :

route add default gw 192.168.1.1 enp0s5

but,instead of adding 192.168.1.1,it adds _gateway. I think that it is the reason why it does not work. Also the metric should be changed. The right one is 100,but the command that I have issued doesnt add 100,but its still 0.

Does vm-bhyve add that route at the host level ? Since I'm not a coder,I'm not able to understand how works the vm-bhyve source code,I would like to know how can I add that route.
Comment 1 mario felicioni 2021-08-20 18:18:24 UTC
I managed to reproduce the problem. When I start the VM using an .sh script I used "&" at the end of the bhyve command and when I destroy the VM using bhyvectl --vm=vm0 --destroy the bhyve process continue to run which can be observed using ps aux | grep bhyve and also in top. So,never use & at the end of the bhyve command.