<div dir="ltr"><div dir="ltr"><div dir="ltr">On Thu, Mar 14, 2019 at 3:58 PM cmp <<a href="mailto:me@cmp.is">me@cmp.is</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We have a bastion host at work which is like several others we have. It has OpenVPN and OpenSSH which we’re allowed to access. The machine acts as a gateway to access several other private subnets. It uses an iptables rule like this<br>
<br>
iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -i ens3 -j MASQUERADE<br>
<br>
Last night we setup a new host with WireGuard using systemd-networkd v241 and wanted to setup these masquerade rules, but we couldn’t actually figure out how to do them.<br>
<br>
We stumbled across RouteRulePolicy, but I have a feeling is we don’t really understand how to do what we did in iptables in iproute2 so we kept banging our heads and eventually I gave up and simply ran the iptables commands myself and it worked, but I’d like to actually do this correctly inside systemd networkd.<br></blockquote><div><br></div><div>Policy routing rules are not firewall rules.</div><div><br></div><div>You can enable masquerading using IPMasquerade=yes in ens3.network, but that's the only iptables feature that networkd ever configures. It does not support adding arbitrary iptables rules.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div></div>