This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
retain_dhcp_lease_info_after_a_reboot [2023/02/07 16:57] – rs232 | retain_dhcp_lease_info_after_a_reboot [2023/08/15 18:32] (current) – [Method 2: Copying the lease database to permanent storage at halt time] petervdm | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Retain DHCP Lease Information after a Reboot ====== | ====== Retain DHCP Lease Information after a Reboot ====== | ||
- | By default dnsmasq | + | By default, dnsmasq |
- | 1) This isn't a scripting method/ | + | There are currently two common methods |
- | Navigate to [[: | ||
- | <code -> | + | ===== Method 1: Store the lease database on permanent storage ===== |
+ | |||
+ | The first method does not use scripting. The goal of the first method is to store the lease database on permanent storage. | ||
+ | |||
+ | \\ | ||
+ | |||
+ | - Under Advanced, go to the [[advanced-dhcpdns|DHCP/ | ||
dhcp-leasefile=/ | dhcp-leasefile=/ | ||
+ | </ | ||
+ | - Use a path relative to your own system. | ||
+ | - Using permanent storage means client devices won't lose connectivity if the router reboots. Because the lease database is not stored in RAM, a reboot won't erase it. This can be useful, for example, when devices are connected to a switch. Moreover, clients won't display in the [[status-devices|Device List]] as having an active lease until their current lease expires, and they' | ||
+ | - Notice that the example points to a USB device labelled " | ||
+ | |||
+ | |||
+ | ===== Method 2: Copying the lease database to permanent storage at halt time ===== | ||
+ | |||
+ | \\ The second approach is to keep the lease database in its default location and copy it to permanent storage at " | ||
+ | |||
+ | \\ \\ For example, in the Init field in the [[admin-scripts|Scripts]] menu, enter:\\ | ||
+ | |||
+ | <code -> | ||
+ | [ -f / | ||
+ | sort -b -k 2 -u -z / | ||
+ | sort -b -k 2 -u -z / | ||
+ | diff -a / | ||
+ | kill -HUP `ps | grep -E [d]nsmasq | awk '{ print $1 }'` | ||
+ | rm / | ||
+ | rm / | ||
+ | rm -f / | ||
+ | } | ||
</ | </ | ||
- | Use a path relative to your own system. | + | \\ |
- | The idea is essentially to store the lease database directly on non-volatile storage. This can be useful, for example, when devices are connected to a switch. They won't lose network connectivity if the router is down (rebooted). | + | \\ |
+ | |||
+ | in the //Halt// field In the [[admin-scripts|Scripts]] menu, enter:\\ | ||
+ | |||
+ | <code -> | ||
+ | cp -f / | ||
+ | </ | ||
\\ | \\ | ||
- | 2) A different approach is to keep the lease database in its default location and copy it to permanent storage at " | + | \\ |
- | Administration/ | + | Method 2 can be used with any type of storage, including JFFS. When using method |
- | <code ->[ -f / | + | |
- | sort -b -k 2 -u -z /tmp/var/lib/misc/dnsmasq.leases > /tmp/dnsmasq.tmp1 | + | \\ |
- | | + | |
- | diff -a /tm | + | \\ |
- | kill -HUP `ps | grep | + | |
- | rm / | + | |
- | rm / | + | |
- | }</ | + | |
- | Administration/ | ||
- | <code ->cp -f / | ||
- | This method 2) can be used with any storage, JFFS included, where for USB (only) an alternative is to performed the save/copy within the '' |