Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Eric Light <eric@ericlight.com>
To: reiner otto <augustus_meyer@yahoo.de>, wireguard@lists.zx2c4.com
Subject: Re: Route all traffic to one IP _only_ via wireguard
Date: Sun, 29 Apr 2018 01:49:20 +1200	[thread overview]
Message-ID: <1524923360.509743.1353883656.6A466327@webmail.messagingengine.com> (raw)
In-Reply-To: <570542680.2946509.1524910065103@mail.yahoo.com>

Hi Reiner! 

I think the problem here is your client's AllowedIPs section. If you only want to access one address, you only enter that target IP - not the whole internet space (0.0.0.0/0). That's why everything is being routed out via your wg0. 

So you should change that client AllowedIPs to 172.16.0.1/32, and that'll fix it. Alternatively, set it to /24 if you also want access to other devices within the corporate LAN... That's how I do it. 

I think that's all you need. Sorry if I've missed something! :) 

E

--------------------------------------------
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

On Sat, 28 Apr 2018, at 22:07, reiner otto wrote:
> 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
> 
> 
> _______________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard

  reply	other threads:[~2018-04-28 13:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <570542680.2946509.1524910065103.ref@mail.yahoo.com>
2018-04-28 10:07 ` reiner otto
2018-04-28 13:49   ` Eric Light [this message]
2018-04-28 19:07     ` Eddie
2018-04-29 15:19       ` Eric Light
     [not found] <1277744751.3560998.1525035892916.ref@mail.yahoo.com>
2018-04-29 21:04 ` reiner otto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1524923360.509743.1353883656.6A466327@webmail.messagingengine.com \
    --to=eric@ericlight.com \
    --cc=augustus_meyer@yahoo.de \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).