在Ubuntu 17.10的ipv6隧道?

我曾经能够在/etc/network/interfaces没有问题进行下面的配置,但现在它不再被接收了。 我现在如何配置ipv6隧道? 我看到新的netplan软件配置接口,但我似乎找不到与下面相同的命令

 auto he-ipv6 iface he-ipv6 inet6 v4tunnel address 2001:550:120e:6b7::2 netmask 64 endpoint 184.105.253.10 local my.public.ip.addr ttl 255 gateway 2001:550:120e:6b7::1 

如何配置Ubuntu以在下次重新启动时永久保留此配置?

我想到了。

我创建了以下文件:

/etc/systemd/network/he-ipv6.network

 [Match] [Network] Tunnel=he-ipv6 

/etc/systemd/network/he-ipv6-tunnel.netdev

 [Match] [NetDev] Name=he-ipv6 Kind=sit [Tunnel] Independent=true Local=192.168.0.x #Private IP if behind NAT or Public IP without NAT Remote=184.105.250.46 #Tunnel broker's IPv4 address TTL=255 

/etc/netplan/01-netcfg.yaml

 # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: he-ipv6: dhcp4: no dhcp6: no addresses: ['2001:470:xxx:xxx::2/64'] gateway6: 2001:470:xxx:xxx::1 enp0s3: ... 

其中2001:470:xxx:xxx::2/64是您在tunnelbroker.net上的客户端IP地址

然后使用systemctl restart systemd-networkd && netplan apply重新启动或重新启动网络

更新/警告除非您已经在使用Ubuntu Bionic Beaver或专门使用Systemd版本235,否则这将无效。 您需要 [Tunnel]下的Independent标志才能使用systemd版本235进行每次重启 。

Independent标志在systemd版本234及以下版本中不起作用。 您可以使用systemd --version检查systemd版本

码:

 modprobe ipv6 ip tunnel add he-ipv6 mode sit remote xxx.xxx.xxx.xxx local xxx.xxx.xxx.xxx ttl 255 ip link set he-ipv6 up ip addr add 2001:470:1f10:d47::2/64 dev he-ipv6 ip route add ::/0 dev he-ipv6 ip -f inet6 addr 

从root shell中,剪切并粘贴命令块。 modprobe确保内核加载了ipv6支持。 “ip tunnel …”创建一个点对点隧道,使用NAT路由器/防火墙/调制解调器的外部IPv4地址作为本地端,将选定的中继作为远程端,进行中继。
“ip link ……”应该是不言自明的; 它打开隧道。
“ip addr add …”配置主机正在使用的IPv6地址。
“ip route add”配置指向隧道的默认v6路由,这样任何前往普通互联网的v6流量都将知道去哪里。

消息来源: https : //ubuntuforums.org/showthread.php? t = 1700452