What Is Static IP Address? How to Configure Static IP Address in Ubuntu
In this article, we are going to learn How to configure static IP address in Ubuntu. Before start the configuration let’s understand what is Static IP address. There are two ways by which we can configure IP address. One is a Static IP address and another one is Dynamic IP address. When we manually configure the IP address for any network device is called as Static IP address and when DHCP Server assigns an IP address to network devices automatically is called Dynamic IP address. Normally we assign Static IP address to network devices like Router, Switch, to any Server, Network printer, and so on.
Follow the below steps to configure static IP address in Ubuntu:
There are two methods by which we can configure Static IP address and both methods are simple to follow. Here in this article, I will explain both methods. So let’s get started.
First to check your available network interfaces use the below command.
[email protected]:~$ ifconfig # Check Network Interfaces
This method we have to do using the terminal. So to configure the Static IP address we have to edit a configuration file named interfaces. The location of this file is /etc/network/interfaces. So post-editing the file using your preferred text editor you have to enter all the details i.e. IP Address, Subnet Mask, Gateway Address, and DNS Servers manually. Here the name of my Network Interface is ens33. Refer to the command below.
Note: The configuration part highlighted in Yellow color.
[email protected]:~$ sudo nano /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto ens33 iface ens33 inet static address 192.168.1.50 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 192.168.1.100 192.168.1.101
After configuring the IP address by following the above steps you have to refresh the settings by flushing the Network Interface using the below command.
[email protected]:~$ sudo ip addr flush ens33
Now restart the Networking Service to take effect the changes using the below command.
[email protected]:~$ sudo systemctl restart networking.service
Now we are Done. To check the configured Static IP address refer to the below command.
[email protected]:~$ ifconfig ens33 ens33 Link encap:Ethernet HWaddr 00:0c:29:ff:cd:2e inet addr:192.168.1.50 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4833 errors:0 dropped:0 overruns:0 frame:0 TX packets:3446 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:6985228 (6.9 MB) TX bytes:292627 (292.6 KB)
Now let’s have a look at the Graphical way of static IP Address configuration. This step is quite simple to follow and an easy way to configure the IP addresses. So to configure the IP address in a graphical way just click on Search Box on your Ubuntu and Search for Network Connection.
Then click on Network Connections icon and you will get the below screen. Just select the Network Connection you want to configure and click on the Edit button.
after the above step, you will get the below screen in-front of you. Here go to the IPv4 Settings tab, click on Add button and do the below-mentioned settings.
- Method: Select the Manual method from the drop-down list.
- Addresses: Here enter your IP Address, Netmask, Gateway details.
- DNS Servers & Search Domains: Here enter your DNS Server IP Addresses.
After configuring all the above steps just click on the Save button to save all settings. Now it’s Done. To Refresh the configuration just disconnect and connect the Network connection. You will get that setting from the task manager.
Also Read – How to Find Your IP Address (Public IP Address) in Ubuntu
That’s all, In this article, we have explained What Is Static IP Address? How to Configure Static IP Address in Ubuntu. I hope you enjoy this article. If you like this article, then just share it. If you have any questions about this article, please comment.