How to Find Out If My IP Address Is Static or Dynamic in Linux?

The easiest way to determine if your external IP address is static is to do the following:

Visit a site that will display your current external IP address, such as http://whatismyip.com . From Terminal, Mac and Linux users can try the command

#curl icanhazip.com.

Write down the address.
Restart your router.
Check your external IP address again, and compare it. If it has changed, you have a dynamic external IP address. If it has not changed, you may have a static IP address.

How to Check an IP Address

o get the depth information of your network interfaces like IP Address, MAC Address information, use the following command as shown below.

# ip addr show
$ sudo ip addr show

Sample Output

1: lo:  mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:28:fd:4c brd ff:ff:ff:ff:ff:ff
    inet 192.168.50.2/24 brd 192.168.50.255 scope global eth0
    inet6 fe80::20c:29ff:fe28:fd4c/64 scope link
       valid_lft forever preferred_lft forever
3: eth1:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 00:0c:29:28:fd:56 brd ff:ff:ff:ff:ff:ff
    inet 192.168.50.5/24 scope global eth1
    inet6 fe80::20c:29ff:fe28:fd56/64 scope link
       valid_lft forever preferred_lft forever

Execute the following command from a terminal:

#cat /etc/network/interfaces

If your internal IP address is set as dynamic, it should contain something along the lines of

iface eth0 inet dhcp 

And if it is static, it will contain

iface eth0 inet static

Leave a Reply