firewalld opens the specified port to the specified IP

1. Add firewall rules (open designated ports to designated ip)

Add firewall rules

// Postgresql端口设置。允许192.168.142.166访问5432端口
# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port port="5432" protocol="tcp" accept"

// redis端口设置。允许192.168.142.166访问6379端口
# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port port="6379" protocol="tcp" accept"

// beanstalkd端口设置。允许192.168.142.166访问11300端口
# firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port port="11300" protocol="tcp" accept"

Reload the firewall to make the configuration effective

# firewall-cmd --reload   

View configuration results, verify configuration

# firewall-cmd --list-all

2. Delete firewall rules

# firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.142.166" port port="11300" protocol="tcp" accept"

Restart the firewall to make the configuration effective

# systemctl restart firewalld.service

View configuration results, verify configuration

# firewall-cmd --list-all

3. Reference articles

https://blog.csdn.net/laotoumo/article/details/88036400

Guess you like

Origin blog.csdn.net/yjk13703623757/article/details/106720217