Finding what device is handing out an IP address?

Finding what device is handing out an IP address?

Author
Discussion

2Btoo

Original Poster:

3,547 posts

209 months

Friday 22nd December 2023
quotequote all
Guys,

I may be being thick here but help me out ....

I run a RaspPi with PiHole on it. I'm a big fan and have been using it for nearly 3 years but have tinkered with the installation and am confused.

The RaspPi is at 192.168.10.2 and I use the DHCP server in PiHole. The DHCP server on the router (a Virgin SuperHub 3 I think) is turned off. However I can't see how the IP address is allocated to the RaspPi. 192.168.10.2 is not listed in the 'Currently Active DHCP Leases' list in PiHole and neither is it listed in the list of Static DHCP leases. I suspect that I've hard-coded it somewhere but I can't remember where.

Where may I have hard-coded the IP address for the RaspPi and/or what device is handing out this IP address if it isn't the DHCP server in PiHole?

Thanks. And please feel free to laugh if I'm being thick.

ETA: There's nothing in etc/network/interfaces either.

Edited by 2Btoo on Friday 22 December 19:15

eltawater

3,155 posts

185 months

Friday 22nd December 2023
quotequote all
Have a look in /etc/dhcpcd.conf

2Btoo

Original Poster:

3,547 posts

209 months

Friday 22nd December 2023
quotequote all
Thanks eltawater. No game there either.

xeny

4,587 posts

84 months

Friday 22nd December 2023
quotequote all
My vague recollection is the static IP is set during pihole install. Have you tried pihole -r and seeing if it can be configured there?

eeLee

836 posts

86 months

ARHarh

4,138 posts

113 months

Wednesday 27th December 2023
quotequote all
When installing pihole it will set the ip the DHCP server at the time handed out as a fixed IP in the pihole setup. Once this has been set, it is then the address of the DHCP server you setup on pihole. Therefore it wont show as allocated by the pihole DHCP as it wasn't set by it.


That feels like I wrote it in circles but I guess you understand what I am trying to say. smile

TonyRPH

13,096 posts

174 months

Wednesday 27th December 2023
quotequote all
EDIT: Before trying the below, try this: (had to put it in a screenshot as stupid PH filters blocked the post!!!!)

journalctl -r X grep -m1 DHCPACK ("X" needs to be the pipe | character)



You will likely need 'sudo' in front of the command.

Dec 27 07:43:26 ns0 dhclient[648]: DHCPACK of 10.0.0.2 from 10.0.0.1 (10.0.0.1 is the DHCP server)

Simple way: issue the command 'ip a' (no ticks, might need sudo in front of that)

Look for the word "peer" followed by an IP address - that address should be your DHCP server.

If that doesn't work then try;

On the Pi, look in /var/lib/dhcp/ where there should be a file with the interface name; e.g. dhclient.eth0.leases (to get your interface name, ip a as per above)

Then search for the term 'dhcp-server-identifier'

grep -i dhcp-server-identifier /var/lib/dhcp/dhclient.eth0.leases

This should return the line: option dhcp-server-identifier 172.31.1.1; where 172.31.1.1 is the DHC server in this example.

Below is the full content of the file:

file said:
lease {
interface "eth0";
fixed-address x.x.x.x;
filename "/pxelinux.0";
option subnet-mask 255.255.255.255;
option routers 172.31.1.1;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers x.x.x.x,x.x.x.x;
option dhcp-server-identifier 172.31.1.1;
option rfc3442-classless-static-routes <redacted>;
option unknown-249 <redacted>;
renew 5 2019/09/13 22:13:00;
rebind 6 2019/09/14 07:14:41;
expire 6 2019/09/14 10:14:41;
}
Edited by TonyRPH on Wednesday 27th December 14:57


Edited by TonyRPH on Wednesday 27th December 15:00