Sabayon Linux NetworkManager: Fix broken wlan0 after resume by executing dhclient

This article is from 2014 and has been archived. It's old and probably outdated.

Since a couple of updates my Sabayon machine had a broken wlan0 interface after resuming from standby. The NetworkManager connected to the WIFI as expected and even received a correct IP from the DHCP server but something was broken with the routing as far as I know. The route command didn’t return any route, pings failed.

I was able to fix the issue after every resume by running sudo dhclient wlan0 manually. Needless to say, this was something that I did not want to do all the time. I found this helpful tip in the Ubuntu forums: Just create a bash script using root permissions in /etc/NetworkManager/dispatcher.d, e.g. 20-dhclient, with this content:

    #!/bin/bash
    # This script runs dhclient when using wireless

    if [ "$1" = "wlan0" ]; then
        if [ "$2" = "up" ]; then
            dhclient wlan0
        fi
    fi

Save it, make it executable with sudo chmod +x 20-dhclient and restart the network with either sudo /etc/init.d/NetworkManager restart or sudo systemctl restart NetworkManager.

If you know a better way to fix this issue, please let me know in the comments.

Jan Beilicke

About the author

Long-time IT professional and full-time nerd. Open source enthusiast, advocating security and privacy. Sees the cloud as other people's computers. Find me on Mastodon or Twitter.