Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Prevent DHCP lease from getting stale due to suspend/resume
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
maxxim
n00b
n00b


Joined: 03 Feb 2015
Posts: 27

PostPosted: Thu Sep 02, 2021 10:55 am    Post subject: Prevent DHCP lease from getting stale due to suspend/resume Reply with quote

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
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9710
Location: almost Mile High in the USA

PostPosted: Thu Sep 02, 2021 12:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Tony0945
Watchman
Watchman


Joined: 25 Jul 2006
Posts: 5127
Location: Illinois, USA

PostPosted: Thu Sep 02, 2021 1:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
maxxim
n00b
n00b


Joined: 03 Feb 2015
Posts: 27

PostPosted: Thu Sep 02, 2021 5:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
maxxim
n00b
n00b


Joined: 03 Feb 2015
Posts: 27

PostPosted: Thu Sep 02, 2021 5:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum