当前位置:   article > 正文

iptables防火墙配置_配置iptables

配置iptables

1、iptables防火墙安装

  1. # yum install iptables -y
  2. # yum install iptables-service -y

2、配置文件

# /etc/sysconfig/iptables

3、示例

  1. # sample configuration for iptables service
  2. # you can edit this manually or use system-config-firewall
  3. # please do not ask us to add additional ports/services to this default configuration
  4. *filter
  5. :INPUT ACCEPT [0:0]
  6. :FORWARD ACCEPT [0:0]
  7. :OUTPUT ACCEPT [0:0]
  8. -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  9. -A INPUT -i lo -j ACCEPT
  10. -A INPUT -s 192.168.1.0/24 -p tcp -m multiport --dports 10001,10002,10003 -j ACCEPT
  11. -A INPUT -m iprange --src-range 192.168.1.1-192.168.1.254 -j ACCEPT
  12. -A INPUT -s 192.168.1.1/32 -j ACCEPT
  13. -A INPUT -p tcp -m tcp --dport 10004 -j ACCEPT
  14. -A INPUT -p tcp -m tcp -j drop
  15. -A INPUT -p udp -j drop
  16. -A INPUT -j REJECT --reject-with icmp-host-prohibited
  17. -A FORWARD -j REJECT --reject-with icmp-host-prohibited
  18. #禁用timestamp报文
  19. -A INPUT -p ICMP --icmp-type timestamp-request -j DROP
  20. -A INPUT -p ICMP --icmp-type timestamp-reply -j DROP
  21. #禁用Time Exceeded报文
  22. -A INPUT -p ICMP --icmp-type time-exceeded -j DROP
  23. -A OUTPUT -p ICMP --icmp-type time-exceeded -j DROP
  24. COMMIT

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
  

闽ICP备14008679号