我在 CentOS 5 64 位上运行 Cloudmin GPL,并尝试允许我的 Xen PV 客户机通过 NAT/端口转发设置访问互联网。我已完成以下操作:
(在 dom0 上)
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j MASQUERADE
iptables -A PREROUTING -t nat -p tcp -i eth0 --dport 8001 -j DNAT --to 192.168.3.2:22
信息来自http://jonmccune.wordpress.com/2008/08/25/iptables-nat-in-xen/
eth0 Link encap:Ethernet HWaddr 00:1C:C0:F2:23:1A
inet addr:x.x.x.35 Bcast:199.x.x.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:346089 errors:0 dropped:0 overruns:0 frame:0
TX packets:180430 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:484168952 (461.7 MiB) TX bytes:15039620 (14.3 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4574 errors:0 dropped:0 overruns:0 frame:0
TX packets:4574 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2152282 (2.0 MiB) TX bytes:2152282 (2.0 MiB)
peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:350814 errors:0 dropped:0 overruns:0 frame:0
TX packets:181306 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:491256661 (468.4 MiB) TX bytes:14977668 (14.2 MiB)
Interrupt:22 Memory:d0700000-d0720000
vif0.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:180439 errors:0 dropped:0 overruns:0 frame:0
TX packets:346090 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15040646 (14.3 MiB) TX bytes:484169018 (461.7 MiB)
vif7.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:1620 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:384 (384.0 b) TX bytes:109172 (106.6 KiB)
xenbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:8631 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:405819 (396.3 KiB) TX bytes:0 (0.0 b)
为客户机添加了 IP“192.168.3.2”并启动了客户机,但没有互联网连接或到客户机或来自客户的端口转发。
我在 cloudmin gpl 中找不到任何提供 nat 端口转发的选项?