centos7 iptable 사용하기

//centos7 iptable 사용하기

centos7 iptable 사용하기

centos7에 적용된 firewalld 대신 기존 사용하던 iptables 를 사용하는 방법에 대한 글입니다.

## 버전확인 ##

[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

 

  1. firewalld 서비스 삭제
           #  systemctl status firewalld (서비스 상태 확인)
● firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since 수 2019-09-25 15:01:32 KST; 11min ago

# systemctl stop firewalld  (firewalld 중지)

# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.

# systemctl status firewalld (서비스 상태 확인)
● firewalld.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead) since 수 2019-09-25 15:21:35 KST; 1min 18s ago
Main PID: 765 (code=exited, status=0/SUCCESS)

# systemctl list-units | grep firewalld

 

2. iptables 서비스 설치

# yum -y install iptables-services (iptables 서비스 설치)

# systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.

# systemctl start iptables

# systemctl status iptables
● iptables.service – IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: active (exited) since 수 2019-09-25 15:45:41 KST; 26s ago
Process: 1886 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
Main PID: 1886 (code=exited, status=0/SUCCESS)

# systemctl list-units | grep iptables
iptables.service         loaded active exited IPv4 firewall with iptables

 

3. iptables 룰셋 적용

# vi /etc/sysconfig/iptables (iptables 룰셋 설정에 대해서는 블로그의 다른 글에 있습니다. )

 

By |2019-09-25T16:33:43+00:009월 25th, 2019|Categories: linux|Tags: , , , , |0 Comments

About the Author: