Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my LAN there are multiple DHCP servers running, and all of them are on the same range.

Now I use a machine which has a dynamic IP address from a DHCP server. I have to know from which server it comes.

How to do that?!

share|improve this question
up vote 3 down vote accepted

To find out the DHCP server that's giving you the IP, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

cat /var/lib/dhcp3/dhclient.leases

Or you can just use grep command to get DHCP server address.

grep dhcp-server-identifier /var/lib/dhcp3/dhclient.leases

OR

grep dhcp-server-identifier /var/lib/dhcp/dhclient.leases
share|improve this answer

In Ubuntu 14.04 (on this machine anyway), the /var/lib/dhcp/dhclient.leases is empty. The actual lease file can be found on the command line of dhclient via ps. Look for the -lf option. This command should work in Ubuntu 14.04 installations:

cat $(ps aux | grep -o '[/]var/lib/NetworkManager/\S*.lease') | grep dhcp-server-identifier
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.