CONFIGURING STATIC IP ADDRESSES ON UBUNTU 17.10 SERVERS

Ubuntu 17.10 network configuration is completely changed. Have you heard of NetPlan? Probably not, but if you have, then you’re a step ahead of many. NetPlan is a new network configuration tool introduced in Ubuntu 17.10 to manage network settings.

It can be used by writing a simple YAML description of the required network interfaces with what they should be configured to do; and it will generate the required configuration for a chosen renderer tool.

This new tool replaces the static interfaces (/etc/network/interfaces) file that had previously been used to configure Ubuntu network interfaces. Now you must use /etc/netplan/*.yaml to configure Ubuntu interfaces.

This brief tutorial is going to show students and new users how to use NetPlan to set a static IP address on Ubuntu servers. This should be easy and quick.

The new interfaces configuration file now live in the /etc/netplan directory. A file called 01-netcfg.yaml is used to configured the first interface. Below is the default configuration for a interface using DHCP.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   ens33:
     dhcp4: yes
     dhcp6: yes

To save your changes, you run the commands below.

sudo netplan apply

CONFIGURING STATIC IP ADDRESSES

To configure a static IP address using the new NetPlan tool, the file should look like this: IPv4 address (192.168.1.2), Gateway (192.168.1.1), DNS Servers (8.8.8.8,8.8.4.4)

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   ens33:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.2/24]
     gateway4: 192.168.1.1
     nameservers:
       addresses: [8.8.8.8,8.8.4.4]

Exit and save your changes by running the commands below

To version 22.0.4

      addresses:
      - 192.168.1.230/24
      nameservers:
        addresses:
        - 192.168.1.254
        search: []
      routes:
      - to: default
        via: 192.168.1.254

sudo netplan apply

You can add IPv6 addresses line, separated by a comma.. example below.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   ens33:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.2/24, '2001:1::2/64']
     gateway4: 192.168.1.1
     nameservers:
       addresses: [8.8.8.8,8.8.4.4]

Save your changes, apply and you’re done.

This is how to set static IP addresses on Ubuntu 17.10.

For more about NetPlay, visit this site.

Congratulations! You’ve just successfully configured static IP addresses on Ubuntu 17.10 servers.

Enjoy!~