I'm trying to forward a port to an external IP using
firewall-cmd, but I need to deny access from certain ips.
To setup a port-forward of port
55500, I use:
firewall-cmd --permanent --zone=public --add-forward-port=port=55500:proto=tcp:toport=55500:toaddr=22.214.171.124
Which works fine, and users connecting to port
55500 are successfully redirected to
126.96.36.199 , but, as mentioned previously, I need to deny access to users coming from
188.8.131.52/24, for that I tried:
firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='184.108.40.206/24' reject"
firewall-cmd --permanent --zone=public --add-rich-rule='rule family=ipv4 source address=220.127.116.11/24 port port=55500 protocol=tcp reject'
firewall-cmd --zone=drop --add-source=18.104.22.168/24
But none of the commands above (all followed by
firewall-cmd --reload) worked, and users connecting to port
22.214.171.124 still get redirected to
How can I deny the port redirection based on the source IP?