有两台机器,一台redhat 9 两块网卡eth0(222.*.*.*公有地址),eth1(192.168.178.1私有地址),一台windows2003(192.168.178.2)。
在redhat9上做iptables nat:
执行的语句:iptables -t nat -A POSTROUTING -j SNAT --to-source 222.*.*.*
iptables -t nat -L命令察看如下:
[root@localhost root]# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- anywhere anywhere to:222.*.*.*
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
两块网卡的设置:
[root@localhost root]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:E0:4C:43:C8:20
inet addr:222.*.*.* Bcast:222.*.*.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16819 errors:0 dropped:0 overruns:0 frame:0
TX packets:1430 errors:0 dropped:0 overruns:0 carrier:0
collisions:21 txqueuelen:100
RX bytes:1631068 (1.5 Mb) TX bytes:179902 (175.6 Kb)
Interrupt:11 Base address:0x7000
eth1 Link encap:Ethernet HWaddr 00:0A:EB:28E:43

inet addr:192.168.178.1 Bcast:192.168.178.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:352 errors:0 dropped:0 overruns:0 frame:0
TX packets:485 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:28525 (27.8 Kb) TX bytes:35140 (34.3 Kb)
Interrupt:5 Base address:0x1000
现在的状况是:从redhat 9上可以正常上网,也可以Ping通192.168.178.2
从192.168.178.2上也可以ping通192.168.178.1
但是就是从192。168.178.2上不能连接上网。数据只到192.168.178.1。
简而言之就是nat转换失败。我不知道自己在什么地方犯下了错误。所以想请教大虾。看看小弟是在什么地方出了问题?!
亟待!!!