I’ve searched far and wide for a solution for my problem and haven’t been able to find it, so thanks in advance for the patience if this is a noob question.
I’ve set up WireGuard on my home server, my personal laptop and phone. The connection works fine if I, e.g., use my phone while on a friend’s WiFi (i.e. at their house) or using mobile data. The same applies to my laptop. In summary, both work fine with the wg0 interface up whenever I don’t use the same network as my home server.
However, whenever I set WireGuard to be up on my devices while connected to the same network as my home server (that is, my home network), I cannot access the internet, only local addresses (localhost:XXXXX etc.). My workaround has been to disable WireGuard when I’m at home, which isn’t a big deal on my phone — I use Android and can simply tap the WireGuard tile from the notification view and it’s all good —, but can be annoying on my laptop (open terminal, wg-quick down wg0
, and done).
Admittedly, it isn’t that big of a deal, but I’d like for it to “just work”, i.e. simply not needing manual intervention to be connected to my home network, unless it is down or something.
So there you have it: how could I set up WireGuard on my devices so that I don’t have to touch it to use it regularly?
Just for the record, I’ve used this script to install WireGuard quickly on my phone and laptop, after fiddling around with it manually. Moreover, this is how the configuration on my laptop looks like:
[Interface] Address = 10.7.0.4/24, fddd:2c4:2c4:2c4::4/64 DNS = 192.168.0.2 PrivateKey = PK
[Peer] PublicKey = PbK PresharedKey = PSK AllowedIPs = 0.0.0.0/0, ::/0 Endpoint = mydomain.net:51820 PersistentKeepalive = 25\
Finally, I’ve come across this Reddit link, which seems to address my problem, though I couldn’t figure out for the life of me what is meant by “typing the internal IP of [my] server peer in the phone’s Wireguard config”.
Also, maybe off-topic, but how are you able to connect to WireGuard on some public networks? I tried connecting while on a cafe, but, apparently, the port I used was blocked.