0

I have my desktop and laptop, which I configure DHCP on my desktop ethernet and let my laptop connect to it. The issue is after my desktop wake up from sleep, both of them are UP but did not auto re-establish their connection.

ip a on my desktop, after wake up:

eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether e0:4f:43:28:14:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.1/24 brd 192.168.100.255 scope global noprefixroute eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::877b:4080:5730:2008/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

On my laptop:

enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e8:6a:64:6e:1b:43 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fcf:313e:903:4d9b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Running sudo dhclient -v -r enp0s31f6 on my laptop didn't re-establish the connection:

Listening on LPF/enp0s31f6/e8:6a:64:6e:1b:43
Sending on   LPF/enp0s31f6/e8:6a:64:6e:1b:43
Sending on   Socket/fallback

My fix is to run ip link set <interface> down && ip link set <interface> up on either machine, to let them initiate their connection. Is there a better way to let them re-connect after wake? Sorry for the lack of knowledge to describe better what I want.

My desktop is on 18.04, kernel 5.4. My laptop is on 18.04, kernel 4.15.

Thank you for any help!

bizi
  • 111

1 Answers1

0

Create a script with your fix in a script on the /usr/lib/pm-utils/sleep.d directory:

#!/bin/sh

case "$1" in resume) set <interface> down ip link set <interface> esac

Make sure to mark it executable and with the correct permissions.

For better explanation see these other questions:

Run Script on Wakeup?

how to execute a command after resume from suspend?

dariox
  • 146