码迷,mamicode.com
首页 > 系统相关 > 详细

linux iptables 备忘

时间:2015-01-09 17:37:51      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:linux iptables

  1. 内网机器上网

    iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j SNAT -to-source 10.0.0.1

    or

    iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE


  2. 外部到内部映射

    端口映射

    iptables -t nat -A PREROUTING -d 10.0.0.1 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.100:80     

    IP 1v1

    iptables -t nat -A PREROUTING -d 10.0.0.2 -j DNAT --to-destination 192.168.1.100

    iptables -t nat -A POSTROUTING -s 192.168.1.100 -j SNAT --to-source 10.0.0.2

linux iptables 备忘

标签:linux iptables

原文地址:http://xiaowei8.blog.51cto.com/2323881/1601153

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!