Static local IP without lease from DHCP

My major PC is connect to the OpenWRT router, and it has a static assigned local IP address. Since I am running service on the major PC, I don't want it to be interrupted by lease time by DHCP service of the router, is there a way to achieve that?

Have checked previous threads, and I don't know if it's enough to disable 'dynamic DHCP' options.

Another question is, if the major PC is the only one who connected to the router through LAN, is it appropriate to 'disable DHCP for this interface'? I am not going to try it until it can be confirmed that it will not cost my control of the router.

Easiest is to assign a static IP for your PC that isn't in the pool that the DHCP server is offering. "Done and done."

5 Likes

This concern doesn't really make a lot of sense to me as there really shouldn't be any interruption as long as things are working normally.

After a host gets a lease, it will continue to use the given IP address until the lease expires. But it is proactive -- when the remaining lease time reaches half the original lease time, the host will send a request to the DHCP server asking to renew the existing lease. Under most circumstances, the DHCP server will say 'yes, you can continue using that IP' and it will renew the lease again. In most home/small business environments, there is rarely a reason that the lease would be denied, And if, for some reason, the DHCP server doesn't respond, the host will wait a while and then try to request a renewal again later... but if this is happening, there are probably larger issues with your network or your router.

Meanwhile, what you can do to ensure things work well:

  1. you can specify the lease time for your DHCP server on your OpenWrt router, so you can make it as long as you want.
  2. Additionally, you can (and, if you're using DHCP for a server, you should) set static leases from the DHCP service (such that the host(s) are always given the same IP address).

FWIW, all of my devices that need to maintain a constant IP address are assigned via static DHCP reservations and I've never had an issue.

Or... @jeff's comment that you can just assign a static IP on the PC itself is totally reasonable. You'd manually assign the address on the host itself (not on the router), but you do need to make sure it is on the same subnet as the router and that you include the gateway/router address (usually the same as the router's IP address) and the name server (but as @jeff said, the address you setup on the host must be outside the DHCP range, else you may have a conflict).

4 Likes

I generally prefer static lease from the router. Probably wouldn't make much difference in the case of a desktop PC, that doesn't usually move, bit for a portable device static IP can be annoying if you get to connect to another network, so a static lease from the router is the hassle-free solution.

3 Likes

Thank you guys for your quick and kind help.

Indeed, my static ip is in the range of DHCP. Since it's not acquired from DHCP thus no renew request sent, while DHCP will release its range every 12 hours, perhaps that's why my main PC will be interrupted every 12 hours.

Now I'm trying @jeff's solution, makes sense to me.

1 Like

@Enig123 - two things...

If your pc is having network interruptions due to dhcp, something else is wrong. Dhcp in a properly functioning environment will not cause network dropouts. More than likely something is wrong with your pc, but either way you should consider your current solution a band-aid.

You stated that your pc now has a manually assigned static IP address within the dhcp range. This is very bad practice. The IP must be in the same subnet, but OUTSIDE the dhcp range. If your address is within the dhcp pool, there is a chance that the router’s dhcp service will provide the same address to another device (because it has no way to know that address is already being used), causing an ip collision which will break connectivity for both the pc and the second device.

Sorry to bring this topic up.

There's another phenomenon which related to this topic found, after another drop out. It turned out to be related to IPv6 DHCP release, which causes the server interruption, not the IPv4 DHCP as I thought.

Is there a way to avoid this? I assume disable IPv6 DHCP might help, right?

Fixing the handling of IA_PD on your upstream router is the first path I'd take.

My ISP has not deploying IPv6 support yet. Speaking of OpenWRT, I just leave the corresponding WAN6 configuration as defaulted.

Both OpenWRT and IPv6 are kinda new to me. How am I suppose to configure it in a correct way?

Update: Now my ISP is supporting IPv6 'ia [6in4 tunneling] and via 6RD', but it needs their router which I already returned. No native IPv6 support as I figured.

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