10

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?

Tek
  • 348

3 Answers3

9

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

Tek
  • 348
1

With Ubuntu 22.04 Lts this is very simple because netplan has built-in 4to6 sit tunnel support. For example for tunneling to Hurricane Tunnel Broker Paris from Oracle Cloud (behind Oracle NAT). Create /etc/netplan/60-tunnel-he-ipv6.yaml

network:
  version: 2
  tunnels:
    he-ipv6:
      mode: sit
      remote: 216.66.84.42           #HE Paris ip4 enpoint   
      local: 10.0.0.242              #local ipv4 address (mine is behind nat)
      addresses:
        - "2001:470:001:002::2/64"   #your ipv6 endpoint
      routes:
        - to: default
          via: "2001:470:001:002::1" #HE Tunnel ipv6 endpoint

next simply issue

sudo netplan try

And accept configuration if there is no error

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

Petr
  • 408