wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
From: "Ivan Labáth" <labawi-wg@matrix-dream.net>
To: Raffaele Spazzoli <rspazzol@redhat.com>
Cc: wireguard@lists.zx2c4.com
Subject: Re: what to do when the peers use different IPs to transmit and receive
Date: Tue, 25 Sep 2018 21:16:36 +0000	[thread overview]
Message-ID: <20180925211636.GB23521@matrix-dream.net> (raw)
In-Reply-To: <CACOeLqLB8zbarowwTZFrxTkHyAk=B_cT_OruWDwAi6FvHjGi-Q@mail.gmail.com>

Hi,

I guess SNAT-ing on the destination node should work.

Still, without a compelling use case, it seems
like a broken network to me. You will have packets
in transit with an unroutable/incorrect source address,
among other possible issues. ICMP signalling won't work.
I think TCP wouldn't work with such a setup, or even
most udp protocols.

Do you use other services over this type of network?

Also, please note that iptables rules can affect network performance,
especially if there are many of them and haphazardly placed.
For debugging iptables rules I would suggest adding -v, so you can see
the number of matched packets (caveats apply in NAT).

Regards,
Ivan Labáth


On Mon, Sep 17, 2018 at 07:10:05AM -0400, Raffaele Spazzoli wrote:
> Ivan,
> 
> sorry for the formatting, it seemed right on my email editor (gmail).
> I cannot do SNAT at the source because the packet would be dropped if it
> didn't come from the actual IP of the VM.
> So I am doing SNAT at the destination. why do you say I am doing it wrong?
> I know it would be ideal to do it at the source, but should it work when
> done at the destination?
> 
> Thanks,
> Raffaele
> 
> Raffaele Spazzoli
> Senior Architect - OpenShift <https://www.openshift.com>, Containers
> and PaaS Practice <https://www.redhat.com/en/services/consulting/paas>
> Tel: +1 216-258-7717
> 
> 
> 
> On Mon, Sep 17, 2018 at 5:16 AM, Ivan Labáth <labawi-wg@matrix-dream.net>
> wrote:
> 
> > On Sun, Sep 16, 2018 at 07:08:58PM -0400, Raffaele Spazzoli wrote:
> > > sh-4.2# iptables -t nat -n -L Chain PREROUTING (policy ACCEPT) target
> > prot
> > > opt source destination Chain INPUT (policy ACCEPT) target prot opt source
> > > destination SNAT udp -- 10.128.2.10 0.0.0.0/0 udp dpt:5555 to:
> > > 192.168.99.12:5555 SNAT udp -- 10.128.1.94 0.0.0.0/0 udp dpt:5555 to:
> > > 192.168.99.14:5555 SNAT udp -- 10.130.0.136 0.0.0.0/0 udp dpt:5555 to:
> > > 192.168.99.13:5555 SNAT udp -- 10.129.1.158 0.0.0.0/0 udp dpt:5555 to:
> > > 192.168.99.15:5555 SNAT udp -- 10.131.0.199 0.0.0.0/0 udp dpt:5555 to:
> > > 192.168.99.7:5555 SNAT udp -- 10.129.2.217 0.0.0.0/0 udp dpt:5555 to:
> > > 192.168.99.6:5555 Chain OUTPUT (policy ACCEPT) target prot opt source
> > > destination Chain POSTROUTING (policy ACCEPT) target prot opt source
> > > destination
> >
> > Please try to have no or reasonable line wrapping.
> >
> > If you are applying SNAT on your source node, you are setting
> > the source address, which should be set to the reachable address
> > for the replies to come to. In your case VIP.
> > If you are setting it on the destination, you are IMO doing it wrong.
> >
> > Same thing applies to TCP and most typical protocol, nothing special
> > about wireguard here.
> >
> > If you have a middlebox doing DNAT, it would normaly be expected
> > for it or something else to do SNAT in the reverse direction.
> > Or, if your node has both adresses assigned, then it might be
> > a case of improperly set source address on outgoing packets
> > (e.g. your routing might need tuning).
> >
> > Regards,
> > Ivan
> > _______________________________________________
> > WireGuard mailing list
> > WireGuard@lists.zx2c4.com
> > https://lists.zx2c4.com/mailman/listinfo/wireguard
> >
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

      reply	other threads:[~2018-09-25 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-16 12:21 what to do when the peers use different IPs to transmit and receive Raffaele Spazzoli
2018-09-16 16:54 ` Ivan Labáth
2018-09-16 18:56   ` Raffaele Spazzoli
2018-09-16 23:08     ` Raffaele Spazzoli
2018-09-17  9:16       ` Ivan Labáth
2018-09-17 11:10         ` Raffaele Spazzoli
2018-09-25 21:16           ` Ivan Labáth [this message]

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=20180925211636.GB23521@matrix-dream.net \
    --to=labawi-wg@matrix-dream.net \
    --cc=rspazzol@redhat.com \
    --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).