James' website

This is a test website to try out GitHub and Git Bash

View My GitHub Profile

Using netplan

02 Mar 2025 - jhunter

Sources

gal.vin

Command

sudo netplan apply

Definition

Use sudo netplan apply to set the network configuration on an ubuntu system.

Configuration file

The network configuration file is located here: /etc/netplan/00-installer-config.yaml.

View which configuration files are available using this command:

sudo ls -ltr /etc/netplan/*.yaml

Example

You might care about netplan when your ubuntu server doesn’t get an IP address.

View the IP address with:

sudo ip --brief a s

If you don’t see an IP address in this output, look at the netplan configuration to see if it correct.

sudo vi /etc/netplan/00-installer-config.yaml

The most basic DHCP enabled configuration looks like this. Take the ethernet name (ens33 in my case) form the earlier command.

The configuration file makes use of indentations.

network:
    renderer: networkd
    version: 2
    ethernets:
      ens33:
        dhcp4: true

After saving the configuration file, apply the configuration with:

sudo netplan apply

Now the ubuntu server should get an IP address from your DHCP server.

The blog referenced at the top shows how to set a static IP address in an ubuntu server.