DHCP server, is it possible to load a bunch of MAC address, IP address and host name with a file?

Hi,

just updated pi-hole, and saw that DHCP server allows for DHCP with assignement of static IP address to specific MAC address (and give same IP to multiple MAC addresses, hich is cool for who has extenders in the network sincer they give virtual MAC addressses to devices, and that can cause problems).

My problem is that I have lots of devices, like 150, and I like to have all static IP address, is it possible to give a file, instead of punching them one by one in the front end?

This is already possible, although not from the web interface. I suggest you create some few reservations on the web interface and open the file /etc/dnsmasq.d/04-pihole-static-dhcp.conf in your favorite editor, afterwards.

You can put in the allocations in the shown format here. It may be that you have to restart the DHCP server afterwards,

sudo service dnsmasq restart
1 Like

fantastic!

I have a bunch of mac address in CAPS and some not (like 5c or 5C), can I import as is, or do I need ot convert all to CAPS?

Mixed is fine. They are converted to lower case in the background regardless of what they are in the file.

I have a file for this!

1 Like

shall I do like you wrote, or can I put two lines (same IP, different MAC) ??

Smaller bug/issue

when I sort by IP

192.168.1.102 is before 192.168.1.12

it would be useful if 12 is treated as 012, so is shown before 100+

what this would do is if your device using NIC-Teaming,,, two interfaces, one IP.

sorry I am not expert of network.

I do have 2 cases.

My QNAP has two MAC address
My TV (also notebook and so on) has Ethrnet and Wifi (I would rather have one IP address because either connects Ethernet OR Wifi)

the device would need to support NIC-teaming

also, you wouldn't want to nic team wifi with ethernet.

I'm not sure offhand on windows 7,,,, but Windows Server allows you to setup NIC Teaming to load balance two interfaces.

I just want that if I connect with WiFI OR with Ethernet (from same notebook) I get the same IP address.

Hi

WHat does it mean
"Range of IP addresses to hand out"

is it the range of address that the pi-hole will assign?

p.s. just made the switch from my router dhcp server, to the pi-hole. I am crossing my fingers

A DHCP server gives out addresses to devices that don't have a static address.

A DHCP server has a range of addresses that it is permitted to hand out to devices. You can make the range however small you want, but I believe that the range can be limited to how large it can be.

Static IP addresses do not need to be within the DHCP range.

You could have a range of 192.168.1.105 to 192.168.1.160. Then use The static IP address of a home server as 192.168.1.100.


There are two ways to set a static IP address.

  • Manually on the device itself
  • Via the DHCP server.

If you want the same IP, I would set it manually on your computer, and make sure you always switch wifi off when you use ethernet. I don't think you can have it switch automatically.

it works great.

I love it, thanks!!