Community discussions

MUM Europe 2020
 
jtl
just joined
Topic Author
Posts: 6
Joined: Wed Aug 24, 2016 7:04 am

Possible to override DHCP lease time sent by server

Sat Jan 27, 2018 6:09 am

Hi all

Thinking of trying RouterOS. However I need to do something that doesn't appear possible in stock RouterOS but works with pfSense and most standard Linux distributions.

My ISP (TELUS) seems to do frequent maintenance on their FTTH network, which causes the DHCP lease binding to be dropped from their equipment, causing 100% packet loss until I release and renew the DHCP lease on my router or the lease time expires (up to 14440 seconds, 4 hours)

To work around this issue with pfSense I use a custom dhclient configuration file which includes
supersede dhcp-lease-time 1800;

This renews the IPv4 DHCP lease every 900 seconds (15 minutes) and I haven't had this issue reoccur since December 25th 2017.

Haven't figured out how to override IPv6 lease time with pfSense though.

Some sort of gateway monitoring that automatically tries to renew DHCP lease if the connection has 100% packet loss to the first hop, etc, could work as well.

Thanks
 
Tony5487
just joined
Posts: 6
Joined: Sat Jan 13, 2018 1:06 pm

Re: Possible to override DHCP lease time sent by server

Sat Jan 27, 2018 11:50 am

In RouterOS you can simply add a script with a command
/ip dhcp-client release numbers=0;
(if you've got only one DHCP-client enabled).
And then make it executable by scheduler with desired frequency, for example 15 minutes.
 
samsung172
Forum Guru
Forum Guru
Posts: 1186
Joined: Sat Apr 04, 2009 3:45 am
Location: Østfold - Norway
Contact:

Re: Possible to override DHCP lease time sent by server

Sat Jan 27, 2018 10:37 pm

there is no automatic way to do this, but you can script something to ping your isp, and renew if there is no resopnse. You can also enable/dissable dhcp in a script, and it will work like the pfsence feature.
 
jtl
just joined
Topic Author
Posts: 6
Joined: Wed Aug 24, 2016 7:04 am

Re: Possible to override DHCP lease time sent by server

Sun Jan 28, 2018 4:25 am

there is no automatic way to do this, but you can script something to ping your isp, and renew if there is no resopnse. You can also enable/dissable dhcp in a script, and it will work like the pfsence feature.
I just figured it out.

Created script renew-dhcp and add it to scheduler with 15 minute interval.
/system scheduler
add interval=15m name=schedule1 on-event=renew-dhcp policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jan/28
    start-time=01:53:19
    
/system script
add name=renew-dhcp owner=admin policy=\
    ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=\
    "/ip dhcp-client renew numbers=0"
On the plus side, this should also work after I enable IPv6 and add the equivalent command, unlike pfSense.

Who is online

Users browsing this forum: Baidu [Spider] and 71 guests