열려는 파일을 firewalld
열라 는 몇 가지 명령을 보냈습니다 . 열려 있는 것으로 표시되지만 해당 IP가 존재하지 않습니다.PostgreSQL
port 5432
nmap
localhost4
192.168.1.23
sniffing ports 0-10000 on 192.168.1.23...
Starting Nmap 7.91 ( https://nmap.org ) at 2022-07-18 12:12 EDT
Nmap scan report for neb.local (192.168.1.23)
Host is up (0.0000060s latency).
Not shown: 10000 closed ports
PORT STATE SERVICE
22/tcp open ssh
Nmap done: 1 IP address (1 host up) scanned in 0.19 seconds
sniffing ports 0-10000 on localhost4...
Starting Nmap 7.91 ( https://nmap.org ) at 2022-07-18 12:12 EDT
Nmap scan report for localhost4 (127.0.0.1)
Host is up (0.0000060s latency).
rDNS record for 127.0.0.1: localhost
Not shown: 9999 closed ports
PORT STATE SERVICE
22/tcp open ssh
5432/tcp open postgresql
Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds
해당 IP에서 이 포트를 볼 수 없고 192.168.1.24
다른 상자()에 열려 있는 것 같습니다.
Starting Nmap 7.70 ( https://nmap.org ) at 2022-07-18 12:37 EDT
Nmap scan report for neb.local (192.168.1.23)
Host is up (0.00034s latency).
PORT STATE SERVICE
5432/tcp closed postgresql
MAC Address: D0:50:99:87:7B:4A (ASRock Incorporation)
Nmap done: 1 IP address (1 host up) scanned in 0.49 seconds
어떻게 작동하게 할 수 있나요? firewalld
지침은 다음과 같습니다 .
sudo firewall-cmd --zone=public --permanent --add-service=postgresql
sudo firewall-cmd --zone=public --permanent --add-port 5432/tcp
sudo firewall-cmd --permanent --add-source=192.168.1.24
sudo firewall-cmd --permanent --add-user1-rule='rule family="ipv4" source address="192.168.1.24" port protocol="tcp" port="5432" accept'
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s25
sources: 192.168.1.24
services: cockpit dhcpv6-client postgresql ssh
ports: 5432/tcp
protocols:
forward: yes
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule family="ipv4" source address="192.168.1.24" port port="5432" protocol="tcp" accept