|
|
连外网的机器装的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什么地方不写好,请达人帮忙 ,谢谢! |
|