Where do I put supersede dhcp-lease-time for WAN?
-
I have tried to google, but it seems like all the places that mentions this possibility assumes that you are a developer or something like that. So they don't explain how do do it. I have a problem with my IPTV that I believe will be solved with a daily renewal, so I'd like to put
supersede dhcp-lease-time 86400;
into the system. That's the number of seconds in 24 hours. I think it actually will try to renew i half that number of seconds, but that's really no problem for me. The problem is finding out where I should do it. Can somebody please put me out of my misery?
The best would of course be if I could force a renewal say 04 every night, but I don't think that's possible, at least my googling hasn't come up with a solution for that.
-
Setting up the behaviour of the DHCP server has been demystified in the eighties, last century, some 40 years ago.
True, normally, no one needs to know what DHCP is, as it just works out of the box.
But ....
You decided to install pfSense - so you have access to DHCP server settings - if needed.You've already seen :
This phrase says it all :
This is the maximum lease time for clients that ask for a specific expiration time
The DHCP client can chose to use whatever lease time it wants.
If it wants to renew every 300 seconds (initial lease time set to 600 second) then that's up to the TV. You could only change this behaviour if you have access to the DHCP client settings, which is unlikely.Is your TV connected with Wifi ? Then the issue might be different then what you think.
If the wifi signal becomes bad for whatever reason, the network link will go down and up moments later on the TV. When a connections comes up ..... a DHCP negotiation s is started.
Check the DHCP traffic on the DHCP server log page : if you find DHCP requests from the TV on random times, you know it's network link related.
You've several solutions :
Put the TV nearby the AP.
Stop using Wifi, cable it up.
Stop using DHCP on your TV, assign static IP settings (IP, network, gateway and DNS). -
@gertjan Thanks for the irony, but I probably should have specified that the problem is that I need to renew the WAN DHCP more often than the ISP does it. As far as I know supersede is not even used for the LAN lease time, which is why I didn't think of specifying that this is for WAN. I have now changed the subject heading accordingly.
-
@mastiff said in Where do I put supersede dhcp-lease-time for WAN?:
supersede dhcp-lease-time 86400;
If your wanting to put that option in for your wan dhcp client.. Those would be done on the interface under dhcp advanced options.
-
Oops. Completely read over the WAN word.
On the LAN(s) side, there is one or more DHCP servers.
On the pfSense WAN side, there is a "DHCP client" - that is, if you use DHCP as a WAN connection type.@mastiff said in Where do I put supersede dhcp-lease-time for WAN?:
I need to renew the WAN DHCP more often than the ISP does it.
A DHCP clients emits a renew sequence when it decides that it is time.
The ISP DHCP server - on the ISP side, or a DHCP server in the ISP router, does nothing, except waiting from DHCP traffic from the client - and answering when request for leases comes in.I'm using DHCP myself on the WAN.
The WAN interface is using the "em0" driver.
The latest DHCP client lease info is stored here (my case) :/var/db/dhclient.leases.em0
...... lease { interface "em0"; fixed-address 192.168.10.3; option subnet-mask 255.255.255.0; option routers 192.168.10.1; option domain-name-servers 192.168.10.1; option domain-name "home"; option broadcast-address 192.168.10.255; option dhcp-lease-time 86400; option dhcp-message-type 5; option dhcp-server-identifier 192.168.10.1; renew 3 2022/1/19 21:33:43; rebind 4 2022/1/20 06:33:43; expire 4 2022/1/20 09:33:43; }
The lease time is 86400 which means I should see a WAN IP renewals every 43200 seconds or 12 hours. My ISP router alsways hands over the same IP : 192.168.10.3.
What has the DHCP client on the WAN of pdSense to do with a TV ?
I don't understand what the issue is ? What is your question ? -
@mastiff said in Where do I put supersede dhcp-lease-time for WAN?:
I have a problem with my IPTV that I believe will be solved with a daily renewal
I am with @Gertjan here - not sure how renewing your IP more often would fix your IPTV issue? Are you saying the wan is no longer working unless you renew? When it renews do you get the same IP? Or are you getting a different IP?
You can look to see what your lease values are in the lease file as he shows.
Is it maybe your not renewing, and then it times out and you loose access because the discover doesn't work after lease expiration?
By default, the client will try and renew the lease at the 50% mark, and then continue to try faster and faster as the lease approaches expiration. Once it has actually expired if it could not renew, it should send out a discover again looking for any new lease..
If your lease is still valid, and internet is working - I am not sure how just renewing it would fix your tv issue?
-
@johnpoz Actually it's 100 % reproduceable. There is a Norwegian thread about Telenor's T-We IPTV with a great howto. Until a few months ago that had been working for a year without a hitch. Suddenly Telenor changed something, which meant that one single channel (the public service/state channel NRK1, where the main Norwegian news are on every day at 19, and then local news, which is mostly what I watch) stops working after a number of days.
I'm not really sure how long because we are only sporadically in that apartment. I'm not there now (won't be at least for a week or two), so I don't really have any way to check if it changes the IP address,I suddenly remembered my dyndns.com redirect to the house (for VPN tunnel), so I could check the logs there, it doesn't change the IP but it is the only thing besides a full reboot of the pfSense box that makes NRK1 work again. I prefer not to do a full reboot since nothing else is acting up at all, everything else is 100 % stable. I'm very much a "band-aid on paper cuts" man, not an "open heart surgery on paper cuts" man.So do I simply copy in "supersede dhcp-lease-time 86400;" (without the quotes of course) in the field and click save? Like this:
Sorry if I need it in with teaspoons, I just need to be absolutely sure, or I'll have to get to town to the house to fix Internet for the (very much non techie) renters, and my wife has the car to work for a late shift (nurses assistant at an old people's home).
-
@mastiff I am not sure if there is anything special you have to do there.
But before changing that - look in your lease file. is it renewing, if so how often?
If its renewing and your still having the problem, not sure how renewing it more often is going to fix it.. If your saying it stops working after a few days.
Unless your renewing only every like 4 days or something... Look in your lease file to see how often its actually renewing, and what the current lease time is, etc.
-
@johnpoz The file /var/db/dhclient.leases.em0 is there, but it's empty. There's one called re0 with info like:
lease { interface "re0"; fixed-address (not going to tell anybody that...); option subnet-mask 255.255.252.0; option routers 85.164.24.1; option domain-name-servers 148.122.164.253,148.122.16.253; option domain-name "bb.online.no"; option dhcp-lease-time 1200; option dhcp-message-type 5; option dhcp-server-identifier 88.91.127.1; renew 3 2022/1/19 11:47:58; rebind 3 2022/1/19 11:55:28; expire 3 2022/1/19 11:57:58; }
It seems to be renewing every ten miutes. Which probably means you're right (as I guess you normally are), it's the actually unbind and then rebind process that does it, not the DHCP renewal. So it seems like I need a way to release, wait a few seconds and then renew. I have no idea what has created this problem, but doing that fixes it. Is it possible to automate that in a way? Perhaps running it 04 every night, so I avoid annoying my tenants?
-
@mastiff if I had to guess.. With such a low lease, is it actually renewing.. Or is it failing to renew, and then having to do a discover.
When you actually loose a lease, and have to do a discover again - its possible there is a interruption in service.
Such a low lease time is nuts on anything other than say a really over crowded wifi network or something where you have way too many clients than actual leases to hand out.. And your wanting to make sure you get leases back asap when a client is no longer there.
I would look in your dhcp log do you see your wan renewing or having to discover and get IP, even if the same one.
good thing with such a short lease - as you should see plenty of entries in the log. It is possible that if they honor a longer request that changing your requested dhcp lease time could have it renew less often.
-
@johnpoz That was from my log, I think. At least it shows the outside IP address. And it does renew every ten minutes.
I haven't changed anything on my side, so it has to mean that the ISP forces those updates. On my DHCP server the box for lease time is empty (of course that probably doesn't have anything to do with the DHCP client), and I have not put in anything as far as I know for the DHCP client lease time. In comparisment I can see on my Netgate box here at the cabin that the lease time for the fibre there seems to be around two hours.
Maybe I should try that supersede option modifyer to make it renew less, not more? Oh, and one of the other guys in the Norwegian forum has the same problem, so it's not just my system.
-
@mastiff said in Where do I put supersede dhcp-lease-time for WAN?:
At least it shows the outside IP address. And it does renew every ten minutes.
that is not the log, that is the lease.. You need to look in the log to see if actually renewing, with a lease time of 1200, seconds it should renew like every 5 minutes.. edit: doh, 1200 seconds is 20 minutes, so your right 600 second renewal would be every 10 minutes.
Let me find a wan renew in my log and show you what you should be looking for - brb
edit: ok filter your dhcp log on client, and you should see what is going on with your wan renewal, and timing, and if it has to discover, etc..
See those 2 requests there, they are 12 hours apart - which is what it should be for my 24 hour lease I get.
Its really odd that if your renewing so often that you would have issues, unless the issue presents its self when the renew fails say every few days, and the discover process is what causes the issue your seeing.. A look to the log for what is going on with your renew process could shed some light on what is going on.
Problem is, even if you supersede the lease time, since they are handing out such short ones - you could run into the problem with their dhcpd saying oh this guy didn't renew in 1200 seconds. That lease is free, and give it to someone else - then you have a real mess.. If you want to renew less often you really need to request a longer lease. So that they do not hand it out to someone else if it expires.
-
@mastiff said in Where do I put supersede dhcp-lease-time for WAN?:
The file /var/db/dhclient.leases.em0 is there, but it's empty. There's one called re0 with info
Oh nice. You've got a Realtek NIC (re0) as a WAN.
And a em0, probably a Intel lookalike.
Add this to your list : swap the em0 - probably the LAN interface with the WAN.DHCP servers that hand out 10 minute leases .... you should go look elsewhere. This is just broken.
-
@gertjan maybe they are in the process of changing IP ranges for their clients? ;) Maybe they did and someone forget to put the lease time back to something sane...
But yeah 20 min lease time seems a bit nuts.. Why would they want so much traffic? Yeah dhcp isn't all that much but multiply that by 20K customers.. or 100k.. And your talking some traffic for no reason..
-
@Gertjan I see no reason to change something that's been totally stable (100 %, actually) since 2016! This problem, which is the only problem I have, has nothing to do with my setup. People with totally different setups, but using pfSense, have the exact same problem.
-
@mastiff said in Where do I put supersede dhcp-lease-time for WAN?:
since 2016
So your saying their lease time has always been 20 minutes? That 1200 seconds?
I have been using pfsense for like 12 years, multiple ISPs never had any issues what so ever with dhcp.. Ever.. There are 100's of thousands of pfsense deployments - I don't see any mass complaints on the boards that dhcp is broken or breaks every few days, etc. etc..
Now sure now and then you get some complaints that dhcp having issues, most of the time its users getting dhcp from their modem while their connection has gone offline and they get a 192.168.100 address..
If you your on a 20 minute lease, and something wrong and it doesn't renew and then causes a blip every time it had to do a discover, etc. Then you would have issues every 20 minutes, not every few days.. So while something is ODD or not quite right, etc. I don't see it as something not right with pfsense.. Maybe your isp only lets you renew X number of times before they force you to discover? The log when you see the problem, and then the log right after you do what release and renew and its back to normal could be helpful in tracking down what the actual issue is. I think his point of changing isp, not really a serious one to be honest ;) More like what the F is wrong with this isp that they would set a 20 minute lease time.. ;) Find a different isp that not so insane ;)
Sure setting a 20 min lease should work, and it should work from now til doomsday really.. But it just a crazy amount of extra traffic for no reason.. Unless like said they are over subscribed on IPs and trying to keep their IPs free as possible by kicking clients out of the pool when they don't renew.. Ie their box has been off for 20 minutes.. I just don't get why any isp would want to generate extra traffic like that? Hand ful of devices no big deal but most isps have 1000's and and 1000's of clients using the same dhcp server, etc. A renew every 10 minutes vs say every 12 hours is crazy amount of traffic - for why?
-
@johnpoz I have no idea what the lease time has been, this is the first time I've ever looked at it, I have never had reason to before. And I haven't said that pfSense has as DHCP problem, it has always worked as it should, the ONLY thing that has a problem is that one channel on the T-We-box, same channel as other people has pfSense has a problem with.
But I'm guessing that the lease time really is that short. Just now I found out that you hadn't actually posted a new message about the log after that "brb", which I was waiting for, you had edited the original message, and I never saw that, sorry. Here's the info from my log:
Btw I have been using M0n0wall (which pfSense is a fork of) and then pfSence for almost 20 years (Kasper released the first version of M0n0wall in 2003, if I'm not mistaken). And I have never really found any problems that where in the firewall, all problems have been in my ISDN, DSL cable and now fibre modems, ISPs or my own servers.
-
@mastiff yeah that looks completely normal for a lease of 20 minutes..
So when you have an issue with this 1 channel. And you do what you do with these - do you get another IP, or the same.. Do you do discover vs a renew? its possible something in their system dies out after x amount of time unless you do a discover.. But what you posted from your log is exactly what you would see for a 20 minute lease and a normal renew of that lease at the 50% mark..
-
@johnpoz I get the same address it seems. Is there a script command or something that I could use to release the address, wait five seconds and then renew the address? I'm pretty sure doing that at say 04 every night would solve the whole thing, since it's solved by doing that manually.
Or even better, an HTTP command I could send from my home automation (with POST message) that will do it? In that case I could also have a button in the living room so my wife could press it whenever NRK1 isn't working, and then the system would do the rest?