开启防火墙后,确认ssh端口是否开放(firewall-cmd --query-port=22/tcp
),若未开放则开放。(firewall-cmd --permanent --add-port=22/tcp``firewall-cmd --reload
)
-
开启防火墙
service firewalld start
-
查看3306端口是否开放
firewall-cmd --query-port=3306/tcp
-
关闭3306端口
firewall-cmd --permanent --remove-port=3306/tcp
firewall-cmd --reload
-
设置特定IP可以访问3306端口
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=x.x.x.x port port=3306 protocol=tcp accept"
firewall-cmd --reload