路由圖重分佈的例子

路由圖重分佈OSPFRIP的例子
如上例圖所示:「RIP與OSPF路由重分佈例子」
switchA(config)#router rip
switchA(config-router)#network 192.168.10.0
switchA(config-router)#network 192.168.20.0
switchA(config-router)#network 192.168.1.0
switchA(config-router)#version 2
switchA(config-router)#no auto-summary
switchA(config-router)#exit
switchA(config)#end
router(config)#router rip
router(config-router)#network 192.168.1.0
router(config-router)#network 192.168.2.0
router(config-router)#redistribute ospf metric 3//設置路由重分佈,rip重分佈到ospf
router(config-router)#version 2
router(config-router)#no auto-summary
router(config-router)#exit
router(config)#router ospf
router(config-router)#network 192.168.1.0 0.0.0 .255 area 0
router(config-router)#network 192.168.2.0 0.0.0 .255 area 0
router(config-router)#redistriblute rip subnets//設置路由重分佈,ospf重分佈到rip
router(config-router)#exit
router(config)#end
以上是配置重分佈是沒有任何要求的例子,下面使用路由圖來進行重分佈的配置:
Router(config)#access-list 10 permit 192.168.10.0 0.0.0 .255
Router(config)#route-map rmap permit 10
Router(config-route-map)#match ip address 10
Router(config-route-map)#exit
Router(config)#router rip
Router(config-router)#redistribute ospf  route-map rmap metric 3//設置路由重分佈,rip重分佈到ospf,採用路由圖進行重分佈配置
配置後再查看三臺設備路由表的狀況:
Router:
Router#show ip route
 
Codes:  C - connected, S - static,  R - RIP B - BGP
        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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 
        * - candidate default
 
Gateway of last resort is no set
C    192.168.1.0/24 is directly connected, FastEthernet 0/0
C    192.168.1.2/32 is local host.
C    192.168.2.0/24 is directly connected, FastEthernet 0/1
C    192.168.2.2/32 is local host.
R    192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:07, FastEthernet 0/0
R    192.168.20.0/24 [120/1] via 192.168.1.1, 00:00:07, FastEthernet 0/0
O    192.168.30.0/24 [110/2] via 192.168.2.1, 00:19:36, FastEthernet 0/1
O    192.168.40.0/24 [110/2] via 192.168.2.1, 00:20:45, FastEthernet 0/1
 
switchA:
switchA#show ip route
 
Codes:  C - connected, S - static,  R - RIP B - BGP
        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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 
        * - candidate default
 
Gateway of last resort is no set
C    192.168.1.0/24 is directly connected, FastEthernet 0/1
C    192.168.1.1/32 is local host.
C    192.168.10.0/24 is directly connected, VLAN 10
C    192.168.10.1/32 is local host.
C    192.168.20.0/24 is directly connected, VLAN 20
C    192.168.20.1/32 is local host.
R    192.168.30.0/24 [120/3] via 192.168.1.2, 00:00:21, FastEthernet 0/1
R    192.168.40.0/24 [120/3] via 192.168.1.2, 00:00:21, FastEthernet 0/1
R    192.168.2.0/24 [120/3] via 192.168.1.2, 00:00:21, FastEthernet 0/1
 
switchB:
switchB#show ip route
 
Codes:  C - connected, S - static,  R - RIP B - BGP
        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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
 
        * - candidate default
 
Gateway of last resort is no set
C    192.168.2.0/24 is directly connected, FastEthernet 0/1
C    192.168.2.1/32 is local host.
O E2 192.168.10.0/24 [110/20] via 192.168.2.2, 00:22:48, FastEthernet 0/1
C    192.168.30.0/24 is directly connected, VLAN 10
C    192.168.30.1/32 is local host.
C    192.168.40.0/24 is directly connected, VLAN 20
C    192.168.40.1/32 is local host.
根據以上路由表的分析, switchB 只學到了 switchA 一條 192.168.10.0 的一條路由,而其餘的路由沒有公佈出來,起到了控制的做用。利用路由圖的重分佈的例子,比較靈活,不光能夠匹配列表,還可匹配不一樣的路由協議的參數,進行控制,可是也有不少問題,但願用戶慎重使用,路由圖的使用不光是針對重分佈使用時應用,還能夠基於高層的策略路由的應用,下個例子會講到!謝謝你們支持!請你們多多指教。
相關文章
相關標籤/搜索