第一步:预配置,略,Rm与Rn之间一边为mn.0.0.m和mn.0.0.n,其他如图 第二步:在各路由器上运行eigrp 第三步:建立AS 200的IBRP的邻居 R2#conf t R2(config)#router bgp 200 R2(config-router)#nei 3.3.3.3 remote-as 200 R2(config-router)#nei 3.3.3.3 up lo0 R2(config-router)#nei 3.3.3.3 next-hop-self

R3(config)#router bgp 200 R3(config-router)#nei 2.2.2.2 remote 200 R3(config-router)#nei 2.2.2.2 up lo0 R3(config-router)#nei 4.4.4.4 remote 200 R3(config-router)#nei 4.4.4.4 up lo0 R3(config-router)#nei 2.2.2.2 route-reflector-client
R3(config-router)#nei 4.4.4.4 route-reflector-client

R4(config)#router bgp 200 R4(config-router)#nei 3.3.3.3 remote-as 200 R4(config-router)#nei 3.3.3.3 up lo0
R4(config-router)#nei 3.3.3.3 next-hop-self

第四步:建立EBGP R1(config)#router b 100 R1(config-router)#nei 12.0.0.2 remot 200 R1(config-router)#nei 14.0.0.4 remot 200

R2(config)#router b 200 R2(config-router)#nei 12.0.0.1 remote 100

R4(config)#router b 200 R4(config-router)#nei 14.0.0.1 remote-as 100 第五步:向BGP中引入路由 R1(config)#router b 100 R1(config-router)#net 1.1.1.0 mask 255.255.255.0

R3(config-router)#net 3.3.3.0 mask 255.255.255.0 第六步:查看当前的BGP表 R3#sh ip b BGP table version is 5, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path

  • i1.1.1.0/24 4.4.4.4 0 100 0 100 i *>i 2.2.2.2 0 100 0 100 i *> 3.3.3.0/24 0.0.0.0 0 32768 i 第七步:修改本地优先级 route-map go1 permit 10 match ip address 1 set local-preference 150 ! route-map go1 permit 20 //第二句route-map命令没有match 和set命令,它相当于访问控制列表中的permit any命令。 access-list 1 permit 1.1.1.0 //以上都是命令要配置到路由器中

R4(config-router)#nei 3.3.3.3 route-m go1 out //我们对R3上去1.1.1.1的流量进行影响 第八步:查看R3的BGP表 R3#sh ip b BGP table version is 8, local router ID is 3.3.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path r>i1.1.1.0/24 4.4.4.4 0 150 0 100 i r i 2.2.2.2 0 100 0 100 i *> 3.3.3.0/24 0.0.0.0 0 32768 i

第九步:修改路由器的MED属性 R2(config)#route-map setmed permit 10(setmed是个名字) R2(config-route-map)#match ip add 1 R2(config-route-map)#set metric 10 R2(config)#route-map setmed per 20 R2(config-route-map)#exi R2(config)#access-list 1 permit 3.3.3.0 0.0.0.0 R2(config-router)#nei 12.0.0.1 route-map setmed out 第十步:查看BGP表 R1#sh ip b BGP table version is 4, local router ID is 1.1.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 0.0.0.0 0 32768 i *> 3.3.3.0/24 14.0.0.4 0 200 i

  •               12.0.0.2                10             0 200 i