IPv6 in jails

Victor Sudakov vas at sibptus.ru
Wed Mar 18 15:35:47 UTC 2020


Bjoern A. Zeeb wrote:
> > 
> > Is IPv6 in jails supposed to work? Does not work for me, what am I doing
> > wrong?
> > 
> > Here is a test jail:
> > 
> > test4 {
> >         path = /d02/jails/test4 ;
> >         mount.devfs;
> >         ip4 = new;
> >         ip6 = new;
> >         ip4.addr = 192.168.4.204/24;
> >         ip6.addr = 2001:470:ecba:3::4/64;
> 
> I usually do something like this:
> 
>         ip6.addr += "lo0|2001:db8:1234:5678::ef/128";
> 
> to add the single address out of a /64 to the loopback interface on the host
> and then pass it through to the jail.  The /64 however is actually routed to
> my host so might not work if you have the /64 on the physical interface.

But the same syntax for IPv4 (192.168.4.204/24) works fine! The address
192.168.4.204 is successfully assigned to the jail.
> 
> Given it is a jail without vnet you cannot assign a /64 to the jail, you
> want to just specify the address usually (plainly or as /128).

Why is that? I can assign an IPv4 /24 to the jail but cannot assign an IPv6 /64 ?
The prefix length should be irrelevant, as it is irrelevant in the IPv4
case.

> 
> >         host.hostname = test4.vas.sibptus.ru ;
> >         interface = re1 ;
> >         allow.raw_sockets = true ;
> >         exec.start = "/bin/sh /etc/rc";
> >         exec.stop = "/bin/sh /etc/rc.shutdown";
> > }
> > 
> > However when I look from inside the jail, I see the daemons listening
> > only on IPv4:
> > 
> > root at test4:/ # sockstat -l
> > USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN
> > ADDRESS
> > 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     *:*
> > 
> > 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).
> 
> One thing to check first is ifconfig inside the jail does see the address?

Yes, it does:

root at test4:/ # ifconfig re1
re1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu
1500
        description: Inside
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether c4:12:f5:33:c9:7c
        inet 192.168.4.204/24 broadcast 192.168.4.255
        inet6 2001:470:ecba:3::4/64
        media: Ethernet autoselect (none)
        status: no carrier
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
root at test4:/ # 


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49 at fidonet http://vas.tomsk.ru/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20200318/0401b457/attachment.sig>


More information about the freebsd-questions mailing list