zoukankan      html  css  js  c++  java
  • iptables端口转发

    1.端口转发

    [root@m01 ~]# iptables -t nat -A PREROUTING -d 10.0.0.61 -p tcp --dport 5555 -j DNAT --to-destination 172.16.1.7:22
    
    [root@m01 ~]# iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -j SNAT --to-source 10.0.0.61

    2.IP转发

    [root@m01 ~]#iptables -t nat -A PREROUTING -d 10.0.1.61 -j DNAT --to-destination 172.16.1.7
    iptables -A FORWARD -i eth1 -s 172.16.1.0/24 -j ACCEPT
    iptables -A FORWARD -o eth0 -s 172.16.1.0/24 -j ACCEPT
    iptables -A FORWARD -i eth0 -d 172.16.1.0/24 -j ACCEPT
    iptables -A FORWARD -o eth1 -d 172.16.1.0/24 -j ACCEPT
    iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -j SNAT --to-source 10.0.0.61

    3.内部共享上网

    [root@m01 ~]#echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
    sysctl -p
    
    iptables -A FORWARD -i eth1 -s 172.16.1.0/24 -j ACCEPT
    iptables -A FORWARD -o eth0 -s 172.16.1.0/24 -j ACCEPT
    iptables -A FORWARD -i eth0 -d 172.16.1.0/24 -j ACCEPT
    iptables -A FORWARD -o eth1 -d 172.16.1.0/24 -j ACCEPT
    iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -j SNAT --to-source 10.0.0.61
  • 相关阅读:
    Enum.GetUnderlyingType(obj.GetType())
    Out,ref,params修饰符,可选参数,命名参数
    Linq
    var
    checked,unchecked
    StringBuilder.sb.AppendLine();
    js改变css样式的三种方法
    flex的用途
    clip-path
    json 对象 数组
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13679701.html
Copyright © 2011-2022 走看看