DNAT+SNAT

Started by HatalaTitla48, September 29, 2021, 11:16:18 PM

Previous topic - Next topic
I have group of intranet IPs 192.168.0.80-192.168.0.90. If pc with ip from this range make a request for WAN-IP address, it should be redirected to internal ip 192.168.0.20. With iptables, solution is this:

iptables -t nat -A PREROUTING -i $LAN_IF -m iprange --src-range 192.168.0.80-192.168.0.90 -p tcp -d $WAN_IP --dport 443 -j DNAT --to 192.168.0.20:443                                                                                                       
iptables -t nat -A POSTROUTING -m iprange --src-range 192.168.0.80-192.168.0.90 -p tcp -d 192.168.0.20 --dport 443 -j SNAT --to-source $WAN_IP

How do I achive this with opnsense?