From owner-freebsd-questions@freebsd.org Thu Dec 24 16:15:35 2020 Return-Path: Delivered-To: freebsd-questions@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 6DDDD4C9B6A for ; Thu, 24 Dec 2020 16:15:35 +0000 (UTC) (envelope-from ihor@antonovs.family) Received: from mail.antonovs.family (mail.antonovs.family [100.25.240.195]) (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 (2048 bits) client-digest SHA256) (Client CN "mail.antonovs.family", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1wCp2jwdz4kD9 for ; Thu, 24 Dec 2020 16:15:34 +0000 (UTC) (envelope-from ihor@antonovs.family) Received: by mail.antonovs.family (OpenSMTPD) with ESMTPSA id c9371c22 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 24 Dec 2020 16:15:30 +0000 (UTC) Subject: Re: Network namespaces in FreeBSD To: freebsd-questions@freebsd.org References: <20201223182227.da6c11d3604eb07bb4f18ce5@sohara.org> <2581038e-fa0f-231d-ae33-1b42d50c8600@antonovs.family> From: Ihor Antonov Message-ID: <25fbf315-7aec-853c-cf69-a805805bd06e@antonovs.family> Date: Thu, 24 Dec 2020 08:14:22 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D1wCp2jwdz4kD9 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=antonovs.family; spf=pass (mx1.freebsd.org: domain of ihor@antonovs.family designates 100.25.240.195 as permitted sender) smtp.mailfrom=ihor@antonovs.family X-Spamd-Result: default: False [-3.80 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[100.25.240.195:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[100.25.240.195:from:127.0.2.255]; ARC_NA(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[antonovs.family,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:14618, ipnet:100.24.0.0/13, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2020 16:15:35 -0000 On 12/24/20 1:07 AM, Arthur Chance wrote: > On 23/12/2020 18:40, Ihor Antonov wrote: >> On 12/23/20 10:32 AM, Kristof Provost wrote: >>> On 23 Dec 2020, at 19:22, Steve O'Hara-Smith wrote: >>>> On Wed, 23 Dec 2020 16:48:11 +0000 >>>> Ameya Deshpande via freebsd-questions >>>> wrote: >>>> >>>>> Hi, >>>>> >>>>> I am new to FreeBSD. I was wondering if there is concept like Network >>>>> Namespaces in FreeBSD, like it is in Linux? >>>> >>>>     There is something similar see man setfib for details. >>>> >>> I’ve only briefly played with linux network namespaces, but aren’t >>> vnet jails much closer to that? >> >> I have more experience with Linux than with FreeBSD, so I don't know for >> sure what setfib is about. >> >> VNET jails is the closest thing that comes to mind when comparing to >> Linux network namespaces. Unlike Linux, in a jail you will get all other >> namespaces separated too (e.g. mount, pid etc.) >> >> Unfortunately I don't know if it is possible to get exactly same >> behavior as in Linux - share all other namespaces except for network >> stack. I imagine you can get something like this with Capsicum, but it >> would require making changes to the app. > > Wouldn't a VNET jail rooted at / effectively be that? > Last time I played with jails setting jail's root to '/' was not allowed for some reason. I don't remember exact error message though. I remember that I ended up null-mounting every directory in / (like bin, sbin, etc,) to jail's root directory, and that was quite painful to do manually. Ihor