HI everybody,
I'm trying to set up redirection rules. I have privacy violating IoT devices for whom I want to cut WAN access, however there is one service that is really needed, but which I can host myself. Using iptables, I would write something like
iptables -t nat -A PREROUTING -p tcp --dport ${wkp} -j DNAT --to-destination ${server_IP}
iptables -t nat -A POSTROUTING -p tcp --dport ${wkp} -j SNAT --to-source ${gateway_IP}
Here, wkp is the service's well known port, server_IP is the node hosting the service, while gateway_IP is the interface of the OpenWRT router that I'm setting up, facing the server. I'd prefer to use the Luci firewall module for maintainability. After some searching around I came to the conclusion that I have to split up the DNAT and SNAT actions: While the former seems to need an entry under the Ports Forwards tab, the latter apparently needs to go to NAT Rules.
My first question is: Is this the correct way to do this?
There is a host on my network that needs to be exempt from these rules. Using iptables, I'd add
! -s ${exempt_IP}
to the matching section of those rules, i.e. an inverted match for the source IP address. The Luci interface seems not to support match inversion?
My second question therefore is: How to set up match inversion using Luci?
Cheers Peter