CentOS 7.6에서 iptables 상태를 확인하는 방법

CentOS 7.6에서 iptables 상태를 확인하는 방법

CentOS Linux release 7.6.1810 (Core)다음과 같이 iptables 상태를 확인할 때:

[miao@MeowK8SSlave4 ~]$ service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.

상태를 성공적으로 확인하는 방법은 무엇입니까?

답변1

현재 방화벽 상태만 확인하려는 경우 firewalld systemdCentOS 7에서 이 서비스가 이를 처리할 것입니다(설치 시 기본 설정 중 일부를 변경하지 않은 경우).

서비스 상태를 쿼리하려면 다음을 수행할 수 있습니다.

# systemctl status firewalld

방화벽을 중지하려면 다음을 수행할 수 있습니다.

# systemctl stop firewalld

영구적으로 비활성화하려면 다음을 수행할 수 있습니다( 반대의 작업을 수행하려면 disable로 바꾸십시오).enable

# systemctl disable firewalld

또한 이 firewall-cmd명령을 사용하여 현재 방화벽 구성에 대한 보다 구체적인 정보를 탐색하고 찾을 수도 있습니다. 예를 들어 방화벽이 실행 중인지 확인하려면

# firewall-cmd --state

이것Red Hat 방화벽 문서서비스가 명령에 연결되는 방법을 보여주는 멋진 다이어그램이 있습니다 iptables( firewalld그러나 동시에는 아님) iptables. 문서에는 다음을 설명하는 페이지도 있습니다.둘 사이의 차이점iptables대신 해당 서비스를 사용하도록 시스템을 구성하는 방법을 알아보세요 firewalld.

답변2

iptables.service패키지의 일부입니다 iptables-services.

# yum whatprovides /usr/lib/systemd/system/iptables.service 
[...]
iptables-services-1.4.21-34.el7.x86_64 : iptables and ip6tables services for iptables
Repo        : base
Matched from:
Filename    : /usr/lib/systemd/system/iptables.service

그러나 iptables패키지가 설치되어 있는 동안에는 활성 iptables 구성을 계속 유지할 수 있습니다. 를 이용하여 확인할 수 있습니다 iptables --list.

답변3

CentOS에서 iptables 서비스 상태를 확인할 수 있습니다.

sudo systemctl status iptables
sudo systemctl status ip6tables

서비스가 아직 시작되지 않은 경우 다음을 수행하여 시작할 수 있습니다.

sudo systemctl start iptables
sudo systemctl start ip6tables

관련 정보