firewalld Whitelist source IP addresses in CentOS 7
- Get link
- X
- Other Apps
70
I'd accomplish this by adding sources to a zone. First checkout which sources there are for your zone:
firewall-cmd --permanent --zone=public --list-sources
If there are none, you can start to add them, this is your "whitelist"
firewall-cmd --permanent --zone=public --add-source=192.168.100.0/24
firewall-cmd --permanent --zone=public --add-source=192.168.222.123/32
(That adds a whole /24
and a single IP, just so you have a reference for both a subnet and a single IP)
Set the range of ports you'd like open:
firewall-cmd --permanent --zone=public --add-port=1-3389/tcp
firewall-cmd --permanent --zone=public --add-port=1-3389/udp
This just does ports 1 through 22. You can widen this, if you'd like.
Now, reload what you've done.
firewall-cmd --reload
And check your work:
firewall-cmd --zone=public --list-all
- Get link
- X
- Other Apps
Comments
Post a Comment