반응형
Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

멍청해서 기록한다

리눅스 firewall 방화벽 포트 열기 , 닫기 본문

OS/Linux

리눅스 firewall 방화벽 포트 열기 , 닫기

개발근로자 2019. 11. 21. 14:45
반응형

참고로 과거버전은 iptables사용, 현재는 firewalld

현재 iptables를 전혀 배제한 것은 아니긴함 뭐 어쨋든간에 넘어가서

 

방화벽은 명령어 때려서 오픈, 차단할 수 있긴한데 아래 방법이 편함

아주 그냥 저 삽같은 방화벽 샛기놈 때문에 머리카락 빠지는 줄.. 아 이미 빠졌구나

 

vi /etc/firewalld/zones/public.xml 명령 수행하고

 

<?xml version="1.0" encoding="utf-8"?>

<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="dhcpv6-client"/>
  <service name="http"/>
  <service name="https"/>
  <port protocol="tcp" port="8080"/>
  <port protocol="tcp" port="10000-11000"/>
  <rule family="ipv4">
    <source address="ssh접근을가능하게할 ip주소"/>
    <service name="ssh"/>
    <accept/>
  </rule>

  <rule family="ipv4">

    <source address="모든접근을 차단할 ip주소"/>

    <reject/>

  </rule>  
</zone>

 

수정 후 저장후 로드

 

firewall-cmd --reload

 

삽같은 firewall이 죽어있으면

systemctl start firewalld

1회성이 아닌 계속 실행되게 하려면

systemctl enable firewalld

방화벽 해제

systemctl stop firewalld

방화벽 미적용

systemctl disable firewalld

방화벽 상태확인

systemctl status firewalld

firewall-cmd --state

 

출처: https://blanche-star.tistory.com/entry/centos7-%EB%B0%A9%ED%99%94%EB%B2%BD-firewall-%EB%8C%80%EC%B6%A9-%EC%9B%90%ED%95%98%EB%8A%94%EA%B1%B0-%EB%B0%94%EB%A1%9C%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0

 

centos7 방화벽 firewall 대충 원하는거 바로적용하기

개인적으로 firewall가 기존의 iptable보다 훨씬 복잡하다. 물론 다양한명령어를 나름(?)의 쉬운 커맨드명령어로 치게해주는건 좋은데 복잡한건 같으며 차라리 인터넷의 예제를 보고 iptable의 파일을 수정하는게..

blanche-star.tistory.com

 

반응형

'OS > Linux' 카테고리의 다른 글

리눅스(Linux) 문자 추출  (0) 2019.12.16
리눅스 iptables 명령어  (0) 2019.11.21
리눅스 파일 머지 방법  (0) 2019.11.21
리눅스 디렉토리, 파일 개수 확인  (0) 2019.11.21
리눅스 파일 하나 여러개 복사  (0) 2019.11.21