When is a switch not a switch?

John-Mark Gurney jmg at funkthat.com
Tue Oct 20 06:56:42 UTC 2020


D'Arcy Cain wrote this message on Mon, Oct 19, 2020 at 22:02 -0400:
> I am using bhyve with vm-bhyve,  I am trying to set up a virtual network 
> with multiple hosts.  The idea is that a VM would be on the same virtual 
> network no matter which actual host it is on.
> 
> Say I have a public network a.b.c.0/24.  I thought I could create a switch 
> on a host.  The host would be a.b.c.1 and the VMs would be a.b.c.100 and 
> a.b.c.101.  The idea would be that the VMs would appear on the real network. 
>   Then the 101 VM could migrate to a.b.c.2 and still be accessible.  I 
> envisioned some sort of proxy arp would happen so that every VM would simply 
> announce itself wherever it was.
> 
> This did seem to work in that I could ping from the VM:
> 
> # ping 8.8.8.8
> PING 8.8.8.8 (8.8.8.8): 56 data bytes
> 64 bytes from 8.8.8.8: icmp_seq=0 ttl=114 time=1.734 ms
> 
> Even IPV6:
> 
> # ping6 2605:2600:1001::4b
> PING6(56=40+8+8 bytes) 2605:2600:1001::4 --> 2605:2600:1001::4b
> 16 bytes from 2605:2600:1001::4b, icmp_seq=0 hlim=64 time=0.960 ms
> 16 bytes from 2605:2600:1001::4b, icmp_seq=1 hlim=64 time=0.415 ms
> 
> However TCP doesn't work.  In fact, I could only ping by IP because the 
> system couldn't connect to the DNS server, to get an address even though it 
> could ping it.
> 
> I guess my first question is does this seem doable?  If so, what am I 
> missing?  Is it possible that a bhyve switch is more like a router?

By switch, do you mean use bridge?  How specifically is the network
configured?

What you are describing sounds like what I do w/ bridge, but my use was
slightly more complicated.

Say your host has em0 as the main network, you would create a bridge0
interface, either via cloned_interfaces or via "ifconfig bridge0 create".
Then you would put the em0 interface as a member of the bridge
interface.  You would also add the tap interfaces of the various bhyve
vms as well (don't forget to make sure the tap interface is up on the
host, net.link.tap.up_on_open helps w/ this)...

I have heard (and that is the way I do that), that you have to put the
host IPs on the bridge0 interface, and not the em0 interface.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-virtualization/attachments/20201019/8eccceec/attachment.sig>


More information about the freebsd-virtualization mailing list