How to Know if IP Address is Static or Dynamic in Linux
On the internet, a user is recognized by a distinctive identity called IP address. This 32-bit address is dynamically assigned by Dynamic Host Configuration Protocol (DHCP). Addresses allocated by DHCP can be changed upon rebooting your system, whereas static IP address does not change.
So why do people use static IP address? Static IP address is crucial if you run the server on your device to share files and other services. You can pay your internet service provider (ISP) to get a static IP address, or you can tweak and make your dynamic IP address into static in your system as well.
Though both IP configurations have their own purposes and are not perfect, static IPs are easy to hack and will cost you. Whereas dynamic IPs are not suitable for hosting services, they can cause connection interruptions and less accurate geo-location.
It is very important for you to know the type of your IP address for a number of reasons. There are many methods to check the type of your allocated IP address. This write-up is going to mention some of the approaches to learn about the type of IP address your system has. So, let’s begin.
How to Check if IP Address is Static or Dynamic in Linux
There is no direct method to check if your IP address is dynamic or static in Linux. The majority of the users would probably have an IP address assigned by DHCP. To verify it, use the command mentioned below:
The output is clearly indicating the IP and its type. But if your IP is static, then this command will not display “DHCP” in the output, as shown in the image below:
Another utility called “Network Manager Text User Interface” aka “nmtui” can assist in finding the type of IP address. This utility is quite useful to identify the type of IP and configure the network. To check the type of your IP, open terminal and execute the command mentioned below:
A network manager interface will be opened in terminal. Navigate to “Edit a connection” and press “Enter”:
Another interface will open with network interfaces. Select network interface and press “Enter”:
An “Edit Connection” window will open. You can see the IP configuration of both IPv4 and IPv6. It indicates that my IP configuration is “
Now, if my IP is static, then this window will indicate “
Conclusion:
There is no explicit way to check whether your IP is static or dynamic in Linux. There are some indirect methods to spot that your IP is dynamic or static. The most pragmatic approach is to monitor your IP every time you reboot your system. If it changes, then your IP is dynamic, otherwise static.
This guide mentioned a couple of methods to identify the IP address type in Linux, one is through the “ip r” command, and the second is through the “nmtui” utility. Static and dynamic IP configurations have their own benefits. You must be aware of the type of your IP address because static IPs are prone to hack, whereas dynamic IPs are not suitable to run the server on your machine.