Date: Tue, 14 Feb 2017 11:57:08 +0000 From: "C. L. Martinez" <carlopmart@gmail.com> To: freebsd-virtualization@freebsd.org Subject: Re: tap interfaces disappears after bhyve guests shutdowns Message-ID: <20170214115708.pcw2poookycue3kk@scotland.uxdom.org> In-Reply-To: <8700dd14-cf15-20b9-38a6-e4181e4928ee@dann.ro> References: <20170213120938.hr3zu7flnm33v3zn@scotland.uxdom.org> <58A1A8A3.3030603@quip.cz> <8700dd14-cf15-20b9-38a6-e4181e4928ee@dann.ro>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 13, 2017 at 02:02:48PM +0100, Daniel Niculescu wrote: > > > 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. > > Thanks Daniel. I have tried what you say, but ping doesn't works between host and guest. If I put an ip to the bridge works ok, but not when I assign an ip to tap interface. Any idea why?? -- Greetings, C. L. Martinez
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170214115708.pcw2poookycue3kk>