Chinaunix首页 | 论坛 | 博客
  • 博客访问: 496967
  • 博文数量: 111
  • 博客积分: 3160
  • 博客等级: 中校
  • 技术积分: 1982
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-24 11:49
个人简介

低调、勤奋。

文章分类

全部博文(111)

文章存档

2014年(2)

2013年(26)

2012年(38)

2011年(18)

2010年(27)

分类: LINUX

2012-07-22 08:17:15

=======外网访问内网 –J DNAT=====

DNAT
only valid in PREROUTING
--to-destination ipaddr[-ipaddr][:port-port]
DNAT:目的网络地址转换,重写包的目的IP地址
典型的DNAT的例子
外部访问ip:192.168.1.2
内部转发ip:192.168.1.1

#清除预定表filter中,所有规则链中的规则
iptables -F
#清除预定表filter中,使用者自定链中的规则
iptables -X

#清除预定表mangle中,所有规则链中的规则
iptables -F -t mangle
#清除预定表mangle中,使用者自定链中的规则
iptables -X -t mangle

#清除nat表中的规则
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat

//设置全部接受
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -t nat -A PREROUTING -d 192.168.1.2 -p tcp --dport 21 -j DNAT --to 192.168.1.1
iptables -t nat -A PREROUTING -d 192.168.1.2 -p tcp --dport 80 -j DNAT --to 192.168.1.1
阅读(1017) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~