Level 1
0 / 100 XP

Configuring Network Interfaces with Netplan

In this lesson, you'll learn how to configure a static IP address on a Linux server with netplan. This is an essential skill for network management and server configuration, as it ensures that your server always has the same IP address, facilitating reliable and consistent access.

This is particularly important in environments where the server hosts websites, provides remote access, or runs network services. Unlike dynamic IP addresses assigned by DHCP (Dynamic Host Configuration Protocol), a static IP does not change, making it easier to set up DNS (Domain Name System) and firewall rules.

Understanding IP Address Configuration

Every device on a network, like a local network or the internet, requires an IP address to communicate. While DHCP can be used to automatically assign an IP address, a static IP address is manually configured and remains constant. This is particularly useful for servers that need to maintain the same address for consistent access or services.

Configuring a Static IP Address

To set a static IP address, you need to edit the network configuration files. The process can vary slightly depending on the Linux distribution and the network manager in use. In this example, we'll focus on Ubuntu Server, which is a popular choice for many server environments.

  1. Identifying the Network Interface : First, you need to identify the network interface you want to configure. You can do this using the ip a command, which lists all network interfaces and their current configuration.bash
ip a

Editing the Netplan Configuration File : Ubuntu Server uses Netplan for network configuration. You'll find the configuration file in /etc/netplan/. The filename can vary, but it usually ends with .yaml. If I ls or ll the /etc/netplan/ directory I see the following file:

Text
paulh@ubuntu-server:~$ ls /etc/netplan/ 00-installer-config.yaml

Open the file with a text editor, like nano:…