Configuring Ubuntu to Use a Gateway Outside of the Assigned V6 prefix Network Print

  • 10

Introduction

This guide will help you configure your Ubuntu system to use an IPv6 gateway outside of the assigned /48 network. This is particularly useful for ensuring proper network routing when the default installation setup does not support this configuration.

Prerequisites

  • An Ubuntu system with Netplan installed.
  • Basic knowledge of accessing and editing configuration files using a terminal.
  • Your specific network details (IPv4 and IPv6 addresses, gateways, MAC address, etc.).

Default Netplan Configuration

When your system installs, the default Netplan configuration might look something like this:


network:
ethernets:
id0:
addresses:
- 23.172.120.XXX/24
- 2602:f96d:XXX:XX::1/64
gateway4: 23.172.120.1
gateway6: 2602:f96d::1
match:
macaddress: BC:XX:11:XX:85:6C
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
- 1.0.0.1
renderer: networkd
version: 2

Problem

In the configuration above, the IPv6 gateway (2602:f96d::1) is outside the assigned /48 network (2602:f96d:XX::1/48), causing routing issues.

Solution

To resolve this, you need to add specific routes to your Netplan configuration. Follow the steps below:

  1. Open the Netplan configuration file:
    sudo nano /etc/netplan/01-netcfg.yaml
    Adjust the filename if your configuration file has a different name.

  2. Modify the Netplan configuration:
    Update your configuration to include specific routes for IPv6. Your updated configuration should look like this:

    network:
    ethernets:
    id0:
    addresses:
    - 23.172.120.XX/24
    - 2602:f96d:XX:xx::1/48
    gateway4: 23.172.120.1
    match:
    macaddress: BC:24:11:3C:85:6C
    nameservers:
    addresses:
    - 1.1.1.1
    - 8.8.8.8
    - 1.0.0.1
    routes:
    - to: "2602:f96d::1/128"
    scope: link
    - to: "::/0"
    via: "2602:f96d::1"
    on-link: true
    renderer: networkd
    version: 2

Explanation:

  • The routes section is added to specify the routes.
  • The first route specifies that the gateway (2602:f96d::1) is on the link, meaning it is directly reachable on the local network.
  • The second route sets the default route for all IPv6 traffic (::/0) to go through the specified gateway (2602:f96d::1), and the on-link: true option ensures that the system considers the gateway to be on the same link.

Apply the changes:
Save the file and exit the editor. Then apply the changes by running:

sudo netplan apply

Conclusion

By following these steps, your Ubuntu system will be configured to use an IPv6 gateway outside of the assigned /48 network. This ensures proper network routing and connectivity.

Additional Resources

 


Was this answer helpful?

« Back