ipip6 tunnel
Step A: Configure the Local Host
- Local outer IPv6 address:
2001:db8:a::1 - Remote outer IPv6 address:
2001:db8:b::2 - Inside/Tunnel IPv4 subnet:
10.0.0.0/24 - Local tunnel IPv4 address:
10.0.0.1
# 1. Create the ipip6 tunnel interface ip tunnel add tun1 mode ipip6 remote 2001:db8:b::2 local 2001:db8:a::1 # 2. Assign an IPv4 address to the tunnel ip addr add 10.0.0.1/24 dev tun1 # 3. Bring the tunnel interface up ip link set dev tun1 up # 4. Optional: Route remote network traffic through the tunnel ip route add 10.0.1.0/24 dev tun1
Step B: Configure the Remote Endpoint
On the remote side (e.g., the VPS), reverse the local and remote endpoints.
# 1. Create the ipip6 tunnel interface with swapped IPs ip tunnel add tun1 mode ipip6 remote 2001:db8:a::1 local 2001:db8:b::2 # 2. Assign an IPv4 address to the tunnel ip addr add 10.0.0.2/24 dev tun1 # 3. Bring the tunnel up ip link set dev tun1 up # 4. Optional: Route local network traffic through the tunnel ip route add 10.0.0.0/24 dev tun1
3. MTU Considerations
Because IPv6 headers take up more space (40Byte) than standard IPv4 headers, standard 1500 MTU packets may cause fragmentation or silent drops if not adjusted. It is highly recommended to explicitly set a smaller MTU on the tunnel.
However you chose Netplan, Do not need mtu adjustment.
ip link set dev tun1 mtu 1440
4. 2nd or more 3….. Remote
# connect more other remote IPv6 address.
ip addr add 2001:db8:a::2 dev tun1