9

I used to be able to do the configuration below with no issues in /etc/network/interfaces but now it's not picked up anymore. How do I configure a ipv6 tunnel now? I see see the new netplan software to configure interfaces but I can't seem to find the equivalent commands to the ones below

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

How do I configure Ubuntu to keep this configuration permanently on the next reboot?

8

I figured it out.

I created the following files:

/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:
      ...

Where 2001:470:xxx:xxx::2/64 is your Client IP address from tunnelbroker.net

Then reboot or restart your network with systemctl restart systemd-networkd && netplan apply

Update/Warning This won't work unless you're already using Ubuntu Bionic Beaver or specifically speaking Systemd Version 235. You need the Independent flag under [Tunnel] for this configuration to work on every reboot along with systemd version 235.

The Independent flag doesn't work in systemd version 234 and below. You can check your systemd version with systemd --version

  • Any specific reason to use Independent= instead of adding something like: [Network] Tunnel=he-ipv6 In a new file /etc/systemd/network/10-netplan-eth0.network.d/tunnel.conf ? – Mathieu Trudel-Lapierre Nov 28 '18 at 23:24
  • I'm adding tunnel support in netplan. It will work soon in the development release, and once it's there we'll make it available for 18.04 and above. – Mathieu Trudel-Lapierre Nov 28 '18 at 23:27
  • 1
    @MathieuTrudel-Lapierre Please post a full example in a new answer so that others may see how to do it that way. – Tek Dec 2 '18 at 18:49
  • No point in adding the answer until that's actually released anywhere :) Stay tuned. – Mathieu Trudel-Lapierre Dec 7 '18 at 19:19
0

Code:

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

From a root shell, and cut & paste the command block. The modprobe makes sure that the kernel has ipv6 support loaded. The "ip tunnel ..." creates a point to point tunnel, using the outside IPv4 address of your NAT router/firewall/modem as the local side and the selected relay as the remote side, where the relaying will happen.
The "ip link ..." should be self-explanatory; it turns the tunnel on.
The "ip addr add ..." configures the IPv6 address your host is using.
The "ip route add" configures a default v6 route pointing at the tunnel, so that any v6-traffic headed to the general internet will know where to go.

SOURCE: https://ubuntuforums.org/showthread.php?t=1700452

  • 1
    Yes but this configuration would be lost upon reboot. Where do I configure this to keep it permanently? – Tek Jan 5 '18 at 18:44
  • Make a sh script from it an run it on startup – Petr Jan 6 '18 at 14:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.