Software & AppsOperating SystemLinux

Why Ubuntu Changed Network Configuration in 17.10

Ubuntu 13

In Ubuntu 17.10, a significant change was made to the network configuration. This change was a shift from the traditional method of editing /etc/network/interfaces and restarting the networking service, to using Netplan – a new command-line network configuration utility developed by Canonical, the company behind Ubuntu. This article will delve into the reasons behind this change and how it impacts Ubuntu users.

Quick Answer

In Ubuntu 17.10, the network configuration was changed from the traditional method of editing /etc/network/interfaces to using Netplan, a new command-line network configuration utility. This change was made to enhance the ease of representing network configurations, especially in complex scenarios, and to provide greater flexibility and power.

The Old Way: ifupdown

In previous Ubuntu versions, network configuration was handled by a utility called ifupdown. This involved manually editing the /etc/network/interfaces file to define the network interfaces and their settings. After making changes, the networking service would need to be restarted for the changes to take effect.

For example, to configure a static IP address, you would add something like this to your /etc/network/interfaces file:

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

In this example, eth0 is the network interface being configured. inet static indicates that a static IP address is being used. The address, netmask, and gateway lines specify the IP address, subnet mask, and default gateway respectively.

While this method worked, it had some limitations. It couldn’t represent all configurations with a purely declarative syntax, had limited portability across different devices, and could result in race conditions in complex configurations.

The New Way: Netplan

To address these issues, Ubuntu 17.10 introduced a new utility called Netplan. Netplan uses a YAML configuration file format, which provides a simple and declarative representation of network configurations. This makes it easier to define and understand complex network configurations.

Netplan configuration files are stored in the /etc/netplan/ directory. The main configuration file is usually named 01-netcfg.yaml. To apply the configuration, you use the netplan apply command.

Here’s an example of a Netplan configuration for a static IP address:

network:
 version: 2
 renderer: networkd
 ethernets:
 enp3s0:
 dhcp4: no
 addresses: [192.168.1.2/24]
 gateway4: 192.168.1.1
 nameservers:
 addresses: [8.8.8.8, 8.8.4.4]

In this example, enp3s0 is the network interface being configured. dhcp4: no indicates that DHCP is not being used, and a static IP address is specified instead. The addresses line specifies the IP address and subnet mask (in CIDR notation), and gateway4 specifies the default gateway. The nameservers section is used to specify DNS servers.

Why the Change?

The main reason for the change is to enhance the ease of representing network configurations, especially in complex scenarios. The increasing demand for complex networking scenarios, especially in large cloud environments, necessitated an improvement in representing network configurations.

Netplan offers a declarative configuration, support for matching interfaces by name, MAC address, driver, etc., and maintains the context of hierarchy in interface definitions. This makes it more flexible and powerful than ifupdown.

However, if you still need to use ifupdown instead of Netplan, you can remove the netplan.io package and manually configure /etc/network/interfaces, although this is not recommended.

Conclusion

The shift to Netplan in Ubuntu 17.10 represents a significant change in how network configurations are handled. While this change may require some learning and adaptation, it offers greater flexibility and power, especially for complex network configurations. For more detailed information on Netplan and its capabilities, you can visit the Ubuntu Wiki page on Netplan.

Can I still use ifupdown in Ubuntu 17.10?

Yes, you can still use ifupdown in Ubuntu 17.10, but it is not recommended. If you prefer to use ifupdown instead of Netplan, you can remove the netplan.io package and manually configure /etc/network/interfaces.

How do I apply the Netplan configuration changes?

To apply the Netplan configuration changes, you need to use the netplan apply command. After making changes to the Netplan configuration file, run sudo netplan apply to apply the changes and update the network configuration.

Where are the Netplan configuration files stored?

Netplan configuration files are stored in the /etc/netplan/ directory. The main configuration file is usually named 01-netcfg.yaml. You can create additional configuration files in the same directory to define different network configurations.

Can Netplan handle complex network configurations?

Yes, Netplan is designed to handle complex network configurations. It offers a declarative configuration format, support for matching interfaces by name, MAC address, driver, etc., and maintains the context of hierarchy in interface definitions. This makes it more flexible and powerful than ifupdown for complex scenarios.

Can I still use a static IP address with Netplan?

Yes, you can still use a static IP address with Netplan. In the Netplan configuration file, you can specify the dhcp4: no option and provide the static IP address, subnet mask, and default gateway. You can also specify DNS servers using the nameservers section.

Leave a Comment

Your email address will not be published. Required fields are marked *