zoukankan      html  css  js  c++  java
  • iptables配置实例

    iptables -t nat -A PREROUTING -p tcp -m tcp --dport 12360 -j DNAT --to-destination 172.16.144.180:3306
    iptables -t nat -A PREROUTING -p tcp -m tcp --dport 10086 -j DNAT --to-destination 172.16.144.180:22


    iptables -P INPUT DROP
    iptables -P OUTPUT DROP
    iptables -P FORWARD DROP

    iptables -A INPUT -p tcp --dport 10086 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 10086 -j ACCEPT


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

    iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 3306 -j ACCEPT

    iptables -A INPUT -p tcp --dport 3308 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 3308 -j ACCEPT

    iptables -A INPUT -p udp --dport 3308 -j ACCEPT
    iptables -A OUTPUT -p udp --sport 3308 -j ACCEPT

    service iptables save

    cat  /etc/sysconfig/iptables


    systemctl restart iptables


    # Generated by iptables-save v1.4.21 on Wed Oct 24 20:44:06 2018
    *nat
    :PREROUTING ACCEPT [1:44]
    :INPUT ACCEPT [0:0]
    :OUTPUT ACCEPT [200:13724]
    :POSTROUTING ACCEPT [1:124]
    -A PREROUTING -p tcp -m tcp --dport 10086 -j DNAT --to-destination 172.16.144.180:22
    -A PREROUTING -p tcp -m tcp --dport 12360 -j DNAT --to-destination 172.16.144.180:3306
    COMMIT
    # Completed on Wed Oct 24 20:44:06 2018
    # Generated by iptables-save v1.4.21 on Wed Oct 24 20:44:06 2018
    *filter
    :INPUT DROP [0:0]
    :FORWARD DROP [0:0]
    :OUTPUT DROP [0:0]
    -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
    -A INPUT -p tcp -m tcp --dport 10086 -j ACCEPT
    -A INPUT -p tcp -m tcp --dport 12360 -j ACCEPT
    -A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT
    -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT
    -A OUTPUT -p tcp -m tcp --sport 10086 -j ACCEPT
    -A OUTPUT -p tcp -m tcp --sport 12360 -j ACCEPT
    -A OUTPUT -p tcp -m tcp --sport 3306 -j ACCEPT
    COMMIT

  • 相关阅读:
    LINUX常见服务列表
    xinetd服务管理
    System V启动脚本启动的服务
    linux系统服务
    proc文件系统
    sar网络统计数据
    sar磁盘I/O统计数据
    sar-CPU统计数据
    linux性能监视工具sar
    考试认证
  • 原文地址:https://www.cnblogs.com/shiji888/p/10995067.html
Copyright © 2011-2022 走看看