Allocate IP sequentially

i have openwrt install router..and i want to Allocate it IP sequentially .....
i already checklist that in the dhcp and dns setting > advance setting and reboot my router
but it didn't work, my pc that connect to router always get 192.168.1.xxx
(and i set my ethernet pc to obtain ip automically) and my phone get random ip too
i dont want to set it static on both

any suggestion/what should i do?

If you don't want static addresses, then what problem does random IP address assignment cause you?

If you want consistent IP addresses each time, then would DHCP leases be suitable?

In addition to setting sequential IPs on the global DHCP setting, did you also lower the start number on the individual Interface setting (i.e. LAN):

2 Likes

DNSMasq handsout an ip address loosely based on the mac address.
Therefore you usually get the same ip address.

Your phone is using a random mac address (this is configurable on your phone) and therefore a varying ip address.
If you do not want that or want to use a static lease then disable this feature on the phone

2 Likes

--dhcp-sequential-ip Dnsmasq is designed to choose IP addresses for DHCP clients using a hash of the client's MAC address. This normally allows a client's address to remain stable long-term, even if the client sometimes allows its DHCP lease to expire. In this default mode IP addresses are distributed pseudo-randomly over the entire available address range. There are sometimes circumstances (typically server deployment) where it is more convenient to have IP addresses allocated sequentially, starting from the lowest available address, and setting this flag enables this mode. Note that in the sequential mode, clients which allow a lease to expire are much more likely to move IP address; for this reason it should not be generally used.

2 Likes

I'm not sure if you meant to reply to the OP or me, and I'm not sure if you're disagreeing with the OP. To be clear, the OP is referring to this setting:

Apologies for the misunderstanding, I should have worded my response better.

I am familiar with DNSMasq and its MAN page:

--dhcp-sequential-ip
    Dnsmasq is designed to choose IP addresses for DHCP clients using a hash of the client's MAC address. This normally allows a client's address to remain stable long-term, even if the client sometimes allows its DHCP lease to expire. In this default mode IP addresses are distributed pseudo-randomly over the entire available address range. There are sometimes circumstances (typically server deployment) where it is more convenient to have IP addresses allocated sequentially, starting from the lowest available address, and setting this flag enables this mode. Note that in the sequential mode, clients which allow a lease to expire are much more likely to move IP address; for this reason it should not be generally used.

My remark was for the OP as he specifically mentions his phone with a random IP address and if that is the real problem then it could be the random MAC address feature of modern phones, which also prevent static leases hence my remark.

1 Like

Sequential assignment depends on the time order that clients connect, so it is completely unpredictable. It's not going to solve this problem.

Most phones use the same "random" MAC when reconnecting to a network with the same SSID.

DHCP reservations should generally be based on host name though. The name can be configured in the phone.

2 Likes

My own phone does this, but it also offers the option for me to switch off the randomness on a per-network basis... and then whinges at me about being foolish enough to compromise my own privacy.

Look, Tim Cook, it's my own network, not some random public Wi-Fi. I reckon I can compromise my own privacy without too much harm, y'know?

2 Likes