我想提出以下几点:
/sbin/iptables -t nat -I PREROUTING --src 0/0 --dst [MY IP] -p tcp --dport 40 -j REDIRECT --to-ports 80但是,我得到了以下错误:
iptables v1.3.5: can't initialize iptables table `/sbin/nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.我正在运行CentOS 5.5。有谁能告诉我吗?
ifconfig输出:
eth0 Link encap:Ethernet HWaddr 00:18:51:A4:3E:E0
inet addr:x.x.x.x Bcast:173.201.16.255 Mask:255.255.255.0
inet6 addr: fe80::218:51ff:fea4:3ee0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29678326 errors:0 dropped:0 overruns:0 frame:0
TX packets:13545931 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2604591444 (2.4 GiB) TX bytes:6052013635 (5.6 GiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:34139502 errors:0 dropped:0 overruns:0 frame:0
TX packets:34139502 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5160432652 (4.8 GiB) TX bytes:5160432652 (4.8 GiB)
lo:1 Link encap:Local Loopback
inet addr:97.74.207.156 Mask:255.255.255.255
UP LOOPBACK RUNNING MTU:16436 Metric:1
lo:2 Link encap:Local Loopback
inet addr:173.201.181.56 Mask:255.255.255.255
UP LOOPBACK RUNNING MTU:16436 Metric:1uname -a输出:
Linux ip-173-201-16-45.ip.secureserver.net 2.6.18-028stab070.14 #1 SMP Thu Nov 18 16:04:02 MSK 2010 i686 i686 i386 GNU/Linuxgrep -v \# /etc/sysconfig/iptables-config输出:
IPTABLES_MODULES=""
IPTABLES_MODULES_UNLOAD="yes"
IPTABLES_SAVE_ON_STOP="no"
IPTABLES_SAVE_ON_RESTART="no"
IPTABLES_SAVE_COUNTER="no"
IPTABLES_STATUS_NUMERIC="yes"
IPTABLES_STATUS_VERBOSE="no"sudo /sbin/iptables -L输出:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destinationsudo /sbin/lsmod | egrep -i iptables输出:空白。
sudo /sbin/lsmod | egrep -i nat输出:空白。
uname -a输出:
Linux ip-173-201-16-45.ip.secureserver.net 2.6.18-028stab070.14 #1 SMP Thu Nov 18 16:04:02 MSK 2010 i686 i686 i386 GNU/Linux发布于 2011-08-17 20:02:37
从内核版本判断,您正在OpenVZ容器中运行。
或者您丢失了/lib/xtable中的NAT库和/或OpenVZ内核实际上没有加载NAT内核模块--我敢打赌后者很可能是这样的;如果您想要NAT,您需要请求VPS提供程序为您加载模块。
发布于 2011-08-17 16:17:44
修改/etc/sysconfig/iptables-config,如下所示:
IPTABLES_MODULES="iptable_nat"https://serverfault.com/questions/302111
复制相似问题