添加新的路由linux

我需要添加一个新的路线10.10.10.0,现在我有这个:

# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 xx.xxx.xxx.1 0.0.0.0 UG 0 0 0 eth1 10.10.10.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 yyy.yyy.yyy.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 zz.zzz.zzz.104 0.0.0.0 255.255.255.248 U 0 0 0 eth2 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 

但从192.168.1.0我无法ping 10.10.10.0

你能给我一些提示吗?

@亚历贝瑞:

  # netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 xx.xxx.xxx.1 0.0.0.0 UG 0 0 0 eth1 10.10.10.0 192.168.1.1 255.255.255.0 UG 0 0 0 br0 xx.xxx.xxx.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 yy.yyy.yyy.104 0.0.0.0 255.255.255.248 U 0 0 0 eth2 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br0 # ifconfig br0 Link encap:Ethernet HWaddr 06:b3:9d:ea:00:00 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1820084891 errors:0 dropped:0 overruns:0 frame:0 TX packets:1066013551 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2430082718617 (2.2 TiB) TX bytes:528068645043 (491.8 GiB) br1 Link encap:Ethernet HWaddr 7e:c1:2c:b5:00:00 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 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:0 (0.0 B) TX bytes:0 (0.0 B) br2 Link encap:Ethernet HWaddr ba:49:4e:ba:00:00 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 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:0 (0.0 B) TX bytes:0 (0.0 B) eth0 Link encap:Ethernet HWaddr 3c:a8:2a:4c:00:00 UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 RX packets:1819543139 errors:0 dropped:84145 overruns:0 frame:0 TX packets:1069336958 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2462699876337 (2.2 TiB) TX bytes:532670076821 (496.0 GiB) Interrupt:17 eth1 Link encap:Ethernet HWaddr 3c:a8:2a:4c:00:00 inet addr:xx.xxx.xxx.158 Bcast:xx.xxx.xxx.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1092047952 errors:0 dropped:0 overruns:0 frame:0 TX packets:1834312885 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:534554874442 (497.8 GiB) TX bytes:2461099916046 (2.2 TiB) Interrupt:18 eth2 Link encap:Ethernet HWaddr a0:36:9f:9a:00:00 inet addr:yy.yyy.yyy.106 Bcast:yy.yyy.yyy.111 Mask:255.255.255.248 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12481216 errors:0 dropped:0 overruns:0 frame:0 TX packets:16054960 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2372738207 (2.2 GiB) TX bytes:5865283466 (5.4 GiB) Memory:fbf00000-fbffffff eth3 Link encap:Ethernet HWaddr a0:36:9f:9a:00:00 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Memory:fbd00000-fbdfffff lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:53089749 errors:0 dropped:0 overruns:0 frame:0 TX packets:53089749 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:19502753983 (18.1 GiB) TX bytes:19502753983 (18.1 GiB) tap0 Link encap:Ethernet HWaddr 06:b3:9d:ea:00:00 UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 RX packets:2911714 errors:0 dropped:0 overruns:0 frame:0 TX packets:5922720 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:313722436 (299.1 MiB) TX bytes:2727757262 (2.5 GiB) # iptables -L : there are to many rules here, it's a router box. no rules regarding 10.10.10.0 

xx.xxx.xxx.0和yy.yyy.yyy.104是公共ip

 ip route add 10.10.10.0 255.255.255.0 gw <router address> 

其中<router address>是既可以连接到客户端又可以连接到目标子网的路由器。