This article will provide you with an information on how to configure a static IP address on Ubuntu 19.04 Disco Dingo Linux
In this tutorial you will learn:
- How to configure static IP address using netplan
- How to configure static IP address from Graphical User interface ( GUI )
Software Requirements and Conventions Used
Category | Requirements, Conventions or Software Version Used |
---|---|
System | Ubuntu 19.04 Disco Dingo Linux |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Configure static IP address using DHCP
Most likely your current Ubuntu system uses DHCP server to configure its networking settings. Hence, the configuration of your IP address is dynamic. In many scenarios, simply configuring your router or local DHCP server is a preferred way to set a static address to any host regardless of the operating system in use. Check your router manual and assign the static IP address to your host based on its MAC address using the DHCP service.
Configure static IP address from command line using netplan
- Locate current network configuration file.Navigate to
/etc/netplan/
directory and locate your current network congratulation file:$ cd /etc/netplan/ $ ls 01-network-manager-all.yaml
- Edit the current configuration file.For example to set Ubuntu 19.04 system with static IP address
192.168.1.224
, netmask255.255.255.0
, gateway192.168.1.1
and two DNS servers8.8.8.8
and8.8.4.4
open the current configuration file with administrative privileges and change its content to:# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: no addresses: [192.168.1.224/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8,8.8.4.4]
- Apply changes.Next, apply changes to set your system with a new static IP address:
WARNING
If you are connected via SSH your session will be terminated!$ sudo netplan apply
All done. Use ip
command to confirm your new static IP address:
$ ip a