linode无法启动iptables解决办法
最近买了台linode的vps来代理和缓存,没想到在把iptables规则整好后,居然无法启动iptables,报以下错误:
1.第一个问题解决办法:
cp /etc/init.d/iptables /etc/init.d/iptables.oldbak--
vi /etc/init.d/iptables
查找case "$i" in这行,如下内容:
for i in $tables; do
echo -n "$i "
case "$i" in
raw)
$IPTABLES -t raw -P PREROUTING $policy \
&& $IPTABLES -t raw -P OUTPUT $policy \
|| let ret+=1
;;
filter)
$IPTABLES -t filter -P INPUT $policy \
&& $IPTABLES -t filter -P OUTPUT $policy \
&& $IPTABLES -t filter -P FORWARD $policy \
|| let ret+=1
;;
nat)
修改成如下:
for i in $tables; do
echo -n "$i "
case "$i" in
security)
$IPTABLES -t filter -P INPUT $policy \
&& $IPTABLES -t filter -P OUTPUT $policy \
&& $IPTABLES -t filter -P FORWARD $policy \
|| let ret+=1
;;
raw)
$IPTABLES -t raw -P PREROUTING $policy \
&& $IPTABLES -t raw -P OUTPUT $policy \
|| let ret+=1
;;
filter)
$IPTABLES -t filter -P INPUT $policy \
&& $IPTABLES -t filter -P OUTPUT $policy \
&& $IPTABLES -t filter -P FORWARD $policy \
|| let ret+=1
;;
nat)
2.第2个问题解决办法:
cp /etc/sysconfig/iptables-config /etc/sysconfig/iptables-config.oldbak--
关闭ip_conntrack_netbios_ns模块
sed -i 's/IPTABLES_MODULES="ip_conntrack_netbios_ns"/##IPTABLES_MODULES="ip_conntrack_netbios_ns"/g' /etc/sysconfig/iptables-config
3.重启iptables
service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: security raw nat mangle fi[ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
好了,iptables启动起来了,问题解决,只能说linode内核加载的模块太少了.
1.第一个问题解决办法:
cp /etc/init.d/iptables /etc/init.d/iptables.oldbak--
vi /etc/init.d/iptables
查找case "$i" in这行,如下内容:
for i in $tables; do
echo -n "$i "
case "$i" in
raw)
$IPTABLES -t raw -P PREROUTING $policy \
&& $IPTABLES -t raw -P OUTPUT $policy \
|| let ret+=1
;;
filter)
$IPTABLES -t filter -P INPUT $policy \
&& $IPTABLES -t filter -P OUTPUT $policy \
&& $IPTABLES -t filter -P FORWARD $policy \
|| let ret+=1
;;
nat)
修改成如下:
for i in $tables; do
echo -n "$i "
case "$i" in
security)
$IPTABLES -t filter -P INPUT $policy \
&& $IPTABLES -t filter -P OUTPUT $policy \
&& $IPTABLES -t filter -P FORWARD $policy \
|| let ret+=1
;;
raw)
$IPTABLES -t raw -P PREROUTING $policy \
&& $IPTABLES -t raw -P OUTPUT $policy \
|| let ret+=1
;;
filter)
$IPTABLES -t filter -P INPUT $policy \
&& $IPTABLES -t filter -P OUTPUT $policy \
&& $IPTABLES -t filter -P FORWARD $policy \
|| let ret+=1
;;
nat)
2.第2个问题解决办法:
cp /etc/sysconfig/iptables-config /etc/sysconfig/iptables-config.oldbak--
关闭ip_conntrack_netbios_ns模块
sed -i 's/IPTABLES_MODULES="ip_conntrack_netbios_ns"/##IPTABLES_MODULES="ip_conntrack_netbios_ns"/g' /etc/sysconfig/iptables-config
3.重启iptables
service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: security raw nat mangle fi[ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
好了,iptables启动起来了,问题解决,只能说linode内核加载的模块太少了.
评论: