linux系统服务定义在usr/lib/firewalld/services目录下,里面有xml文档,不懂写法的可以复制一个参考着写。
然后我们把文档复制到/etc/firewalld/services目录下,如killvirus.xml:
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>killvirus</short>
<description>killvirus needs open 8000 and 9000 port, It is a two-way port(or mirror port)</description>
<port protocol="tcp" port="8000"/><port protocol="tcp" port="9000-9003"/>
</service>
然后,加服务:firewall-cmd --permanent --add-service=killvirus