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/05/24 03:11] – clarity, formatting, grammar hogwild | 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 stores DHCP lease information | + | By default, dnsmasq stores DHCP lease data in (volatile) |
- | \\ | + | There are currently two common methods for dealing with this. |
- | There are currently two approaches to resolving this. The first approach does not use scripting. | ||
- | - Under Advanced, go to to [[:advanced-dhcpdns|DHCP/ | + | ===== Method 1: Store the lease database on permanent storage ===== |
- | dhcp-leasefile=/ | + | |
- | </ | + | The first method does not use scripting. The goal of the first method |
- | - Use a path relative to your own system. Click Save. \\ | + | |
- | - The goal here is to store the lease database on permanent storage. This can be useful, for example, when devices are connected to a switch. Using permanent storage means client devices won't lose connectivity if the router reboots. Moreover, they won't display in the Device List as having an active lease until their current lease expires, and they request a new one. FreshTomato will just continue where if left off. \\ | + | |
- | - You will notice that the example points to a USB device labelled " | + | |
\\ | \\ | ||
- | 2) The second approach is to keep the lease database in its default location and copy it to permanent storage at "halt" | + | - Under Advanced, go to the [[advanced-dhcpdns|DHCP/ |
+ | 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 | ||
+ | - Notice that the example points to a USB device labelled | ||
- | \\ | ||
- | \\ | + | ===== Method 2: Copying the lease database to permanent storage at halt time ===== |
- | For example, in the // | + | \\ 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 -> | <code -> | ||
[ -f / | [ -f / | ||
- | sort -b -k 2 -u -z / | + | sort -b -k 2 -u -z / |
- | sort -b -k 2 -u -z / | + | sort -b -k 2 -u -z / |
- | diff -a /tm | + | diff -a /tmp/ |
- | kill -HUP `ps | grep | + | kill -HUP `ps | grep -E [d]nsmasq | awk '{ print $1 }'` |
- | rm / | + | rm / |
- | rm / | + | rm / |
+ | rm -f / | ||
} | } | ||
</ | </ | ||
Line 39: | Line 42: | ||
\\ | \\ | ||
- | In the same menu, in the Halt field, enter:\\ | + | in the //Halt// field In the [[admin-scripts|Scripts]] menu, enter:\\ |
<code -> | <code -> | ||
Line 45: | Line 48: | ||
</ | </ | ||
- | This second method | + | \\ |
+ | |||
+ | \\ | ||
+ | |||
+ | Method 2 can be used with any type of storage, including JFFS. When using method 2 only with USB, an alternative is to enter the former set of configuration lines into the //Run after mounting// field and the latter set of lines in the //Run before unmounting// fields in the [[nas-usb|USB | ||
\\ | \\ |