隨著企業(yè)內(nèi)部流量的逐步增大,,使用路由器的獨(dú)臂路由功能來實(shí)現(xiàn)不同VLAN間互訪已不能滿足企業(yè)用戶的需求,。這時(shí)我們可以使用轉(zhuǎn)發(fā)速度較快的三層交換機(jī)來實(shí)現(xiàn)這些功能,。通過在三層交換上配置相應(yīng)的VLAN地址(即網(wǎng)關(guān)地址),讓不同VLAN的用戶通過三層交換的中繼鏈路實(shí)現(xiàn)快速的互訪,。
實(shí)驗(yàn)拓?fù)? 實(shí)驗(yàn)步驟 v在2層交換機(jī)上配置VLAN SW-2L(config)#VLAN 2 SW-2L(config-VLAN)#VLAN 3 SW-2L(config-VLAN)#exit 配置所需要的接口加入到VLAN中 SW-2L(config)#interface range f0/2 SW-2L(config-if-range)#switchport mode access SW-2L(config-if-range)#switchport access VLAN 2 SW-2L(config)#interface range f0/3 SW-2L(config-if-range)#switchport mode access SW-2L(config-if-range)#switchport access VLAN 3 v在2層交換機(jī)上配制Trunk接口 SW-2L(config)#interface f0/1 SW-2L(config-if)#switchport mode trunk v 在3層交換機(jī)上配置與2層交換機(jī)相同的VLAN(配置步驟與方法相同,也可以配置一臺(tái)交換機(jī)為VTP域服務(wù)器,,其它交換機(jī)為VTP域客戶端來自動(dòng)學(xué)習(xí)VLAN信息) SW-3L(config)#VLAN database SW-3L(config-VLAN)#VLAN 2 SW-3L(config-VLAN)#VLAN 3 SW-3L(config-VLAN)#exit v在3層交換機(jī)上配置中繼接口 SW-3L(config)#interface f0/1 SW-3L(config-if)#switchport trunk encapsulation dot1q SW-3L(config-if)#switchport mode trunk v在3層交換機(jī)上啟動(dòng)路由 SW-3L(config)#ip routing v在3層交換機(jī)上配置各VLAN的IP地址 SW-3L(config)#interface VLAN 1 SW-3L(config-if)#ip address 192.168.1.1 255.255.255.0 SW-3L(config-if)#no shut SW-3L(config)#interface VLAN 2 SW-3L(config-if)#ip address 192.168.2.1 255.255.255.0 SW-3L(config-if)#no shut SW-3L(config)#interface VLAN 3 SW-3L(config-if)#ip address 192.168.3.1 255.255.255.0 SW-3L(config-if)#no shut v在3層交換機(jī)上查看路由表 SW-3L#show ip route SW-3L #sh ip route Codes: C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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 C 192.168.1.0/24 is directly connected, VLAN1 C 192.168.2.0/24 is directly connected, VLAN2 C 192.168.3.0/24 is directly connected, VLAN3 v在主機(jī)192.168.2.2上ping 192.168.3.2 在這里,,主機(jī)也是用路由器模擬的,這里舉一臺(tái)的配置為例: Router#conf t Router(config)#host PC2 PC2(config)#int f0/2 PC2(config-if)#no sw PC2(config-if)#ip add 192.168.2.2 255.255.255.0 PC2(config-if)#no shut PC2(config-if)#exit PC2(config)#ip default-ga 192.168.2.1 PC2(config)#no ip routing PC2#ping 192.168.3.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 96/143/232 ms v查看FIB (FIB,,即轉(zhuǎn)發(fā)信息庫,。從概念上看,F(xiàn)IB類似于路由表,,包含路由表中的轉(zhuǎn)發(fā)信息的鏡像) SW-3L#show ip cef ( 查看FIB表) SW-3L #sh ip cef Prefix Next Hop Interface 0.0.0.0/0 drop Null0 (default route handler entry) 0.0.0.0/32 receive 192.168.1.0/24 attached VLAN1 192.168.1.0/32 receive 192.168.1.1/32 receive 192.168.1.2/32 192.168.1.2 VLAN1 192.168.1.255/32 receive 192.168.2.0/24 attached VLAN2 192.168.2.0/32 receive 192.168.2.1/32 receive 192.168.2.2/32 192.168.2.2 VLAN2 192.168.2.255/32 receive 192.168.3.0/24 attached VLAN3 192.168.3.0/32 receive 192.168.3.1/32 receive 192.168.3.2/32 192.168.3.2 VLAN3 192.168.3.255/32 receive 224.0.0.0/4 drop 224.0.0.0/24 receive 255.255.255.255/32 receive SW-3L#show adjacency detail (查看鄰接關(guān)系表) SW-3L #sh adjacency detail Protocol Interface Address IP VLAN2 192.168.2.2(5) 20 packets, 2280 bytes CC000924F002CC000CC800000800 ARP 03:53:59 Epoch: 0 IP VLAN3 192.168.3.2(5) 30 packets, 3420 bytes CC0002D4F003CC000CC800000800 ARP 03:55:52 Epoch: 0 IP VLAN1 192.168.1.2(5) 10 packets, 1140 bytes CC0008D4F004CC000CC800000800 ARP 03:57:06 Epoch: 0 |
|