'Ping'에 해당되는 글 1건

CentOS 7.x 방화벽 ping 막기



CentOS 7.x 대로 가면서 방화벽이 iptables 에서 firewalld 로 바뀌어서 적응이 잘 안된다.


일단 외부로 부터의 ping 을 막아보자. 그리고 서비스 포트 추가 및 방법에 대해서도 알아보도록 하자.


[root@conoha log]# firewall-cmd --permanent --zone=public --add-icmp-block=echo-request

success

[root@conoha log]# firewall-cmd --reload

success

[root@conoha log]# firewall-cmd --list-all

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client http ssh

  ports:

  masquerade: no

  forward-ports:

  icmp-blocks: echo-request

  rich rules:


--permanent 를 붙여야 재부팅 후에도 적용이 된다.


우선 서비스 삭제 하기


[root@conoha log]# firewall-cmd --list-all

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client http l2tpd pptp ssh

  ports: 443/tcp 10022/tcp 8080/tcp

  masquerade: yes

  forward-ports:

  icmp-blocks:

  rich rules:


[root@conoha log]# firewall-cmd --permanent --remove-service=l2tpd

success

[root@conoha log]# firewall-cmd --permanent --remove-service=pptp

success

[root@conoha log]# firewall-cmd --reload

success

[root@conoha log]# firewall-cmd --list-all

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client http ssh

  ports: 443/tcp 10022/tcp 8080/tcp

  masquerade: yes

  forward-ports:

  icmp-blocks:

  rich rules:


[root@conoha log]# firewall-cmd --permanent --remove-masquerade

success

[root@conoha log]# firewall-cmd --reload

success

[root@conoha log]# firewall-cmd --list-all

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client http ssh

  ports: 443/tcp 10022/tcp 8080/tcp

  masquerade: no

  forward-ports:

  icmp-blocks:

  rich rules:



그리고 masquerade 도 지워봤다.


이번엔 포트 추가 및 삭제


[root@conoha log]# firewall-cmd --permanent --zone=public --add-port=10001/tcp

success

[root@conoha log]# firewall-cmd --reload

success

[root@conoha log]# firewall-cmd --list-all

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client http ssh

  ports: 443/tcp 10022/tcp 8080/tcp 10001/tcp

  masquerade: no

  forward-ports:

  icmp-blocks: echo-request

  rich rules:


[root@conoha log]# firewall-cmd --permanent --zone=public --remove-port=10001/tcp

success

[root@conoha log]# firewall-cmd --reload

success

[root@conoha log]# firewall-cmd --list-all

public (default, active)

  interfaces: eth0

  sources:

  services: dhcpv6-client http ssh

  ports: 443/tcp 10022/tcp 8080/tcp

  masquerade: no

  forward-ports:

  icmp-blocks: echo-request

  rich rules:


위쪽이 추가, 아랫쪽이 삭제이다.



블로그 이미지

영은파더♥

가상서버호스팅 VPS 리눅스 서버관리 윈도우 IT

,