无法到达networking192.168.100.0/24

在我们的数据中心之一,我们有一台作为路由器的Debian机器。 在这个networking中,我们无法到达192.168.100.0/24networking上的任何机器。 例如,192.168.100.0/24networking上的网关是192.168.100.10。 这个网关不能从这个networking192.168.200.0/24到达。

networkingconfiguration如下

的/ etc /networking/接口

auto lo eth0 eth1 iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet static address 77.xx.xx.xx netmask 255.255.255.240 gateway 77.xx.xx.xx # The internal network interface iface eth1 inet static address 192.168.200.20 netmask 255.255.255.0 iface eth1.100 inet static address 192.168.100.1 netmask 255.255.255.0 iface tun0 inet static address 10.254.254.1 netmask 255.255.255.252 pointopoint 10.254.254.2 

ifconfig显示如下

 eth0 Link encap:Ethernet HWaddr 00:13:21:ae:d7:23 inet addr:77.xx.xx.xx Bcast:77.xx.xx.xx Mask:255.255.255.240 inet6 addr: fe80::213:21ff:feae:d723/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:136897619 errors:7 dropped:0 overruns:0 frame:56 TX packets:35219565 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:106904749360 (99.5 GiB) TX bytes:4700046351 (4.3 GiB) Interrupt:25 eth1 Link encap:Ethernet HWaddr 00:13:21:ae:d7:22 inet addr:192.168.200.20 Bcast:192.168.200.255 Mask:255.255.255.0 inet6 addr: fe80::213:21ff:feae:d722/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:25456278 errors:0 dropped:0 overruns:0 frame:0 TX packets:51273676 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2910299307 (2.7 GiB) TX bytes:71434605655 (66.5 GiB) Interrupt:26 eth1.100 Link encap:Ethernet HWaddr 00:13:21:ae:d7:22 inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0 inet6 addr: fe80::213:21ff:feae:d722/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:27 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:1350 (1.3 KiB) 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:8057 errors:0 dropped:0 overruns:0 frame:0 TX packets:8057 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:678439 (662.5 KiB) TX bytes:678439 (662.5 KiB) ppp0 Link encap:Point-to-Point Protocol inet addr:192.168.200.200 PtP:192.168.0.201 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1486 Metric:1 RX packets:16438 errors:0 dropped:0 overruns:0 frame:0 TX packets:31312 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:1281863 (1.2 MiB) TX bytes:14955384 (14.2 MiB) 

我试图手动添加以下路线之一,但没有成功。

route add -net 192.168.100.0 netmask 255.255.255.0 dev eth1

route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.200.20 dev eth1

ip route add 192.168.100.0/24 via 192.168.200.20 dev eth1

路线正在添加,但没有太多的工作。 networking192.168.100.0/24仍然无法访问。

什么ip路由显示路由-n显示

 root@dc-dc:~# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.201 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 77.xx.xx.xx 0.0.0.0 255.255.255.240 U 0 0 0 eth0 192.168.200.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 0.0.0.0 77.xx.xx.xx 0.0.0.0 UG 0 0 0 eth0 root@dc-dc:~# ip route show 192.168.0.201 dev ppp0 proto kernel scope link src 192.168.200.200 77.xx.xx.xx/28 dev eth0 proto kernel scope link src 77.xx.xx.xx 192.168.200.0/24 dev eth1 proto kernel scope link src 192.168.200.20 default via 77.xx.xx.xx dev eth0 

端口转发已启用

 root@dc-dc:~# cat /proc/sys/net/ipv4/ip_forward 1 

输出iptables

 Chain INPUT (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 0 0 DROP all -- eth0 * 220.xx.xx.2 0.0.0.0/0 57 2964 ACCEPT tcp -- eth0 * 194.xx.xx.0/24 0.0.0.0/0 tcp dpt:22 108K 6495K ACCEPT tcp -- eth0 * 194.xx.xx.0/24 0.0.0.0/0 tcp dpt:1723 52M 71G ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 14M 724M ACCEPT all -- eth1 * 0.0.0.0/0 0.0.0.0/0 4407 427K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 26M 38G ACCEPT all -- ppp0 * 0.0.0.0/0 0.0.0.0/0 415 19592 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 249 11776 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 5 180 ACCEPT icmp -- eth0 * 0.0.0.0/0 0.0.0.0/0 icmp type 0 14351 1193K ACCEPT icmp -- eth0 * 0.0.0.0/0 0.0.0.0/0 icmp type 8 14092 845K ACCEPT all -- eth0 * 194.xx.xx.0/24 0.0.0.0/0 0 0 ACCEPT all -- * * 0.0.0.0/0 224.0.0.0/8 0 0 ACCEPT 112 -- * * 0.0.0.0/0 0.0.0.0/0 16173 1376K DROP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 6 616 ACCEPT all -- eth1 eth1 0.0.0.0/0 0.0.0.0/0 21M 31G ACCEPT all -- ppp0 * 0.0.0.0/0 0.0.0.0/0 10M 1573M ACCEPT all -- * ppp0 0.0.0.0/0 0.0.0.0/0 138K 20M ACCEPT all -- * eth0 0.0.0.0/0 0.0.0.0/0 146K 202M ACCEPT all -- eth0 * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 0 0 ACCEPT udp -- * * 89.xx.xx.xx 127.0.0.1 udp spt:53 0 0 ACCEPT udp -- * * 83.xx.xx.xx 127.0.0.1 udp spt:53 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 43M 41G ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 0 0 ACCEPT 112 -- * * 0.0.0.0/0 0.0.0.0/0 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 root@dc-dc:~# iptables -t nat -L -v Chain PREROUTING (policy ACCEPT 121K packets, 12M bytes) pkts bytes target prot opt in out source destination Chain POSTROUTING (policy ACCEPT 1715 packets, 112K bytes) pkts bytes target prot opt in out source destination 0 0 MASQUERADE all -- any any 10.254.254.0/24 anywhere 0 0 MASQUERADE all -- any ppp0 anywhere anywhere 0 0 SNAT all -- any eth0 anywhere 212.159.203.234 to:194.50.96.11 58671 3659K MASQUERADE all -- any eth0 anywhere anywhere Chain OUTPUT (policy ACCEPT 28351 packets, 1945K bytes) pkts bytes target prot opt in out source destination 

任何想法我可以尝试? 提前致谢

是连接到其他networking,所以路由器本身工作?

你确定答复的路线设置正确吗? 如果您只将网关设置为一个方向,则这还不够,您还必须确保相反方向的路线起作用。

例如:

你有服务器A连接到路由器A,然后连接到服务器B.让我们假设这两个服务器都有一个默认网关,这不是路由器A,但其他一些路由器。 现在,如果告诉服务器A它到服务器B的路由是通过路由器A,这是不够的。 您还需要告诉服务器B它是到服务器A的路由器是通过路由器A.否则服务器A的数据包可能到达服务器B,但服务器B不知道如何回复或使用错误的路由器进行回复。

它看起来像接口“eth1.100”是用vconfig或类似的创build。 这意味着接口的行为就好像它被标记为VLAN 100一样,并且从它发送的任何数据包将添加802.1Q VLAN标记。 我怀疑这是因为接口名称是“eth1.100”而不是“eth1:100”。

你真正想要的可能只是多宿主。 首先使用“vconfig rem eth1.100”命令删除“eth1.100”接口,只需发出命令“ifconfig eth1 add 192.168.100.1”,就可以将192.168.100.1添加到eth1。

希望这将解决您的问题。