View previous topic :: View next topic |
Author |
Message |
maxxim n00b
Joined: 03 Feb 2015 Posts: 27
|
Posted: Thu Sep 02, 2021 10:55 am Post subject: Prevent DHCP lease from getting stale due to suspend/resume |
|
|
Hi there,
I often suspend/resume my machine multiple times over longer periods of time - at least twice a day for several weeks unless I really need to reboot due a new kernel or something like that.
However, it seems the DHCP lease is becoming stale after a few days, i.e. my machine still has network access, but its hostname becomes unreachable for other clients.
I thought about creating a hook in '/lib64/elogind/system-sleep' that restarts the ethernet service when resuming, but I wonder if there's some configuration option in '/etc/conf.d/net' that can help here instead.
My current config is:
Code: | # Ethernet configuration
config_enp34s0="dhcp"
ethtool_change_enp34s0="wol g" |
|
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9710 Location: almost Mile High in the USA
|
Posted: Thu Sep 02, 2021 12:55 pm Post subject: |
|
|
You may need to do that - add a hook to reload on resume... what are you using to detect network connection, just straight openrc/dhcpcd?
I use networkmanager for machines that may suspend/resume/change network position. It requests a new DHCP lease with the same request each time upon resume as it knows when these events happen through dbus. _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
Tony0945 Watchman
Joined: 25 Jul 2006 Posts: 5127 Location: Illinois, USA
|
Posted: Thu Sep 02, 2021 1:25 pm Post subject: |
|
|
Use a static address that is permanently in the other machines' /etc/hosts?
Assign a fixed address reservation by MAC in the DHCP server? |
|
Back to top |
|
|
maxxim n00b
Joined: 03 Feb 2015 Posts: 27
|
Posted: Thu Sep 02, 2021 5:07 pm Post subject: |
|
|
eccerr0r wrote: | You may need to do that - add a hook to reload on resume... what are you using to detect network connection, just straight openrc/dhcpcd?
I use networkmanager for machines that may suspend/resume/change network position. It requests a new DHCP lease with the same request each time upon resume as it knows when these events happen through dbus. |
Yes, I'm using straight OpenRC / dhcpcd + ifplugd for ethernet. NetworkManager would be an option. But I'd like to think there's also some dhcpcd option for this, something in the lines of 'discard lease if older than x hours and request new one'. |
|
Back to top |
|
|
maxxim n00b
Joined: 03 Feb 2015 Posts: 27
|
Posted: Thu Sep 02, 2021 5:09 pm Post subject: |
|
|
Tony0945 wrote: | Use a static address that is permanently in the other machines' /etc/hosts?
Assign a fixed address reservation by MAC in the DHCP server? |
Those are two viable solutions, but I'd probably use to the elogind hook instead. |
|
Back to top |
|
|
|