手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

RHEL5.4 iptables配置详解

[日期:2010-04-09] 来源:Linux社区  作者:naruto6006 [字体: ]

六:利用iptables实现DNAT
[root@client ~]# service httpd restart    //在client端配置好Apache服务器
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@client ~]# echo "just one test" > /var/www/html/index.html

[root@server ~]# service httpd status    //验证服务器端没有安装Apache服务
httpd: unrecognized service

RHEL5.4 iptables配置详解

//配置DNAT
[root@server ~]# iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.100.20
[root@server ~]# iptables -t nat -L -v PREROUTING     
Chain PREROUTING (policy ACCEPT 182 packets, 13431 bytes)
pkts bytes target     prot opt in     out     source               destination        
    0     0 DNAT       tcp -- any    any     anywhere             anywhere            tcp dpt:http to:192.168.100.20

RHEL5.4 iptables配置详解


[root@server ~]# iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-dest 192.168.100.200:3128     //iptables针对透明代理的配置
[root@server ~]# iptables -t nat -L OUTPUT -v      //查看配置   
Chain OUTPUT (policy ACCEPT 1 packets, 140 bytes)
pkts bytes target     prot opt in     out     source               destination        
    0     0 DNAT       tcp -- any    any     anywhere             anywhere            tcp dpt:http to:192.168.100.200:3128


[root@server ~]# lsmod |grep ip    //查看iptables所加载的模块,配置文件为/etc/sysconfig/iptables-config
ipt_MASQUERADE          7617 1
iptable_nat            11077 1
ip_nat                 21101 2 ipt_MASQUERADE,iptable_nat
ip_conntrack           53281 4 xt_state,ipt_MASQUERADE,iptable_nat,ip_nat
nfnetlink              10713 2 ip_nat,ip_conntrack
iptable_filter          7105 1
ip_tables              17029 2 iptable_nat,iptable_filter
ipt_REJECT              9665 0
ip6t_REJECT             9409 1
ip6table_filter         6849 1
ip6_tables             18053 1 ip6table_filter
…………………………………………………………

linux
相关资讯       iptables配置 
本文评论   查看全部评论 (2)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 2 楼
* Linux会员 发表于 2010/4/9 17:42:31
谢谢。
第 1 楼
* naruto6006 发表于 2010/4/9 17:10:25
sendmail配置今天刚出炉,赶紧转载吧,下周我就要考rhce了,但愿能过吧!rhce相关的文章将告一段落了,接下来要研究研究数据库了…