- 论坛徽章:
- 0
|
问题是,我将地址为10.10.10.5的主机直接连接到eth2上面,可以ping通10.10.10.1(即我所设置的路由器),但是不能够接通其它任何的机器;
当我把地址为192.168.8.65的机器通过交换机与eth3连接并把192.168.8.100设为网关时,可以上我们的局域网,并且确实是通过网关获得的数据包。
请问,我要使我的机器能够把eth2上的数据包转发到eth3上,我该怎么设置?
谢谢大家!
(下面的eth0,eth1暂时并没有连接到网络上)
下面是路由的设置
===========这里只是试验时所临时使用的地址============
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.30.26.20 * 255.255.255.252 U 0 0 0 eth1
10.10.10.0 * 255.255.255.0 U 0 0 0 eth2
192.168.8.0 * 255.255.255.0 U 0 0 0 eth3
192.168.8.0 * 255.255.255.0 U 0 0 0 eth3
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default * 0.0.0.0 U 0 0 0 eth3
下面是各个网卡的设置:
eth0 Link encap:Ethernet HWaddr 00:50:8B:CF:7E8
inet addr:192.168.8.100 Bcast:192.168.8.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:5 dropped:0 overruns:0 carrier:5
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:210 (210.0 b)
Interrupt:11 Base address:0x2000 Memory:d8200000-d8200038
eth1 Link encap:Ethernet HWaddr 00:50:8B:CF:7E9
inet addr:172.30.26.22 Bcast:172.30.26.23 Mask:255.255.255.252
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:3 dropped:0 overruns:0 carrier:3
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:126 (126.0 b)
Interrupt:7 Base address:0x2040 Memory:d8201000-d8201038
eth2 Link encap:Ethernet HWaddr 00:15:60:09:F0:9B
inet addr:10.10.10.1 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42422 errors:0 dropped:0 overruns:0 frame:0
TX packets:1076 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3766893 (3.5 Mb) TX bytes:125276 (122.3 Kb)
Interrupt:11 Memory:ca000000-ca010000
eth3 Link encap:Ethernet HWaddr 00:15:60:09:F0:9A
inet addr:192.168.8.100 Bcast:192.168.8.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6469435 errors:0 dropped:0 overruns:0 frame:0
TX packets:56818 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:619150753 (590.4 Mb) TX bytes:11559732 (11.0 Mb)
Interrupt:10 Memory:ca100000-ca110000
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:62 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6844 (6.6 Kb) TX bytes:6844 (6.6 Kb)
下面是iptables的设置
[root@HP1 root]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@HP1 root]# iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 202.204.24.0/22 anywhere to:170.27.24.22
SNAT all -- 211.68.80.0/21 anywhere to:170.27.24.22
SNAT all -- 219.224.48.0/20 anywhere to:170.27.24.22
SNAT all -- 219.224.56.0/22 anywhere to:170.27.24.22
SNAT all -- 219.224.60.0/22 anywhere to:170.27.24.22
Chain OUTPUT (policy ACCEPT)
target prot opt source destination |
|