On 02/13/17 13:37, Miroslav Lachman wrote:
C. L. Martinez wrote on 2017/02/13 13:09:
Why when a bhyve guest shutdowns or reboot tap interfaces goes down
and lost IP assigned address?. I need to use same tap interface for
several guests and assign an IP to this tap interface to act as a
router for these guests.
IP address is set on the guest, so as long as you have the network set
up the IP address will be persistent.
What you need is a bridge to which you add all your tap interfaces.
Set the kernel state as advised by Martinez and make sure you have it
also in /etc/sysctl.conf:
#sysctl net.link.tap.up_on_open=1
#echo "net.link.tap.up_on_open=1" >> /etc/sysctl.conf
Create a bridge interface:
#ifconfig bridge0 create
Add your host interface if you want external connectivity for your guests:
#ifconfig bridge0 addm em0
Create the tap interfaces for the guests:
#ifconfig tap0 create
#ifconfig tap1 create
Add them to the bridge:
#ifconfig bridge0 addm tap0 addm tap1
After booting the guests, they will be both bridged with your physical
interface em0 (replace em0 with your actual interface):
#ifconfig bridge0
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu
1500
description: vm-local
ether 02:ed:0d:ca:74:00
nd6 options=1<PERFORMNUD>
groups: bridge
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: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 5 priority 128 path cost 2000000
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 4 priority 128 path cost 2000000
member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 1 priority 128 path cost 20000
Perhaps you could use an utility to manage the VMs, like vm-bhyve,
iohyve, etc.
How can I do a "persistent tap" interface??
I think you need this sysctl:
# sysctl -d net.link.tap.up_on_open
net.link.tap.up_on_open: Bring interface up when /dev/tap is opened
_______________________________________________
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to
"freebsd-virtualization-unsubscr...@freebsd.org"
_______________________________________________
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to
"freebsd-virtualization-unsubscr...@freebsd.org"