思科路由器策略路由 通过缺省路由负载均衡 一

230阅读 0评论2013-07-01 wfeng
分类:系统运维

基本配置B1的配置命令:

B1(config)#interface serial 0

B1(config-if)#ip address .1 255.255.255.0

B1(config-if)#clock rate 64000

B1(config-if)#ip address .1 255.255.255.0 secondary

B1(config-if)#ip address .1 255.255.255.0 secondary

B1(config-if)#ip address .1 255.255.255.0 secondary

B1(config-if)#ip address .1 255.255.255.0 secondary

B1(config-if)#ip address .1 255.255.255.0

B1(config)#router ospf 10

B1(config-router)#router-id .1

B1(config-router)#network .0 255.255.255.255 area 0

B9的配置命令:

B9(config-if)#interface serial 0

B9(config-if)#ip address .3 255.255.255.0

B9(config)#interface loopback 0

B9(config-if)#ip address .3 255.255.255.0

B9(config-if)#ip ospf network point-to-point

B9(config-if)#interface eth 0

B9(config-if)#ip address 213.1.1.3 255.255.255.0

B9(config)#ip route .0 0.0.0.0 23.1.1.2

B4的配置命令:

B4(config-if)#interface Loopback0

B4(config-if)#ip address .2 255.255.255.0

B4(config-if)# ip ospf network point-to-point

B4(config)#interface Ethernet0

B4(config-if)#ip address 213.1.1.2 255.255.255.0

B4(config)#interface Serial1

B4(config-if)#ip address .2 255.255.255.0

B4(config)#router ospf 10

B4(config-router)#router-id .2

B4(config-router)#network .0 255.255.255.255 area 0

B4(config-router)#default-information originate always//用ospf通告一条默认给B1,always参数的作用是不需要B4本省有静态默认的存在。

监视与测试配置

查看B1的路由表发现,B4将其与B1相连的接口IP通告给了B1这位默认路由

 

Gateway of last resort is .2 to network 0.0.0.0

 

 

     .0/24 is subnetted, 5 subnets

C       .0 is directly connected, Loopback0

C       .0 is directly connected, Loopback0

C       .0 is directly connected, Loopback0

C       .0 is directly connected, Loopback0

C       .0 is directly connected, Loopback0

     .0/24 is subnetted, 1 subnets

O       .0 [110/65] vi.2, 00:16:33, Serial0

     .0/24 is subnetted, 1 subnets

O       .0 [110/128] vi.2, 00:16:33, Serial0

O    213.1.1.0/24 [110/74] vi.2, 00:16:34, Serial0

     .0/24 is subnetted, 1 subnets

C       .0 is directly connected, Serial0

O*E2 .0/0 [110/1] vi.2, 00:17:36, Serial0

下面配置B4,是B1的1.1.X.1/24网络和.0/24网络分别B4的S0和eth0接口访问B9的3.3.3.0/24网络。

B4(config)#route-map to-B9

B4(config-route-map)#match ip address 10

B4(config-route-map)#set default interface serial 0

B4(config)#access-list 10 permit .0 0.0.3.255

B4(config)#access-list 20 permit .0 0.0.0.255

 

B4(config)#route-map to-B9 permit 20

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

B4(config-route-map)#set default interface e0

应用到接口

B4(config)#interface serial 1

B4(config-if)#ip policy route-map to-B9

打开策略运行调试输出:

B4(config)#debug ip policy

Policy routing debugging is on

Set default interface这条命令和set ip next-hop的区别是:前者先检查路由表,路由有到目的地址的路径(不算默认路由),则按路由路由表进行路由,如果路由表中没有到达目的地址的明确路径,则用设置的策略路由发送。

在B1发起ping。验证策略路由情况:

在B4查看策略路由debug输出,因为B4没有针对.0/24的路由,因此按照策略路由方式转发

B1#ping

Protocol [ip]:

Target IP address: .3

Repeat count [5]:

Datagram size [100]:

Timeout in seconds [2]:

Extended commands [n]: y

Source address or interface: .1

Type of service [0]:

Set DF bit in IP header? [no]:

Validate reply data? [no]:

Data pattern [0xABCD]:

Loose, Strict, Record, Timestamp, Verbose[none]:

Sweep range of sizes [n]:

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to .3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 72/74/76 ms

上一篇:Cisco ASA 端口映射
下一篇:Linux 系统 /bin,/usr/bin,/sbin,/usr/sbin及root