2008-05-10

Linux的VPS上执行iptables命令报错的解决方法

在linux的vps上,可能需要配置iptables的一些模块,例如:iptables -t nat -A POSTROUTING -s 10।8।0.0/24 -o eth1 -j SNAT --to-source 192.168.1.2执行上边命令的时候,会报错无法继续iptables v1.2.11: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)Perhaps iptables or your kernel needs to be upgraded.


Linux的VPS支持iptables的很多模块的在默认情况下,nat等模块是处于未打开的状态所以直接执行iptables -t nat的命令会报错

编辑/etc/sysconfig/vz找到如下一行,并加入iptable_nat进去,如下IPTABLES="iptable_nat ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length"保存退出并重启vz和iptables服务/etc/init.d/vz restart/etc/init.d/iptabls restart


现在NAT模块在整个节点上已经被支持了我们继续给某个要使用NAT模块的vps去启用nat模块使用VZMC连接到硬件节点,选择要管理的VPS点击鼠标右键,选择属性在iptables标签下边,可以看到详细的iptables模块清单相当一部分iptables的模块默认是禁用的例如nat等在这里打开他们的支持,vps上即可运行相应的iptables命令了

From http://www.parallels.com.cn/support.php?x=&mod_id=2&root=92&id=554

相关文章

0 评论: