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
  • 相关阅读:
    Controller返回值string、mv等区别
    CA证书目的和详细演化过程
    HashMap和Hashtable的区别
    操作系统-IO管理疑难点
    IO核心子系统
    操作系统-IO管理概述
    文件管理疑难点
    磁盘组织与管理
    文件系统实现
    文件系统基础
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13679701.html
Copyright © 2011-2022 走看看