基于route-map的策略路由

拓扑图

 

实验过程

1.       R1的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host pc1

pc1(config)#no ip routing  //模拟pc需要关闭路由功能

pc1(config)#int f0/0

pc1(config-if)#no shut

pc1(config-if)#ip add 192.168.1.10 255.255.255.0

pc1(config-if)#exit

pc1(config)#ip default-gateway 192.168.1.1

pc1(config)#end

2.       R2的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host  pc2

pc2(config)#no ip routing

pc2(config)#int f0/0

pc2(config-if)#no shut

pc2(config-if)#ip add 192.168.1.20 255.255.255.0

pc2(config-if)#exit

pc2(config)#ip default-gateway 192.168.1.1

pc2(config)#end

3.       R3的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host  R3

R3(config)#int s0/0

R3(config-if)#no shut

R3(config-if)#en frame-relay

R3(config-if)#ip add 10.1.1.1 255.255.255.0

R3(config-if)#exit

R3(config)#int f1/0

R3(config-if)#no shut

R3(config-if)#ip add 192.168.1.1 255.255.255.0

R3(config-if)#end

R3(config)#router rip

R3(config-router)#version 2

R3(config-router)#no auto

R3(config-router)#network 192.168.1.0

R3(config-router)#net 10.0.0.0

R3(config-router)#end

4.       R4的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host  R4

R4(config)#int s0/0

R4(config-if)#en frame-relay

R4(config-if)#no shut

R4(config-if)#ip add 10.1.1.2 255.255.255.0

R4(config-if)#int s0/1

R4(config-if)#no shut

R4(config-if)#ip add 172.16.1.1 255.255.255.0

R4(config-if)#exit

R4(config)#router rip

R4(config-router)#version 2

R4(config-router)#no auto

R4(config-router)#net 10.0.0.0

R4(config-router)#net 172.16.1.0

R4(config-router)#end

5.       R5的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host  R5

R5(config)#int s0/1

R5(config-if)#no shut

R5(config-if)#ip add 172.16.1.2 255.255.255.0

R5(config-if)#int s0/2

R5(config-if)#no shut

R5(config-if)#ip add 172.16.2.1 255.255.255.0

R5(config-if)#int lo0

R5(config-if)#ip add 130.130.1.1 255.255.255.0

R5(config-if)#exit

R5(config)#router rip

R5(config-router)#version 2

R5(config-router)#no auto

R5(config-router)#net 172.16.1.0

R5(config-router)#net 172.16.2.0

R5(config-router)#net 130.130.1.0

R5(config-router)#end

6.       R6的预配置

Router>en

Router#config t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)#no exec-timeout

Router(config-line)#loggin syn

Router(config-line)#exit

Router(config)#host  R6

R6(config)#int s0/0

R6(config-if)#no shut

R6(config-if)#en frame-relay

R6(config-if)#ip add 10.1.1.3 255.255.255.0

R6(config-if)#int s0/2

R6(config-if)#no shut

R6(config-if)#ip add 172.16.2.2 255.255.255.0

R6(config-if)#exit

R6(config)#router rip

R6(config-router)#version 2

R6(config-router)#no auto

R6(config-router)#net  10.0.0.0

R6(config-router)#net 172.16.2.0

R6(config-router)#end

7.       查看R3的路由器

R3#show 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

 

     172.16.0.0/24 is subnetted, 2 subnets

R       172.16.1.0 [120/1] via 10.1.1.2, 00:00:26, Serial0/0

R       172.16.2.0 [120/1] via 10.1.1.3, 00:00:12, Serial0/0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.1.0 is directly connected, Serial0/0

     130.130.0.0/24 is subnetted, 1 subnets

R       130.130.1.0 [120/2] via 10.1.1.3, 00:00:12, Serial0/0

                   [120/2] via 10.1.1.2, 00:00:26, Serial0/0  //130.130.1.0有两条路径

C    192.168.1.0/24 is directly connected, FastEthernet1/0

8.       R1上跟踪到130.130.1.1的路由

pc1#traceroute 130.130.1.1

 

Type escape sequence to abort.

Tracing the route to 130.130.1.1

 

  1 192.168.1.1 56 msec 112 msec 60 msec

  2 10.1.1.2 172 msec 180 msec 156 msec

      3 172.16.1.2 164 msec *  220 msec

pc2#traceroute 130.130.1.1

 

Type escape sequence to abort.

Tracing the route to 130.130.1.1

 

  1 192.168.1.1 1028 msec 112 msec 28 msec

  2 10.1.1.2 64 msec 164 msec 12 msec

      3 172.16.1.2 16 msec *  224 msec

9.       R3上进行路由策略的配置,实现R1R4R2R6.

R3(config)#access-list 10 permit host 192.168.1.10  //配置ACL抓取流量

R3(config)#access-list 20 permit host 192.168.1.20

R3(config)#route-map ccie permit 10  //对抓取的流量进行permit操作

R3(config-route-map)#match ip address 10  //匹配抓取的流量

R3(config-route-map)#set ip next-hop 10.1.1.2  //对抓取设置下一跳路由

R3(config-route-map)#exit

R3(config)#route-map ccie permit 20

R3(config-route-map)#match ip address 20

R3(config-route-map)#set ip next-hop 10.1.1.3

R3(config-route-map)#exit

R3(config)#route-map ccie permit 30

R3(config-route-map)#exit

R3(config)#int f1/0

R3(config-if)#ip policy route-map ccie  //策略应用在此接口上

R3(config-if)#end

10.   再次跟踪去往130.130.1.0的路由

pc1#traceroute 130.130.1.1

 

Type escape sequence to abort.

Tracing the route to 130.130.1.1

 

  1 192.168.1.1 84 msec 108 msec 28 msec

  2 10.1.1.2 180 msec 248 msec 192 msec

      3 172.16.1.2 280 msec *  300 msec

pc2#traceroute 130.130.1.1

 

Type escape sequence to abort.

Tracing the route to 130.130.1.1

 

  1 192.168.1.1 68 msec 68 msec 44 msec

  2 10.1.1.3 104 msec 96 msec 88 msec

      3 172.16.2.1 136 msec *  148 msec

说明:现在R1R4R2R6.

 

你可能感兴趣的:(职场,休闲,策略路由,route-map)