LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2017, 05:48 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
Which is the correct DHCP server's IP address?


For linux Mint.
Method 1:
Code:
 $ locate dhclient | less
   # find file with *lease
 $ locate dhclient | grep -i lease
 
/var/lib/NetworkManager/dhclient-e6195e03-3b9c-42ef-8852-5f7426462df8-wlp2s0b1.lease
/var/lib/NetworkManager/dhclient-ed6abb63-ac60-4a8a-909c-eb593bf9488d-wlp2s0b1.lease

>ls -al /var/lib/NetworkManager
 
-rw-r--r--  1 root root   982 Apr 18 20:01 dhclient-e6195e03-3b9c-42ef-8852-5f7426462df8-wlp2s0b1.lease
-rw-r--r--  1 root root  1118 Apr 26 14:28 dhclient-ed6abb63-ac60-4a8a-909c-eb593bf9488d-wlp2s0b1.lease

 /var/lib/NetworkManager $ tail dhclient-ed6abb63-ac60-4a8a-909c-eb593bf9488d-wlp2s0b1.lease
  option dhcp-server-identifier 10.0.0.1;
  option dhcp-renewal-time 302400;
  option broadcast-address 10.0.0.255;
  option dhcp-rebinding-time 529200;
  option host-name "HP";
  option domain-name "hsd1.co.comcast.net";
  renew 6 2017/04/29 12:30:41;
  rebind 2 2017/05/02 23:28:33;
  expire 3 2017/05/03 20:28:33;
So method 1's the DHCP server's IP address is 10.0.0.1 from this:
option dhcp-server-identifier 10.0.0.1;

Method 2:
Code:
 $ sudo grep -R "DHCPOFFER" /var/log/*
[sudo] password for foffb: 
( OR this works too: $ sudo grep -Ri "offer" /var/log/* )
/var/log/auth.log:Apr 28 16:16:09 HP sudo:    foffb : TTY=pts/1 ; PWD=/home/foffb ; USER=root ; COMMAND=/bin/grep -R DHCPOFFER /var/log/alternatives.log /var/log/alternatives.log.1 /var/log/alternatives.log.2.gz /var/log/alternatives.log.3.gz /var/log/alternatives.log.4.gz 
...     
/var/log/fontconfig.log /var/log/fsck /var/log/gateone /var/log/gpu-manager.log
/var/log/syslog:Apr 28 15:38:34 HP dhclient[6430]: DHCPOFFER of 192.168.0.13 from 192.168.0.1

# IP address of DHCP offered correlates to wireless IP address:  
>ip addr
  
3: wlp2s0b1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether e0:2a:82:3c:29:b6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.13/24 brd 192.168.0.255 scope global dynamic wlp2s0b1
In method 2, the DHCP server's IP address is 192.168.0.1.


So why two different results?
Is the DHCP server's IP address 10.0.0.1 incorrect?

Is there a better method to get DHCP's IP address?
 
Old 04-28-2017, 05:56 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
10.0.0.1 is the private class A address space. Unless you have a massive network, you're probably using 192.168.0.1, which is the private class C address space. Why the lease file says 10.0.0.1 I have no idea.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dhcp-helper (cannot bind DHCP server socket: Address already in use) smeezekitty Linux - Networking 2 02-16-2015 06:57 PM
Single DHCP server ,to provide the ip address to a MAC address in two different subne alix123 Linux - Software 5 05-08-2007 11:16 PM
How To know if a host configured with DHCP has obtained IP address from DHCP server? Prassanta SUSE / openSUSE 1 06-29-2006 09:48 AM
do not recieve correct ip address from dhcp server BCarey Linux - Wireless Networking 2 06-09-2006 02:27 PM
DHCP Server MAC Address found, IP address not assigned wmburke Linux - Wireless Networking 17 11-17-2004 10:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration