From nobody Fri Jul 23 18:04:41 2021 X-Original-To: freebsd-jail@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6510C127B412 for ; Fri, 23 Jul 2021 18:04:53 +0000 (UTC) (envelope-from jacques+freebsd@foucry.net) Received: from mail.foucry.net (mail.foucry.net [IPv6:2a01:4f9:4a:1fd8::17]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GWcfY1HD4z3ns9 for ; Fri, 23 Jul 2021 18:04:52 +0000 (UTC) (envelope-from jacques+freebsd@foucry.net) Received: from mail.foucry.net (unknown [192.168.12.17]) by mail.foucry.net (Postfix) with ESMTP id B4A38EF31 for ; Fri, 23 Jul 2021 18:04:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at foucry.net Received: from mail.foucry.net ([192.168.12.17]) by mail.foucry.net (mail.foucry.net [192.168.12.17]) (amavisd-new, port 10024) with ESMTP id 0zr109JVGcn0 for ; Fri, 23 Jul 2021 18:04:44 +0000 (UTC) Received: by mail.foucry.net (Postfix, from userid 58) id 4ECDBEB64; Fri, 23 Jul 2021 18:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=foucry.net; s=dkim; t=1627063484; bh=GsKdT7++nUojUiOpCQgYqcXZPO8I2r9whkqAZq+ky9M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Ef7fBU3mmwfAt+L4LJ4Df/rp8quikBqgghz6uIJ6aE4ja99kyr/lfxFm8bXP2+YwV FLQvA3MnLCDZkn0bMeCRwpqe45CeWzXF/Q3XjzP01Y+xoDU2UbXY7wJq5a/g912bK3 uIrLvM90luTR5mjv6fkCYmtzAzoCdhu424GVPdF8= Received: from mithril.foucry.net (82-65-174-130.subs.proxad.net [82.65.174.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.foucry.net (Postfix) with ESMTPSA id A5C83F402; Fri, 23 Jul 2021 18:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=foucry.net; s=dkim; t=1627063483; bh=GsKdT7++nUojUiOpCQgYqcXZPO8I2r9whkqAZq+ky9M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Dh4EuekYKA2iE1sR53jrCQUwXjHGgnIGy/ZNY80dBmQqpznxoZHywmi+5IIpOd/5h E7tRtRrJyGp2nA6ZejbronrW8mm26cjjfvfzu6y2uQFhM6L30WrJERpuED1Dn8ueJp 4wyXtKTx72FXTUGEQI00AtDjrxaMCZiB3ne7wJIA= Received: from mithril.foucry.net (localhost [IPv6:::1]) by mithril.foucry.net (Postfix) with ESMTPS id E64F9D65; Fri, 23 Jul 2021 20:04:42 +0200 (CEST) Date: Fri, 23 Jul 2021 20:04:41 +0200 From: Jacques Foucry To: Michael Gmelin Cc: Jacques Foucry , freebsd-questions@freebsd.org, freebsd-jail@freebsd.org Subject: Re: iocage, vnet jail does not go outside Message-ID: Mail-Followup-To: Michael Gmelin , Jacques Foucry , freebsd-questions@freebsd.org, freebsd-jail@freebsd.org References: <20210723195142.77b668f1@bsd64.grem.de> List-Id: Discussion about FreeBSD jail(8) List-Archive: https://lists.freebsd.org/archives/freebsd-jail List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-jail@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210723195142.77b668f1@bsd64.grem.de> X-Operating-System: FreeBSD X-Rspamd-Queue-Id: 4GWcfY1HD4z3ns9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_RCPT(0.00)[freebsd]; TAGGED_FROM(0.00)[freebsd]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Le vendredi 23 juil. 2021 à 19:51:42 (+0200), Michael Gmelin à écrit: Hello Michael, > You need to enable some sort of NAT at your end, e.g. using pf. Traffic > is leaving your host on a private IP. I forgot to post the part of my pf.conf your right. I enabled a NAT (may be in a wroing way): ext_if = em0 int_if = "{lo0 lo1}" bridge_if = bridge0 icmp_types="{ echoreq, unreach }" # ok loopback set skip on lo0 set skip on lo1 #set skip on bridge0 # define jails jails_net = "{192.168.12.0/24 10.0.10.0/24 2a01:4f9:4a:1fd8::/64}" … # nat nat on $ext_if from $jails_net to any -> $ext_if … # ExampleJail rdr on $ext_if inet proto tcp from any to $ext_if port $examplejail_ports -> $examplejail_v4 rdr on $ext_if inet6 proto tcp from any to $ext_if port $examplejail_ports -> $examplejail_v6 … pass in log quick on $ext_if proto tcp from any to $examplejail_v4 port $examplejail_ports flags S/SA keep state pass in log quick on $ext_if proto tcp from any to $examplejail_v6 port $examplejail_ports … # Allow icmp pass in inet proto icmp all icmp-type $icmp_types #IPv6 - pass in/out all IPv6 ICMP traffic pass in quick proto icmp6 Allow Is there something wrong of missing? I was guessing that the NAT is correct because I can connect from outside (IPv4 and IPv6) to this jail. Thanks again for your time. -- Jacques Foucry