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|
|Other||Privileged access to your Linux system as root or via the |
|Conventions|| # - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
Configure static IP address using DHCPMost 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.
/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.1and two DNS servers
22.214.171.124open 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: [126.96.36.199,188.8.131.52]
- Apply changes.
Next, apply changes to set your system with a new static IP address:
If you are connected via SSH your session will be terminated!
$ sudo netplan apply
All done. Use
ipcommand to confirm your new static IP address:
$ ip a