LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Which is the correct DHCP server's IP address? (https://www.linuxquestions.org/questions/linux-newbie-8/which-is-the-correct-dhcp-servers-ip-address-4175604891/)

fanoflq 04-28-2017 05:48 PM

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?

AwesomeMachine 04-28-2017 05:56 PM

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.


All times are GMT -5. The time now is 06:59 AM.