-1

Port has been "opened" with following commnad:

firewall-cmd --permanent --zone=public --add-port=80/tcp --add-port=80/udp

Now the service on port 80 could be used by any IP in the whole world.

How I can restrict access to the service on the port 80 to a few IP ranges like this one 7.7.7.0/24 with firewall-cmd command?

Or should be used different approach to achieve needed result?

The service is running on RHEL 7.

1 Answers1

0

As the port has been already open that rule should be removed with following command firewall-cmd --permanent --zone=public --remove-port 80/tcp

To add rule for local network used following command:

firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.0.0/16" port protocol="tcp" port="7002" accept'

Similar to above command has been used to create rules for all IP address sub-nets assigned to my country.