Multiple virtual network interfaces using netgraph

Load the ng_ether module, to make the real interfaces visible to netgraph

kldload ng_ether

or add it to /boot/loader.conf to load it on boot

echo 'ng_ether_load="YES"' >> /boot/loader.conf

Create the bridge and give it a name:

ngctl mkpeer em0: bridge lower link1
ngctl name em0:lower br0

Connect the physical interface to the bridge:

ngctl connect em0: br0: upper link2

Disable the overwriting of source route on the physical interface

ngctl msg em0: setautosrc 0

Enable promiscous mode on the physical interface

ngctl msg em0: setpromisc 1

Create the virtual interfaces and connect them to the bridge

ngctl mkpeer br0: eiface link3 ether
ngctl mkpeer br0: eiface link4 ether

Set an unique MAC-address to each of the virtual interfaces:

ifconfig ngeth0 link 00:5c:16:10:dd:79
ifconfig ngeth1 link 00:5c:16:10:dd:80