configure static IP on ubuntu 18.04 through network setting and command line.
This is a preferred way of setting the static IP address on Ubuntu Desktop.
Time needed: 5 minutes.
How to configure the static IP on Ubuntu Deskto in 5 min.
Tool: Ubuntu 18.04
- Select desktop network icon
Go to the top right network icon and select Wired Connected > Wired Setting
- Seclect setting
Select the Setting icon from the wired section for configuration.
- New wired popup window
A new popup window comes up with detailed information about the network.
- Select tab
Select the IPv4 tab
- Select method
Select the IPv4 Method Automatic (DHCP) to Manual
After Selecting the Manual Option Addresses section got visible with Address, Network and Gateway Options
- Enter your IP Address
Enter your IP Address in Address box eg. 192.168.6.67
Enter your Netmask in Netmask box eg. 255.255.255.0
Enter Your Gateway in Gateway box eg. 192.168.6.6
Enter the DNS (eg 220.127.116.11)
- Apply changes
Hit the Apply button to save all the changes.
- Hit the toggle button to restart the network connection
Press the toggle button twice to restart the network connection.
- check the IP address
Click on Setting icon to check the ip address changed or not .
- Detail window comes up with IP and other details
Details page with new IP Address.
To configure a static IP address on your Ubuntu 18.04 server you need to modify a relevant netplan network configuration file within
For example, you might find there a default netplan configuration file called
50-cloud-init.yaml with a following content instructing the
networkd deamon to configure your network interface via DHCP:
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: yes
To set your network interface
enp0s3 to static IP address
192.168.1.222 with gateway
192.168.1.1 and DNS server as
18.104.22.168 replace the above configuration with the one below.WARNING:
You must adhere to a correct code indent for each line of the block. In other words the prefix number of spaces for each line is important. Othersiwe you may end up with an error message similar to: Invalid YAML at //etc/netplan/01-netcfg.yaml line 7 column 6: did not find expected key
# 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.222/24] gateway4: 192.168.1.1 nameservers: addresses: [22.214.171.124,126.96.36.199]
Once ready apply changes with:
$ sudo netplan apply In case you run into some issues execute:
$ sudo netplan --debug apply
Configuring Static IP address in ubuntu Desktop and server is quite easy, and its a 5 min task. Hopes this article helps you to configure your own.
You can watch the video below, for the live demonstration on how to configure static IP on ubuntu 18.04.