如下圖可證明同類地址的不同子網的網段是完全隔離的(如同A類與C類一樣相隔的),可以使用在同一路由上做接口IP。
三層交換機3560ping不通192.168.1.18而PC3能ping通原因分析與解決方法:
第一種解決方法:按子網網段添加靜態路由
由於192.168.1.32/28與192.168.1.16/28是不同的網段,所以3560查看路由表並沒有發現192.168.1.16/28網段,分組被丟棄,此時可在三層交換機上添加靜態路由#ip route 192.168.1.16/28 192.168.1.33,到此3560ping通192.168.1.18。但ping不通192.168.1.2,因爲三層交換機路由表上沒有192.168.1.0/28網段,所以要添加這個網段的靜態路由#ip route 192.168.1.0/28 192.168.1.33。以此類推。
另一解決方法:有類地址靜態路由、默認靜態路由、默認網關
故障原因如上,但解決方法可有多種,
1、有類靜態地址路由#ip route 192.168.1.0/24 192.168.1.33。表示192.168.1.0/24網段的下一跳爲192.168.1.33,由於192.168.1.0/28包括1.0、16、32、48、、、240/28網段,所以這條命令可使3560ping通192.168.1.1、2、17、18。但還是沒ping通10.10.10.1、2的。
2、默認靜態路由#ip route 0.0.0.0 0.0.0.0 192.168.1.33.表示所有網段下一跳都可爲192.168.1.33
3、默認路由(只路由器、三層有默認路由且沒有默認網關,而二層交換機有默認網關即ip default-gateway沒有默認路由)#ip default-network 192.168.1.33=ip route 192.168.1.0 255.255.255.0
192.168.1.33。表示僅表示192.168.1.0/24網段的下一跳都可爲192.168.1.33,其他網段的IP無法轉發,要所有網段都轉發要使用默認靜態路由才得,所以默認網關是不同於默認靜態路由的。
附:
三層交換機路由表#
Switch#sh ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, FastEthernet0/1
192.168.1.0/28 is subnetted, 2 subnets
S 192.168.1.16 [1/0] via 192.168.1.49
C 192.168.1.48 is directly connected, Vlan6
此三層交換機還沒有192.168.1.0/28靜態路由,所有三層交換機ping不通192.168.1.1、2
路由器router1的路由表#
Router>en
Router#sh ip rou
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Ethernet0/1/0
192.168.1.0/28 is subnetted, 3 subnets
C 192.168.1.0 is directly connected, FastEthernet0/0
C 192.168.1.16 is directly connected, FastEthernet0/1
C 192.168.1.48 is directly connected, Ethernet0/0/0