Static leases and DHCP

Thanks for reading and thinking of helping.

I have static IPs instead of DHCP. But the leases are not being honoured. Devices are somehow getting addresses from DHCP.

Why?

I don't see a way to turn off DHCP. Is there a way?

I've deleted the entries from the /tmp/dhcp.leases but this does nothing.

Thanks for your help.

Camus

There is a difference between static IPs via "Static leased IPs distributed via DHCP" or "Static IPs configured on the clients" which one are you using on your LAN?

3 Likes

Could you elaborate on that, as even Static Leases are distrubuted by DHCP, but instead random IP, they assigning IP based on MAC address (and they appear like that with static IP in DHCP leases table). Are MAC addresses correct? What devices don't get static IP? for example iPhone got implemented random mac address for networks now.

This may remove file, but fill not do anything fir clients if they got assigned address. Or you doing ipconfig /release ipconfig /renew (on Windows) or just unplug cable / restart router and wait couple minutes.

Static IP = set on client, static lease = fixed up provided by DHCP.

The 1st set on client, the 2nd in DHCP, based on MAC.

2 Likes

If client got a static IP set than its ignoring DHCP on router.

What you mean 2nd in DHCP? you using on on client on router, not both.

It's one or two, both are unnecessary.

Both shall work.
If static on client than not doing anything on router.

If you want static lease on router, than set it in DHCP static leases and client set to get up automatically,

Well yes, both work, hence two options, but the dhcp isn't queried if there's a static IP set.

Because that how this is working in principle. Why client will ask for up if got already one ste?

Maybe in Windows, in Linux you can have a static IP and fire up the dhclient to get another one.

No,
You can have or static set or get IP from DHCP. Doesn’t matter if is Windows or Linux. Unless you got a rule that prioritising dhcp over static, that’s different story. You need to decide what you want to achieve as is confusing here.

Maybe confusing for you, but still it is possible. I am getting address by dhcp and I'll add a static.

dietpi@raspi:[~]$ ps -ef | grep dhcp
root       305     1  0 Μαΐ06 ?     00:00:00 /sbin/dhclient -4 -v -i -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient.eth0.leases eth0
dietpi@raspi:[~]$ sudo ip -4 addr
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 10.0.2.3/24 brd 10.0.2.255 scope global dynamic eth0
       valid_lft 33892sec preferred_lft 33892sec
dietpi@raspi:[~]$ sudo ip -4 addr add 192.168.213.1/24 dev eth0:1
dietpi@raspi:[~]$ sudo ip -4 addr         
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 10.0.2.3/24 brd 10.0.2.255 scope global dynamic eth0
       valid_lft 33721sec preferred_lft 33721sec
    inet 192.168.213.1/24 scope global eth0
       valid_lft forever preferred_lft forever

Works fine.

@trendy Thanks a lot. What I was looking for, from the link you sent in direct response to my question:

Disabling DHCP role

This change turns off DHCP on the specified interface but leaves DNS services available.
uci set dhcp.lan.ignore="1"
uci commit dhcp
/etc/init.d/dnsmasq restart
/etc/init.d/odhcpd restart

Thank you, indeed, there is. @trendy played some voodoo thinking and was able to know what I was after even with my confusing naming of IP types and provided the answer.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.