From owner-freebsd-jail@freebsd.org Wed Oct 14 13:41:03 2020 Return-Path: Delivered-To: freebsd-jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF072439C14 for ; Wed, 14 Oct 2020 13:41:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBD8H5DZyz41GG; Wed, 14 Oct 2020 13:41:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 839A021CA0; Wed, 14 Oct 2020 13:41:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 3150E39B82; Wed, 14 Oct 2020 15:41:02 +0200 (CEST) From: "Kristof Provost" To: "Arsenij Solovjev" Cc: freebsd-jail@freebsd.org Subject: Re: vnet Jail on a non-dedicated network interface Date: Wed, 14 Oct 2020 15:41:01 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: References: <3F8DAE0C-0EA1-40C5-9825-262F547E1954@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2020 13:41:03 -0000 On 14 Oct 2020, at 15:36, Arsenij Solovjev wrote: > On Wed, 14 Oct 2020 at 14:42, Kristof Provost wrote: > >> On 14 Oct 2020, at 14:18, Arsenij Solovjev wrote: >>> Hi all! >>> Does anybody know if it's possible to run a vnet jail on a >>> non-dedicated >>> interface? I have the Lucas book on jails. In it he says that for = >>> vnet >>> you >>> need to pick a dedicated interface, remove all networking IP >>> configuration >>> and only bring it up. Afterwards you set up jib and whatnot. >>> >>> All works well if I use a dedicated secondary interface (let's call = >>> it >>> em1). If I use em0 however I cannot ping the jail. >>> >>> I would like to have a host with that has a single network interface >>> which >>> is used for both normal networking stuff as well as having the vnet >>> jail >>> run on it. >>> >>> Maybe I could create some sort of virtual interface and run vnet on >>> it? >>> >>> Any ideas here? Thanks in advance! >>> >> Look at epair interfaces. >> >> You can put em0 and epair0a in a bridge together and add epair0b to = >> the >> vnet jail. >> That gets the vnet jail connected to your LAN. >> >> Or you can skip the bridge, assign an IP to epair0a and route between >> the jail and your LAN. >> >> Regards, >> Kristof >> > > Hi Kristof, > > Thanks for your reply! > > considering your first idea. I did this, the jail gets created = > seemingly > fine. However I cannot ping the ip of epair0b (this works when using a > dedicated interface). > Also I cannot reach my gateway from within the jail. This too works = > when > using a dedicated interface. > Btw I have "sysctl security.jail.allow_raw_sockets=3D1". > Here is my host ifconfig when putting em0 and epair0a in a bridge: > > em0: flags=3D8943 metri= c = > 0 >> mtu 1500 >> > options=3D812099 > > ether 9a:4c:eb:b5:95:bf > > inet 172.18.20.145 netmask 0xffffff00 broadcast 172.18.20.255 > > media: Ethernet autoselect (1000baseT ) > > status: active > > nd6 options=3D29 > > jailether: flags=3D8843 metric = 0 = > mtu >> 1500 >> > options=3D81209b > > ether 56:39:b7:c5:2e:ec > > media: Ethernet autoselect (1000baseT ) > > status: active > > nd6 options=3D29 > > lo0: flags=3D8049 metric 0 mtu 16384 >> > options=3D680003 > > inet6 ::1 prefixlen 128 > > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 > > inet 127.0.0.1 netmask 0xff000000 > > inet 10.43.84.1 netmask 0xffffff00 > > groups: lo > > nd6 options=3D21 > > em0bridge: flags=3D8843 metric = 0 = > mtu >> 1500 >> > ether 02:13:0b:48:53:00 > > 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: e0a_sambaad flags=3D143 > > ifmaxaddr 0 port 5 priority 128 path cost 2000 > > member: em0 flags=3D143 > > ifmaxaddr 0 port 1 priority 128 path cost 20000 > > groups: bridge > > nd6 options=3D1 > > e0a_sambaad: = > flags=3D8943 >> metric 0 mtu 1500 >> > options=3D8 > > ether 02:a4:c4:b5:95:bf > > hwaddr 02:78:fd:34:e8:0a > > groups: epair > > media: Ethernet 10Gbase-T (10Gbase-T ) > > status: active > > nd6 options=3D29 > > > > Here's the ifconfig from my within my jail: > > lo0: flags=3D8049 metric 0 mtu 16384 >> > options=3D680003 > > inet6 ::1 prefixlen 128 > > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 > > inet 127.0.0.1 netmask 0xff000000 > > groups: lo > > nd6 options=3D21 > > e0b_sambaad: flags=3D8843 metri= c = > 0 >> mtu 1500 >> > options=3D8 > > ether 0e:a4:c4:b5:95:bf > hwaddr 02:78:fd:34:e8:0b > This is odd. Are you assigning a new MAC address to the epair interfaces = somewhere? Both ends of the epair seem to have a new MAC address, and = the same one at that. Regards, Kristof