centos 7 配置防火墙 firewalld

来源:互联网 发布:穿衣服搭配软件 编辑:程序博客网 时间:2024/06/05 01:02

centos 7 x64 装了 neo4j 想用其它机器访问,无奈一直被拒绝,后来发现是防火墙启用了。

systemctl status firewalld

可以查看防火墙状态。

现在为 neo4j 添加服务

拷贝一个配置文件作为 neo4j 的服务样例文件,然后进行修改。 如使用ssh.xml

cp /usr/lib/firewalld/services/ssh.xml /usr/lib/firewalld/services/neo4j.xml

然后修改 neo4j.xml

<?xml version="1.0" encoding="utf-8"?><service>  <short>SSH</short>  <description>Secure Shell (SSH) is a protocol for logging into and executing commands on remote machines. It provides secure encrypted communications. If you plan on accessing your machine remotely via SSH over a firewalled interface, enable this option. You need the openssh-server package installed for this option to be useful.</description>  <port protocol="tcp" port="22"/></service>

改为:

<?xml version="1.0" encoding="utf-8"?><service>  <short>neo4j-web</short>  <description>neo4j http https</description>  <port protocol="tcp" port="7474"/>  <port protocol="tcp" port="7473"/></service>

重新加载 firewall 服务配置

firewall-cmd --reload

然后添加服务

firewall-cmd --zone=public --add-service=neo4j

More detail see ref.

[1] https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7

0 0