From owner-freebsd-net@freebsd.org Wed Mar 18 15:50:50 2020 Return-Path: Delivered-To: freebsd-net@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 F200D2642E0; Wed, 18 Mar 2020 15:50:50 +0000 (UTC) (envelope-from vas@sibptus.ru) Received: from admin.sibptus.ru (admin.sibptus.ru [IPv6:2001:19f0:5001:21dc::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48jDyw489dz4SNp; Wed, 18 Mar 2020 15:50:48 +0000 (UTC) (envelope-from vas@sibptus.ru) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=VK/aCTDanYbNnlNriB/N6OeeLzdIBIgg1Ec7uBmvt1U=; b=Usad63Pdtaex73tIpDwX5cLSwl ZhmuXQ1DTf1E25crGPAZROEoF5ImRDGZZpenf20Vcp8mMj/W2A0BFJIjV6PGKC0iATuJPdl0bPGwD 5UjzArIbAAARBSv7aue2yS4CMtnWe8Siiw7fkfk/PkICQ4LliaJdyaKFavZQJVOg0EbQ=; Received: from vas by admin.sibptus.ru with local (Exim 4.93.0.4 (FreeBSD)) (envelope-from ) id 1jEaxy-000HGB-Rc; Wed, 18 Mar 2020 22:50:46 +0700 Date: Wed, 18 Mar 2020 22:50:46 +0700 From: Victor Sudakov To: Miroslav Lachman <000.fbsd@quip.cz> Cc: freebsd-questions@freebsd.org, freebsd-net@freebsd.org Subject: Re: IPv6 in jails Message-ID: <20200318155046.GD65497@admin.sibptus.ru> References: <20200318151556.GA64871@admin.sibptus.ru> <2dd539ed-0ee3-079b-27b2-28126056c69a@quip.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hoZxPH4CaxYzWscb" Content-Disposition: inline In-Reply-To: <2dd539ed-0ee3-079b-27b2-28126056c69a@quip.cz> X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 X-Rspamd-Queue-Id: 48jDyw489dz4SNp X-Spamd-Bar: -------- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=sibptus.ru header.s=20181118 header.b=Usad63Pd; dmarc=pass (policy=none) header.from=sibptus.ru; spf=pass (mx1.freebsd.org: domain of vas@sibptus.ru designates 2001:19f0:5001:21dc::10 as permitted sender) smtp.mailfrom=vas@sibptus.ru X-Spamd-Result: default: False [-8.43 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.975,0]; R_DKIM_ALLOW(-0.20)[sibptus.ru:s=20181118]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+mx:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; IP_SCORE(-3.36)[ip: (-9.89), ipnet: 2001:19f0:5000::/38(-4.94), asn: 20473(-1.91), country: US(-0.05)]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[sibptus.ru:+]; DMARC_POLICY_ALLOW(-0.50)[sibptus.ru,none]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5000::/38, country:US]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2020 15:50:51 -0000 --hoZxPH4CaxYzWscb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Miroslav Lachman wrote: > Victor Sudakov wrote on 2020/03/18 16:15: > >=20 > > Is IPv6 in jails supposed to work? Does not work for me, what am I doing > > wrong? > >=20 > > Here is a test jail: > >=20 > > test4 { > > path =3D /d02/jails/test4 ; > > mount.devfs; > > ip4 =3D new; > > ip6 =3D new; > > ip4.addr =3D 192.168.4.204/24; > > ip6.addr =3D 2001:470:ecba:3::4/64; > > host.hostname =3D test4.vas.sibptus.ru ; > > interface =3D re1 ; > > allow.raw_sockets =3D true ; > > exec.start =3D "/bin/sh /etc/rc"; > > exec.stop =3D "/bin/sh /etc/rc.shutdown"; > > } > >=20 > > However when I look from inside the jail, I see the daemons listening > > only on IPv4: > >=20 > > root@test4:/ # sockstat -l > > USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRE= SS > > root sendmail 17178 3 tcp4 192.168.4.204:25 *:* > > root sshd 17175 3 tcp4 192.168.4.204:22 *:* > > root syslogd 17110 5 udp4 192.168.4.204:514 *:* > >=20 > > If I "ssh 2001:470:ecba:3::4" from outside, I get into the host instead > > of the jail (because 2001:470:ecba:3::4 *is* assigned to re1, but not > > available inside the jail). >=20 > If sshd in the host is configured to listen on all available interfaces a= nd > addresses (the default) then it will catch your jails IP too. Why is it not catching the 192.168.4.204 address then?=20 > You must configure sshd in the host to listen only on hosts IP and then y= ou > will connect to the jails sshd. OK, I've stopped the sshd on the host entirely, and restarted the jails. Why am I still not seeing the jailed sshd listening on tcp6? root@test4:/ # sockstat -l USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root sendmail 17995 3 tcp4 192.168.4.204:25 *:* root sshd 17992 3 tcp4 192.168.4.204:22 *:* root syslogd 17927 5 udp4 192.168.4.204:514 *:* root syslogd 17927 6 dgram /var/run/log root syslogd 17927 7 dgram /var/run/logpriv root@test4:/ #=20 Your theory is probably incorrect. >=20 > What is you sshd_config in the host and in the jail?=20 The sshd on the host has been stopped now. The sshd_config in the jail is the FreeBSD default one. --=20 Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/ --hoZxPH4CaxYzWscb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJeckNWAAoJEA2k8lmbXsY0GlcH/1w2bskTWY3duh53t9LvX93I +im9ZQI0Tj69tTFARZHID/moLOm5SaVfveMrWhOx63cljxOPmQ2ehwoteGLOPqBy lL30FEo0oLfFDP43Il287QlZMoqS/VrBwBLJrIYNqymjkY3Jc0OXtTqWRvSr5RT+ AUveXx5OOETjFHyeAKxsl4ALk+cgWPI2rdduTbaiKjmuVsyuskOIitnc/3SLhy3H nYt8iAYAdnt1qSGmjdjuH93N8fi1YCFuWve1FEuevT2VF13KvSYYFpJEAm1b9ZGe DQV7RJIH3TFCCa5/FuPZMs1yDhbEY1LqoJHNydGMUUa/sEu+/OiJ1+Z1ZDcW02g= =E7MI -----END PGP SIGNATURE----- --hoZxPH4CaxYzWscb--