From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: Sending just ssh traffic via wg
Date: Fri, 5 Oct 2018 17:41:32 +0200 [thread overview]
Message-ID: <CAHmME9rTRTs+yXDvf99wAcrHd4mOhjkmhN2a_uLRzQoiJ5_=Uw@mail.gmail.com> (raw)
In-Reply-To: <874le0d82v.fsf@toke.dk>
[-- Attachment #1.1: Type: text/plain, Size: 1102 bytes --]
On Fri, Oct 5, 2018, 12:03 Toke Høiland-Jørgensen <toke@toke.dk> wrote:
> "Jason A. Donenfeld" <Jason@zx2c4.com> writes:
>
> > Hey Konstantin,
> >
> > When you're doing policy routing with packets that are being forwarded
> > by the system -- a router, for example -- then the prerouting table is
> > sufficient. But for locally generated packets, you have to use the
> > OUTPUT table and also probably MASQUERADE. I just reproduced
> > everything here and confirm this works:
> >
> > ip route add default dev wg0 table 2468
> > ip rule add fwmark 1234 table 2468
> > wg set wg0 peer [...] allowed-ips 0.0.0.0/0
> > sysctl net.ipv4.conf.wg0.rp_filter=0
> > iptables -t nat -A POSTROUTING -p tcp --dport 22 -m addrtype
> > --src-type LOCAL -j MASQUERADE
> > iptables -t mangle -A OUTPUT -p tcp --dport 22 -j MARK --set-mark 1234
>
> Any reason why you can't just do
>
> ip rule add dport 22 lookup 2468
>
That's indeed the best by far as long as other netfilter fanciness isn't
desired. Probably should set ipproto to tcp too in the rule.
Jason
> ?
>
> -Toke
>
[-- Attachment #1.2: Type: text/html, Size: 1903 bytes --]
[-- Attachment #2: Type: text/plain, Size: 148 bytes --]
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard
next prev parent reply other threads:[~2018-10-05 15:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 15:53 Sending just ssh traffic via wg Konstantin Ryabitsev
2018-10-04 18:56 ` Jason A. Donenfeld
2018-10-05 10:03 ` Toke Høiland-Jørgensen
2018-10-05 15:41 ` Jason A. Donenfeld [this message]
2018-10-05 15:53 ` Konstantin Ryabitsev
2018-10-05 16:32 ` Matthias Urlichs
2018-10-05 21:01 ` Konstantin Ryabitsev
2018-10-05 17:34 ` Jason A. Donenfeld
[not found] <mailman.1.1538820001.22807.wireguard@lists.zx2c4.com>
2018-10-06 10:21 ` Brian Candler
2018-10-06 10:27 ` Roman Mamedov
2018-10-06 10:28 ` Brian Candler
2018-10-06 13:41 ` Konstantin Ryabitsev
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='CAHmME9rTRTs+yXDvf99wAcrHd4mOhjkmhN2a_uLRzQoiJ5_=Uw@mail.gmail.com' \
--to=jason@zx2c4.com \
--cc=toke@toke.dk \
--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).