Idea: DHCP client, fallback to last known IP address

Suggest improvements and new features for Gargoyle.

Moderator: Moderators

Post Reply
hnl_dk
Moderator
Posts: 408
Joined: Mon Aug 29, 2011 12:37 pm

Idea: DHCP client, fallback to last known IP address

Post by hnl_dk »

I am sometimes having a problem that when the router gets rebooted, it will not always get its IP-address. Then I will need to reboot the router again so it will try again.
So I have two ideas about what gargoyle could do about this,
1. if the DHCP client is not successful, try again, perhaps three times (at the moment, it just stops if it is not successful).
2. or if the DHCP client is not successful, use the last known IP address as a fallback.
Router: TL-WR1043ND - Gargoyle 1.5.4
AP: TL-WR1043ND - Gargoyle 1.5.4

pbix
Developer
Posts: 1373
Joined: Fri Aug 21, 2009 5:09 pm

Re: Idea: DHCP client, fallback to last known IP address

Post by pbix »

Well your idea (2) below would be a violation of the rules of DHCP. It is not permissible for DHCP clients to invent their own IP address.

Describe your WAN connection type since this impacts things.

As for idea (1) you may be able get this to work with a little effort on your part. OpenWRT uses 'udhcpc' for DHCP on the WAN. You can see the many options of this utility by running /sbin/udhcpc -h at the command line. Also much information can be had via google.com about this. This is started by OpenWRT in the file /lib/network/config.sh. It looks to me that as a default it should be retrying every 20 seconds to get an IP address. Did you wait long enough? You might try playing with the "-t 0" option in that file. Please report your results.
Linksys WRT1900ACv2
Netgear WNDR3700v2
TP Link 1043ND v3
TP-Link TL-WDR3600 v1
Buffalo WZR-HP-G300NH2
WRT54G-TM

hnl_dk
Moderator
Posts: 408
Joined: Mon Aug 29, 2011 12:37 pm

Re: Idea: DHCP client, fallback to last known IP address

Post by hnl_dk »

pbix wrote:Well your idea (2) below would be a violation of the rules of DHCP. It is not permissible for DHCP clients to invent their own IP address.
Ok, sounds reasonable ;-)
but it is still what most computers do, where you have an "alternative IP address", if DHCP is failing.
pbix wrote:Describe your WAN connection type since this impacts things.
I have a Static IP address, provided to me be a DHCP server.
pbix wrote:As for idea (1) you may be able get this to work with a little effort on your part. OpenWRT uses 'udhcpc' for DHCP on the WAN. You can see the many options of this utility by running /sbin/udhcpc -h at the command line. Also much information can be had via google.com about this. This is started by OpenWRT in the file /lib/network/config.sh. It looks to me that as a default it should be retrying every 20 seconds to get an IP address. Did you wait long enough? You might try playing with the "-t 0" option in that file. Please report your results.
I believe that I have been waiting some minutes, but I will try to give it a try one of the next days, just to make sure.
I have also been thinking of just setting it as a static IP address, as I have a static IP provided as DHCP, but I will give it a spin.
Router: TL-WR1043ND - Gargoyle 1.5.4
AP: TL-WR1043ND - Gargoyle 1.5.4

Post Reply