I have vps with ubuntu onboard and installed wireguard. Also I have a home network: router + several laptops. I want connect my router to vps and have access from vps to any laptops.
I run wirequard with docker compose:
wireguard:
image: linuxserver/wireguard
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London #set correct timezone
- SERVERPORT=51820 #optional
- PEERS=green #optional
- PEERDNS=auto #optional
- ALLOWEDIPS=0.0.0.0/0 #Peer addresses allowed
- INTERNAL_SUBNET=10.13.13.0/24 #Subnet used in VPN tunnel
- SERVERURL=example.org #Wireguard VPN server address
volumes:
- ~/apps/wireguard/config:/config
- /lib/modules:/lib/modules
ports:
- 51820:51820/udp
This is my wg0.conf:
[Interface]
Address = 10.13.13.1
ListenPort = 51820
PrivateKey =
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
# peer_green
PublicKey =
PresharedKey =
AllowedIPs = 10.13.13.2/32, 192.168.1.0/24
Peer config:
[Interface]
Address = 10.13.13.2
PrivateKey =
ListenPort = 51820
DNS = 10.13.13.1
[Peer]
PublicKey =
PresharedKey =
Endpoint = example.org:51820
AllowedIPs = 0.0.0.0/0
I can connect to wireguard with router, but I can't ping router or any devices from vps. Also I doesn't see any router on my ps with "ip route". How to make LAN reachable from my vps or my laptop connected to vps?
ip route add {LAN_NETWORK/MASK} via {GATEWAYIP} dev wg0
cyberciti.biz/faq/…