Dhcp renewal after wakeup

From SlackWiki
Revision as of 14:08, 27 November 2010 by Merge-delete (talk | contribs) (dhcp renew after sleep tip)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Sometimes you need a new IP address after waking up from sleep/standby/hibernate modes. Network managers like Wicd can do this and are recommended for laptops, but you can use the pm-utils triggers yourself without installing and running more software too. The following script works for me:

#!/bin/sh
#
# put this to:  /usr/lib64/pm-utils/sleep.d/05DhcpcdRenew
# /usr/lib/pm-utils/ .. on 32-bit systems

case "$1" in
        hibernate|suspend)
                ;;  
        thaw|resume)
                dhcpcd -n
                ;; 
        *) exit $NA
                ;; 
esac

The script probably needs to be executable.