2
1
I have two Arch Linux-powered computers, 'A' and 'B', connected to the Internet via the same router. I have configured and tested Wake-on-WAN on both of them. Both computers are shut down most of the time.
I'd like to connect to them without sending magic packets from outside. NIC of the computer 'A' supports waking up by the unicast activity, so I've enabled it. The problem is, this isn't the case for the computer 'B' - it can be woken up by the magic packet only.
Can I make the computer 'A' to wake the computer 'B' automatically when there is TCP/UDP connection attempt to the latter? I'm thinking about a solution like this:
- Configure the router and the computer 'B' so all of the 'B' traffic (on specific ports) goes through the computer 'A'.
- Set up a script on 'A' that triggers on a connection to 'B' somehow, checks 'B' state and sends magic packet.
Maybe there is a simpler way?
EDIT:
It would be good if it was possible to re-route everything so no 'B' traffic goes through 'A' after wakeup of the former, therefore enabling the latter to auto-shutdown.
I don't want 'B' to wake up when I access 'A'. The script needs to detect if there is a connection to the ports reserved for 'B'. Anyway, this answer is a refinement to my solution, thanks. – ivanp7 – 2018-09-12T00:32:04.420
I don't want 'B' to wake up when I access 'A'
. OK. Then do not make the script run automatically. Whenever you need to wake upB
you first wake upA
, SSH into it and run the script that wakes upB
. In this way waking upA
would not automatically wake upB
. – VL-80 – 2018-09-12T00:39:44.903This is what I do now, but I want to get rid of the manual wake procedure. – ivanp7 – 2018-09-12T00:43:05.857
I'm going to try something like
if [[ "$(ss -anp | grep $PORT | grep ESTAB | wc -l)" -gt "0" ]]; then wakeup.sh; fi
– ivanp7 – 2018-09-12T00:50:44.0731@ivanp7 Why don't you let the router send the magic packet? You've got a nice shell-enabled router right, with at least busybox? – Xen2050 – 2018-09-12T00:55:51.633
@Xen2050 This would be the best solution if I bought the router myself. It is a cheap Huawei HG8245H-256M, installed by my ISP. Someday I'll buy a real router, but currently I want to get as much as possible from the present hardware. – ivanp7 – 2018-09-12T01:18:56.513
@ivanp7 Could try using your own router (or any other low power device with a shell, raspberry?) connected to the ISP's Huawei as another client, or daisy-chain your own router after the Huawei & have all your devices connected to your router – Xen2050 – 2018-09-13T01:17:18.400