V
V
VN2020-11-05 13:40:51
VPN
VN, 2020-11-05 13:40:51

How to properly configure routing on wireguard?

There is currently a configured wireguard server that allows clients to access the local network.
When connected, clients use the office gateway to access the Internet. Prompt how to configure clients that they used the gateway.

Server configuration

[Interface]
Address = 10.10.10.1/24
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens192 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens192 -j MASQUERADE
ListenPort = 40820
PrivateKey = Server_key
SaveConfig = true

[Peer]
PublicKey = Client_Public_key
AllowedIPs = 10.10.10.2/32


Client configuration

[Interface]PrivateKey = <PEER_1_PRIVATE_KEY>
Address = 10.10.10.2/30
DNS = 8.8.8.8

[Peer]
PublicKey = Server_public_key
Endpoint = 11.22.33.44:40820
AllowedIPs = 0.0.0.0/0
# AllowedIPs = 10.10.10.0/24, 192.168.10.0/24
PersistentKeepalive = 20  

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zohan1993, 2020-11-05
@kavabangaungava

transmit routes for LANs only
Server configuration

[Interface]
Address = 10.10.10.1/24
ListenPort = 40820
PrivateKey = Server_key
SaveConfig = true

[Peer]
PublicKey = Client_Public_key
AllowedIPs = 10.10.10.2/32

Client configuration
[Interface]
PrivateKey = <PEER_1_PRIVATE_KEY>
Address = 10.10.10.2/24
DNS = 8.8.8.8

[Peer]
PublicKey = Server_public_key
Endpoint = 11.22.33.44:40820
AllowedIPs = 10.10.10.0/24, 192.168.10.0/24 # local networks list
PersistentKeepalive = 20

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question