I
I
Ivan Shtefanov2020-06-02 20:04:26
VPN
Ivan Shtefanov, 2020-06-02 20:04:26

How to set up a wireguard VPN server on a VPS to combine 2 offices?

Good afternoon. Prompt plz. there is a VPS on ubuntu 18, the Wireguard VPN server is up on it. and there are two geographically different clients with a gray IP from the provider.
Client 1. ext. network 192.168.1.0/24
Client 2. ext. network 192.168.2.0/24
VPN network 10.148.128.0/24
Routes are registered on routers (keenetic). if you ping addresses like 10.148..... there is a response from the router, but when you try to ping an internal address like 192.168.... there is no answer. As I understand it, you need to register routes on the server so that the networks 192.168.1.0 and 192.168.2.0 can exchange via the vpn channel. But I could not find what commands to set on the server. Who knows tell me please. If it helps, below is the config of one of the clients.

[Interface]
PrivateKey = 6OQa+K.........CPhakE=
Address = 10.148.128.11/24
DNS = 1.1.1.1

[Peer]
PublicKey = 10K+8NaHWLW.........fcVc=
PresharedKey = 0NIJK...........=
AllowedIPs = 0.0.0.0/0, ::/ 0
Endpoint = 45.149.000.00
PersistentKeepalive = 25

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-06-02
@dronmaxman

Let 's say
10.148.128.11 - VPN address of the server
10.148.128.21 - VPN address of keenetic 1 behind which the network is 192.168.1.0/24
10.148.128.22 - VPN address of the server 2 behind which the network is 192.168.2.0/24
Then register routes to the branches on the server.
sudo route add -net 192.168.1.0/24 gw 10.148.128.21 - keenetic IP address in VPN
sudo route add -net 192.168.2.0/24 gw 10.148.128.22 - keenetic IP address in VPN
Don't forget to enable packet forward
echo 1 > /proc /sys/net/ipv4/ip_forward
On keenetic 1 there should be a route 192.168.2.0/24 through 10.148.128.11
On keenetic 2 there should be a route 192.168.1.0/24 through 10.148.128.11

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question