Simple configuration with mail server with 993 imap port. Local IP is static natted at main router to public IP. I need to restrict access to 993 port by local lan and allow connection to imapl port by "special" myknown ports. Understand that source IP connecting to "special" ports are public. So I wonder can it be performed by local iptables or do I need to route "special" ports by other local host? What did I miss?
iptables -A INPUT -p tcp --dport 33333 -j ACCEPT iptables -A INPUT -p tcp --dport 33334 -j ACCEPT iptables -A INPUT -p tcp -s 192.168.0.0/24 --dport 993 -j ACCEPT iptables -A PREROUTING -t nat -p tcp --dport 33333 -j REDIRECT --to-port 993 iptables -A PREROUTING -t nat -p tcp --dport 33334 -j REDIRECT --to-port 993
I need to open ports 33333 and 33334 for internet and local lan and keep opened 993 port for local lan only.
33333 and 33334 ports are forwarded to 993.
Forwarding doesn't work in case 993 restricted:
Server has one ethernet interface.