Tag Archives: Configure Network address

Linux: Configure Network address through Netplan

Permanent address: Linux | configure network address through netplan 🙃)

Problem description

In Ubuntu 18.04, the default network configuration tool is netplan, and SYSTEMd networkd is used as the back-end configuration tool.

This note will record how to use netplan to configure network address in Ubuntu 18.04 and how to deal with common problems.

Solution

For more usage methods, refer to the documentation of netplan | backend aggressive network configuration in yaml.

Static address binding

# Add Configuration
cat > /etc/netplan/01-static.yaml <<EOF
network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses:
        - 10.10.10.2/24
      gateway4: 10.10.10.1
      nameservers:
        search: [mydomain, otherdomain]
        addresses: [10.10.10.1, 1.1.1.1]
EOF

# Application Configuration
netplan apply

Dynamic allocation (DHCP)

# Add Configuration
cat > /etc/netplan/01-static.yaml <<EOF
network:
    version: 2
    renderer: networkd
    ethernets:
        enp3s0:
            dhcp4: true
EOF

# Application Configuration
netplan apply

“21442;” 32771;”29486;

Network plan `124Backend-agnostic network configuration in YAML