请教:写了iptables后,局域网的linux要加**才能上网,而里面的win没这个毛病
时间:2007-07-29
来源:互联网
连外网的机器装的debian4.0,内网有debian,ubuntu,windows,我的iptables如下 :
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -X
iptables -Z
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
#input chain
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -p all -j ACCEPT
#output chain
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#freeip load//试图只让免费ip通过
iptables -A OUTPUT -d 58.17.0.0/16 -j ACCEPT
iptables -A OUTPUT -d 58.18.0.0/15 -j ACCEPT
........
#forward chain
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -s 58.17.0.0/16 -j ACCEPT
iptables -A FORWARD -i eth0 -s 58.18.0.0/15 -j ACCEPT
.........
#nat
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to 1.2.3.4
启动iptable后,内网windows机器能上网,只访问免费ip好像也可以,奇怪的是里面的debian4.0 和ubuntu7.04都不能直接上,在firefox上加上**能上,不加**时看到下方在提示正在解析地址,请问我的iptable什么地方不写好,请达人帮忙 ,谢谢!
#!/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -X
iptables -Z
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
#input chain
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -p all -j ACCEPT
#output chain
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#freeip load//试图只让免费ip通过
iptables -A OUTPUT -d 58.17.0.0/16 -j ACCEPT
iptables -A OUTPUT -d 58.18.0.0/15 -j ACCEPT
........
#forward chain
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -s 58.17.0.0/16 -j ACCEPT
iptables -A FORWARD -i eth0 -s 58.18.0.0/15 -j ACCEPT
.........
#nat
iptables -F -t nat
iptables -X -t nat
iptables -Z -t nat
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to 1.2.3.4
启动iptable后,内网windows机器能上网,只访问免费ip好像也可以,奇怪的是里面的debian4.0 和ubuntu7.04都不能直接上,在firefox上加上**能上,不加**时看到下方在提示正在解析地址,请问我的iptable什么地方不写好,请达人帮忙 ,谢谢!
作者: zhengdsp 发布时间: 2007-07-29
引用:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to 1.2.3.4 |
或者干脆改成这样:
引用:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE |
作者: 高热 发布时间: 2007-07-29
很怀疑你的linux客户机网络设置有问题,请将客户机运行以下几条命令的输出贴出来看看:
route -n
ifconfig
cat /etc/resolv.conf
route -n
ifconfig
cat /etc/resolv.conf
作者: abby 发布时间: 2007-07-29
多谢!我刚找到毛病了,是我的DNS没设置好
作者: zhengdsp 发布时间: 2007-07-29
呵呵,lin都装了桌面,所以偷懒设DNS没用命令,导致出错,顺便请大家帮看看这个 iptable那些
地方待改进乃至不对的,谢谢!
地方待改进乃至不对的,谢谢!
作者: zhengdsp 发布时间: 2007-07-30
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28