I have a PC running Ubuntu Server 18.04.3 LTS and a laptop running Ubuntu Desktop 18.04.3 LTS.
Both are correctly configured to allow the client (laptop) to connect to the server (PC) via SSH on LAN/WLan and I've tested and used this many times before. I've also port forwarded with my home router (BTHomeHub6) to allow SSH via the server's ethernet port using it's public IP. Lastly, the server is configured to accept WOL magic packets (+port forwarding) so I can start it up from anywhere with an internet connection.
However, the issue is that when I'm not in range of my home network i.e at university and on mobile data/their network, sending magic packets doesn't appear to wake up the server and hence the following error is given when I try to SSH in.
ssh: connect to host [public ip of server] port 22: No route to host
Basically, nothing works as it does at home/in the vicinity of my home network (even if I'm on mobile data and using the public IP of the server instead of it's LAN IP it can still send the packets and initiate an SSH session) and I would really appreciate any help in fixing this.
Thanks, I hope I've explained it well enough
EDIT :
I'm using this command to send the magic packets (with the terminal package of wakeonlan):
wakeonlan -i [Public IP] -p [10009] [MAC ADDR]
I have two TCP/UDP port forward rules on my home router:
- INTERNAL (Start/End = 22/22) to EXTERNAL (Start/End = 22/22). For SSH
- INTERNAL (Start/End = 10009/10009) to EXTERNAL (Start/End = 10009/10009). For WOL
EDIT 2:
Having asked the same question on Reddit, I believe I have the solution now and will surely mark as solved if it works. Here is the link if anyone is interested / wants to know how it was fixed:
https://www.reddit.com/r/Ubuntu/comments/dbqitq/xpost_can_ssh_work_over_a_long_distance_providing/
Thanks for the help everyone!