Firewalld - 숫자로 된 방화벽 포트 번호가 서비스 이름에 매핑되는 위치는 어디입니까?

Firewalld - 숫자로 된 방화벽 포트 번호가 서비스 이름에 매핑되는 위치는 어디입니까?
# firewall-cmd --permanent --add-service=nfs
# filewall-cmd --permanent --add-service=rpc-bind

RHEL/CentOS 7.9에서 위와 같이 하면 방화벽에서 어떤 숫자 포트 번호가 열리나요?

방화벽 포트 번호에 대한 서비스 이름(예: rpc-bind) 매핑은 어디에 정의되어 있습니까?

/etc/firewalld/zones/myzone.xml궁극적으로 모든 것이 다음과 같이 귀결된다고 믿는 것이 옳습니까 ?

그것은 또는 숫자 tcp입니까 ?udp

# sshd
  <port protocol="tcp" port="22"/>
# nfs
  <port protocol="tcp" port="2049"/>
  <port protocol="udp" port="2049"/>

답변1

핵심요약: Firewalld로 컴파일되었습니다. 소스 코드를 참조하세요.

긴 답변: 한번 살펴보세요Firewalld 소스 코드 저장소의 README.

사용되는 모든 서비스는 firewalld디렉토리의 xml 파일에 정의되어 있습니다 config/services. 예를 들어 이 rpc-bind.xml파일에는 다음이 포함됩니다.

편집하다:rhel/centos 7에서는 이 위치가 /usr/lib/firewalld/servicesxml 파일에 사용됩니다.

<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>rpc-bind</short>
  <description>Remote Procedure Call Bind</description>
  <port protocol="tcp" port="111"/>
  <port protocol="udp" port="111"/>
</service>

rpc-bind를 tcp 및 udp 포트 111에 고정합니다. 마찬가지로 NFS( nfsv4)는 다음과 같습니다.

<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>NFS4</short>
  <description>The NFS4 protocol is used to share files via TCP networking. You will need to have the NFS tools installed and properly configure your NFS server for this option to be useful.</description>
  <port protocol="tcp" port="2049"/>
</service>

NFSv3( nfs3)과 유사:

<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>NFS3</short>
  <description>The NFS3 protocol is used to share files. You will need to have the NFS tools installed and properly configure your NFS server for this option to be useful.</description>
  <port protocol="tcp" port="2049"/>
  <port protocol="udp" port="2049"/>
</service>

SSH에 대해서도 질문하셨습니다.

<?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 정의는 Firewalld로 컴파일됩니다.

관련 정보