From owner-freebsd-virtualization@freebsd.org Tue Feb 14 11:57:05 2017 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4CD7ECDFF43 for ; Tue, 14 Feb 2017 11:57:05 +0000 (UTC) (envelope-from carlopmart@gmail.com) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7EF71CFD for ; Tue, 14 Feb 2017 11:57:04 +0000 (UTC) (envelope-from carlopmart@gmail.com) Received: by mail-wm0-x229.google.com with SMTP id v186so15862926wmd.0 for ; Tue, 14 Feb 2017 03:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TWrrzzej7wMRWx+A2mDfFh9QRcF2SGKFbu8sklZ9Lro=; b=kkHdb3FWsbcxn+G4d7sNsZ7XtWakyEVhqsDMg1tPFl+39Y1nlJ8Ye0900QEsRKkoxW a81O08+9DW8zbSA//ipqNNlHlT5eQpF4q1qkQ7ROQcE2jHCAqDOAxI8dKIATezN2au4g bwQPB5EMtQ/jWdcCnv2HBuuo4pbtgm82mr19Im6QtIBRNYjNZyKVtglMHLpOekXEkJvM iMh7I8Ke8KJROThec8OF98L/FAJdGiGoKpOC/i5IYktD3RNWjqcJsWjbw+3MECp/FAEH su97a+2iyd6uTl6HFGCDPDkV+k4uIXw3jxN74oLR1EQRPWVLkl+MYZRjc+1biBC2vgqS NmOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TWrrzzej7wMRWx+A2mDfFh9QRcF2SGKFbu8sklZ9Lro=; b=McEBix34ZoSI++oTlKqe5Vz7yu00RGQPPgriuJOr8R050/f30q3ARB3WwXpxf5ykll RQ0N8CLGd7Kb7+zvNLrejqZTKAGk+a+tVqgH1pSm0G2B14D/oozJeZc09HJI8fUNyUHL Z9LT+bk1dTEp4gG+CjB63xHZri1khMJTL+xo0JRsO0CKT1VLbGVgb+ax6G+/96kF6Ivh i0Heym9h/QN5R27/orK+xOpVQfFMpjS70mfKEooKHv+rDoTVVqC0uPfyTXzK4tQMZjUf kSh4h/M9UaoyAxvAqQ0p3lvv/rP0Q6+L+ZIFHskw0zjP435vrmfV2taY4i8J/CtYUEtw uVwQ== X-Gm-Message-State: AMke39ksLOgBhfBZnsdyzDavha9WY9QdSkWmZhpVirPz568pqqh0ts0AyE+K5MuSGtPAlw== X-Received: by 10.28.92.193 with SMTP id q184mr2999976wmb.139.1487073423134; Tue, 14 Feb 2017 03:57:03 -0800 (PST) Received: from localhost (231.red-79-150-68.dynamicip.rima-tde.net. [79.150.68.231]) by smtp.gmail.com with ESMTPSA id o2sm491777wra.42.2017.02.14.03.57.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 03:57:02 -0800 (PST) Date: Tue, 14 Feb 2017 11:57:08 +0000 From: "C. L. Martinez" To: freebsd-virtualization@freebsd.org Subject: Re: tap interfaces disappears after bhyve guests shutdowns Message-ID: <20170214115708.pcw2poookycue3kk@scotland.uxdom.org> References: <20170213120938.hr3zu7flnm33v3zn@scotland.uxdom.org> <58A1A8A3.3030603@quip.cz> <8700dd14-cf15-20b9-38a6-e4181e4928ee@dann.ro> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <8700dd14-cf15-20b9-38a6-e4181e4928ee@dann.ro> User-Agent: NeoMutt/20170113 (1.7.2) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 11:57:05 -0000 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 metric 0 mtu > 1500 > description: vm-local > ether 02:ed:0d:ca:74:00 > nd6 options=1 > 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 > ifmaxaddr 0 port 5 priority 128 path cost 2000000 > member: tap0 flags=143 > ifmaxaddr 0 port 4 priority 128 path cost 2000000 > member: em0 flags=143 > 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