zoukankan      html  css  js  c++  java
  • 常用iptables规则整理

    1、仅允许内部合法的IP地址访问服务器

    #setting access rules
    #one,in access rules,allow all the ips of hudong.com
    iptables -A INPUT -s 192.168.3.3/24 -p all -j ACCEPT
    iptables -A INPUT -s 192.168.4.4/24 -p all -j ACCEPT
    ........
     
    2、仅允许内部合法IP段访问监控服务nagios
    #second,port access rules
    #nagios
    iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 5666 -j ACCEPT
    .......
     
    3、仅允许内部合法的IP段访问Mysql和ORACLE数据库
    iptables -A INPUT -s 192.168.4.4/24 -p tcp --dport 3306 -j ACCEPT
    ........
     
    4、仅允许内部合法的IP段访问SSH远程连接服务
    #ssh difference form other servers hers
    iptables -A INPUT -p tcp -s 192.168.1.0/24 --dport 45215 -j ACCEPT
    ......
    (注意:SSH端口最好改为其他端口。还有,最好只让内部网络可以连接)
     
    5、对HTTP服务的不同限制
    a、对外提供HTTP服务的业务,要允许HTTP服务通过,并且不限制IP。
    #http
    iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    .......
    b、对内提供HTTP服务的业务,一般用特殊端口,并且限制合法IP连接或VPN连接。
    iptables -A INPUT -s 192.168.1.0/24 -p tcp -m multiport --dport 8080,8081,8082,8888 -j ACCEPT
    ........
    5、SNMP的限制
    #snmp
    iptables -A INPUT -s 192.168.1.0/24 -p UDP --dport 161 -j ACCEPT
    ......
     
    6、rsync服务的限制策略
    #rsync
    iptables -A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 873 -j ACCEPT
    .......
     
    7、ftp服务限制
    #others RELATED
    #ftp
    #iptables -A INPUT -p tcp --dport 20:21 -j ACCEPT(这里不兴允许21端口,也要允许20号端口)
    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    说明:
    iptables -A INPUT -m state --state 状态 -j ACCEPT
    state
        this module,when combined with connection tracking,allows access to the connection tracking state for this packet.
     
     
     
     
     
     
     
     
  • 相关阅读:
    ES6之主要知识点(二) 变量的解构赋值。默认值
    ES6之主要知识点(一)
    前后端通信
    js 面向对象类
    typeof 、Object.prototype.toString和 instanceof
    原型链 之 对象的创建
    Ueditor1.4.3.3+springMvc+maven 实现图片上传
    Hibernate 根据实体名称得到DB表名以及表对应的Sequence name
    第三章:对象的共享——java并发编程实战
    第二章:线程安全性——java并发编程实战
  • 原文地址:https://www.cnblogs.com/TaleG/p/5352303.html
Copyright © 2011-2022 走看看