firewalld自定义服务名及端口

本文详细介绍了Linux系统自带的firewalld服务及其目录结构,包括默认配置和服务管理,并展示了如何在自定义目录中创建和管理额外服务,以简化端口管理流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

系统自带的服务在此目录:

[root@engine ~]# cd /usr/lib/firewalld/services/
[root@engine services]# ls
amanda-client.xml  high-availability.xml  kpasswd.xml      mysql.xml      pop3s.xml           smtp.xml
bacula-client.xml  https.xml              ldaps.xml        nfs.xml        postgresql.xml      ssh.xml
bacula.xml         http.xml               ldap.xml         ntp.xml        proxy-dhcp.xml      telnet.xml
dhcpv6-client.xml  imaps.xml              libvirt-tls.xml  openvpn.xml    radius.xml          tftp-client.xml
dhcpv6.xml         ipp-client.xml         libvirt.xml      pmcd.xml       RH-Satellite-6.xml  tftp.xml
dhcp.xml           ipp.xml                mdns.xml         pmproxy.xml    rpc-bind.xml        transmission-client.xml
dns.xml            ipsec.xml              mountd.xml       pmwebapis.xml  samba-client.xml    vnc-server.xml
ftp.xml            kerberos.xml           ms-wbt.xml       pmwebapi.xml   samba.xml           wbem-https.xml
[root@engine services]# cat ssh.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>
[root@engine services]# 


自定义的服务放在此目录:

[root@engine ~]# cd /etc/firewalld/services/
[root@engine services]# ls
ovirt-fence-kdump-listener.xml  ovirt-http.xml  ovirt-postgres.xml         ovirt-websocket-proxy.xml
ovirt-https.xml                 ovirt-nfs.xml   ovirt-vmconsole-proxy.xml
[root@engine services]# cat ovirt-nfs.xml 
<?xml version="1.0" encoding="utf-8"?>
<service>
    <short>ovirt-nfs</short>
    <description>oVirt configured nfs service</description>
    <port protocol="tcp" port="111"/>
    <port protocol="udp" port="111"/>
    <port protocol="tcp" port="662"/>
    <port protocol="udp" port="662"/>
    <port protocol="tcp" port="875"/>
    <port protocol="udp" port="875"/>
    <port protocol="tcp" port="892"/>
    <port protocol="udp" port="892"/>
    <port protocol="tcp" port="2049"/>
    <port protocol="udp" port="32769"/>
    <port protocol="tcp" port="32803"/>
</service>
[root@engine services]# 


如此比手动一个一个添加端口要方便些,也便于管理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值