"Netplan Gateway is Deprecated: Use Default Routes on Ubuntu"

3 min read
14 October 2023

In the ever-evolving world of Linux networking, keeping up with the latest practices and technologies is essential. For Ubuntu users, managing network configurations has often been synonymous with Netplan. However, there's a significant change on the horizon that users should be aware of: the deprecation of Netplan's "gateway" field and the introduction of default routes as the preferred method for configuring gateways. In this article, we'll explore why this change is happening and how you can adapt your network configurations on Ubuntu.

The Rise of Netplan:

Netplan, introduced in Ubuntu 17.10, was designed to simplify the configuration of network interfaces on Ubuntu. With its user-friendly, YAML-based configuration files, it aimed to make network setup more straightforward and accessible to both beginners and experienced administrators. Netplan allowed users to define gateway addresses for routing and configure various aspects of their network interfaces with ease.

For more information click here-    - :  Netplan Gateway is Deprecated Use Default Routes on Ubuntu

The Deprecation of the "Gateway" Field:

Starting with Ubuntu 20.04 LTS (Focal Fossa), a subtle but essential shift in network configuration began. The traditional "gateway" field in Netplan was deprecated. This change aimed to harmonize network configuration across different Linux distributions, promote more standardized networking practices, and improve the overall reliability of network setups.

The Arrival of Default Routes:

To replace the "gateway" field, Ubuntu now encourages users to set up default routes using the "routes" field in Netplan configuration files. A default route, often referred to as the default gateway, is a vital part of routing network traffic. It tells the system where to send data that doesn't match any specific route in the routing table. In Netplan, default routes are defined like this:

yaml

network:

  version: 2

  renderer: networkd

  ethernets:

    ens33:

      addresses:

        - 192.168.1.10/24

      gateway4: 192.168.1.1

      routes:

        - to: 0.0.0.0/0

          via: 192.168.1.1

In this example, we specify the default route using the "routes" field, indicating that all traffic destined for the "0.0.0.0/0" network (i.e., any destination) should be sent via the gateway at "192.168.1.1."

Benefits of Default Routes:

Default routes offer several advantages over the older "gateway" field:

  1. Standardization: Default routes adhere to common networking practices across various Linux distributions, making it easier to migrate or share configurations.
  2. Clarity: Using default routes explicitly states the intention to route all unspecified traffic through a specific gateway.
  3. Flexibility: Default routes allow for more granular control over the routing of network traffic, which can be especially useful in complex network setups.
  4. Improved Consistency: Standardizing network configurations can help reduce potential errors and increase the reliability of network connections.

Conclusion:

Ubuntu's decision to deprecate the "gateway" field in Netplan in favor of default routes represents a shift towards standardized and more robust networking practices. While this change may require users to adapt their network configurations, it ultimately leads to improved network reliability and compatibility with other Linux distributions. As you work with Ubuntu 20.04 LTS and beyond, embracing default routes in your Netplan configurations will ensure your network setup remains efficient and up-to-date.


In case you have found a mistake in the text, please send a message to the author by selecting the mistake and pressing Ctrl-Enter.
Atik Zaman 2
Joined: 8 months ago
Comments (0)

    No comments yet

You must be logged in to comment.

Sign In / Sign Up