Centos6.9 설치 Iptables

993 단어
Iptables 설치yum -y install iptables
방화벽 구성
#      
chkconfig --level 345 iptables on

#      filter          
iptables -F
#      filter           
iptables -X
iptables -Z

#   icmp   ,     ping
iptables -A OUTPUT -p icmp -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
#   loopback!(     DNS         )
iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A OUTPUT -o lo -p all -j ACCEPT

#   SSH               
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT

iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT

#       
iptables -P INPUT DROP
iptables -A INPUT -j REJECT

#       
iptables -P OUTPUT DROP
iptables -A OUTPUT -j REJECT

#       
iptables -P FORWARD DROP
iptables -A FORWARD -j REJECT


#      
/etc/rc.d/init.d/iptables save
#     
service iptables restart

좋은 웹페이지 즐겨찾기