I have a router with 1 network interface (eth0, public ip) and an alias for eth0:0, local ip 192.168.1.1.
I want to redirect all incoming https (443) traffic to another server. I tried it with
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -m conntrack --ctstate NEW -j DNAT --to-destination 192.168.1.2:443 and it works. All traffic coming to my public ip's ssl port is redirected to 192.168.1.2.
But the main problem is this; now all https traffic from my local lan to the internet is also redirected to that local ip, eg. https://facebook.com and 192.168.1.2 answers. How should I fix my configuration in order to make it work?