LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 780|回复: 2

请大家帮我看看这个脚本问题出在哪里?

[复制链接]
发表于 2003-9-19 10:39:22 | 显示全部楼层 |阅读模式
#!/bin/sh
/sbin/modprobe ip_tables
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_ftp
/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -X
/sbin/iptables -Z
# zero all counters
# Policy for chains DROP everything
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p udp -d 192.168.0.1 --dport 53 -j DNAT --to 211.92.184.130:53

iptables -t nat -A POSTROUTING -s 0/0 -o eth0 -j SNAT -to wan_ip
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -s 0/0 -d 0/0 -j ACCEPT

echo "1">/proc/sys/net/ipv4/icmp_echo_ignore_all

/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -P OUTPUT ACCEPT

iptables -L -n

echo 7 > /proc/sys/net/ipv4/ip_dynaddr
echo "1">/proc/sys/net/ipv4/ip_forward

为什么我一运行,就会出现下面的错误:
modprobe: Can't locate module ip_tables
modprobe: Can't locate module ip_nat_ftp
modprobe: Can't locate module ip_conntrack_ftp
iptables: No chain/target/match by that name
': Table does not exist (do you need to insmod?)e `nat
Perhaps iptables or your kernel needs to be upgraded.
iptables: Table does not exist (do you need to insmod?)
iptables: Table does not exist (do you need to insmod?)
iptables: Bad policy name
iptables: Bad policy name
iptables: Bad policy name
: command not found
'ptables v1.2.6a: Invalid target name `MASQUERADE
Try `iptables -h' or 'iptables --help' for more information.
: command not found
'ad argument `211.92.207.82
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.2.6a: Invalid target name `MASQUERADE
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.2.6a: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
: command not found
: No such file or directorys/net/ipv4/icmp_echo_ignore_all
: command not found
: command not found
: command not found
: command not found
iptables: Bad policy name
iptables: Bad policy name
iptables: Bad policy name
: command not found
'ptables v1.2.6a: Unknown arg `-n
Try `iptables -h' or 'iptables --help' for more information.
: command not found
: No such file or directorys/net/ipv4/ip_dynaddr
: No such file or directorys/net/ipv4/ip_forward
发表于 2003-9-19 19:58:08 | 显示全部楼层
脚本没有问题,
是你的内核没有支持。
重新编译过内核 :ask
 楼主| 发表于 2003-9-19 21:25:59 | 显示全部楼层
内核不支持?
可是我用下面的脚本就可以呀?????
我用的是redhat8,内核没有动过,装好后用下面的脚本就可以
#!/bin/sh
/sbin/modprobe ip_tables
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_ftp
/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -X
/sbin/iptables -Z
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p udp -d 192.168.0.1 --dport 53 -j DNAT --to 211.92.184.130:53
iptables -t nat -A POSTROUTING -s 0/0 -o eth0 -j SNAT -to wan_ip
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -s 0/0 -d 0/0 -j ACCEPT
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
echo "1">/proc/sys/net/ipv4/ip_forward
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表