Route all traffic to one IP _only_ via wireguard

reiner otto augustus_meyer at yahoo.de
Sat Apr 28 12:07:45 CEST 2018


My basic setup of wg works, I can ssh from/to server or client.
But the real goal is to tunnel only traffic with a specific destination IP
via wireguard from client to server. 
I.e. a local router, which allows direct access to the web,
_BUT_ all traffic going to the corporate server using wireguard only.
Corporate server (public 1.2.3.4) == wireguard server (172.16.0.1).

I tried various settings on my client, like
ip route 1.2.3.4 dev wg0
ip route 1.2.3.4 via 172.16.0.1 
etc.
but nothing worked.

Any help really appreciated.

---
wg0.conf on server (1.2.3.4):
[Interface]
ListenPort = 1234
PrivateKey = secret
[Peer]
PublicKey = secret
AllowedIPs = 172.16.0.0/16
-
wg0.conf on client (172.16.18.31):
[Interface]
PrivateKey = secret
ListenPort = 1234
[Peer]
PublicKey = secret
AllowedIPs = 0.0.0.0/0
Endpoint = 1.2.3.4:1234




More information about the WireGuard mailing list