3

I am wondering if there is anything (software or hardware) out there that can do something I think I may have made up, Dynamic Static IPs. The idea is that when a new device connects to the local network this device/software acts as a DHCP server, if the device is new then it dynamically assigns it a new address that has never been used before and stores this MAC Address IP Address combination in a database, if the device's MAC is in the database the devices gets the same IP as before.

I am aware this is similar to sticky IP allocation but I don't want the IPs to stick for a while I want them to be superglued on for ever.

Bonus question: Is this possible using a Raspberry Pi running Raspbian on a network with around 100 devices? The RPi is already acting as the DHCP server and the router has this capability but it is turned off.

Many thanks in advance for any and all help offered!

6
  • And what happens when you run out of IPs?
    – heavyd
    May 7, 2015 at 14:49
  • Good point. However on the size of network I am operating the 255.255.0.0 subnet would allow this setup to operate for many years without trouble.
    – o.comp
    May 7, 2015 at 14:50
  • What you're after is just a DHCP server... if you want to "permanently" provide the same device the same IP then you would need to either give it a static IP or tell the DHCP server to "reserve" that MAC address an IP... Raspberry Pi uses a Linux distro that can run a DHCP server... ronnutter.com/raspberry-pi-dhcp-server-reservation
    – Kinnectus
    May 7, 2015 at 14:53
  • 1
    Ideally you should update your question with a bit more information about your network... What OS is your Raspberry Pi running? Is your Raspberry Pi the DHCP server for your network? Do you have an existing router on your network that does DHCP? Do you want this to continue providing DHCP?
    – Kinnectus
    May 7, 2015 at 14:57
  • Just as a remark: I have a router that has an option called static DHCP, which does exactly that (well, it drops its database when it loses power, but that's a different matter)
    – Slizzered
    May 7, 2015 at 18:16

2 Answers 2

3

Most DHCP servers work this way, it's just they don't permanently assign the IP to a host.

On Linux, using isc-dhcp-server, it's possible to set the lease duration to never expire.

0
0

Using Debian for your Raspberry Pi

https://wiki.debian.org/RaspberryPi

you can made a DHCP Server and assign :

https://wiki.debian.org/DHCP_Server#Assign_fixed_addresses

where are some examples to make your host with fixed address:

you can manage your dhcp leases in this path there you can set as never expires.

/var/lib/dhcpd.leases

an example:

lease 192.168.1.13 {
  starts 3 2015/05/07 02:21:31;
  ends never;
  binding state active;
  next binding state free;
  hardware ethernet 00:17:3f:be:95:65;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .