Find Out If Ubuntu / Debian / Linux Mint is Using dhcp

There are a few command line tricks that help you find out if your Ubuntu, Linux Mint, Debian or Knoppix has an static IP or a dynamic one, received from the dhcp server.

Watch Free Movies

The static IP is fixed and the dynamic one changes every time you reboot the network interface.

A good method for finding out what “kind of IP” you have, is to grep for dhcp in the logs. Like this: cat /var/log/syslog | grep -i dhcp

$ cat /var/log/syslog | grep -i dhcp
Jan 29 07:44:55 naboo dhclient: DHCPREQUEST of on eth0 to port 67
Jan 29 07:44:55 naboo dhclient: DHCPACK of from
Jan 29 07:44:55 naboo NetworkManager[423]: (eth0): DHCPv4 state changed reboot -> renew

If we study the output, we can see that the IP address on the machine is gave by the dhcp server, and it is a value between: and

Another thing that can be done, to find out the “kind of IP you have”, is to see the dhclient-*.lease files, from /var/lib/dhcp/:

You will see some files called /var/lib/dhcp/dhclient-*, where * is replaced by a string of characters, like the ones in the listed output:

$ ls -ltr /var/lib/dhcp
total 8
-rw-r--r-- 1 root root 0 Apr 25 2012 dhclient.leases
-rw-r--r-- 1 root root 1479 Sep 19 20:01
-rw-r--r-- 1 root root 1972 Jan 29 07:59

Now, do grep in the most recent file:

$ cat dhclient-* | egrep "eth0|fixed|dhcp-server

You can have more than one dhclient-* files, but only the latest file, has the latest IP addresses.

Scroll to Top