BGP(边界网关协议)实验

Posted on 2020-06-16 12:14  留不住的时间  阅读(324)  评论(0编辑  收藏  举报

 

 

 

实验要求: 1.1.1.1访问5.5.5.5走R1-R2-R4-R5

5.5.5.5访问1.1.1.1走R5-R4-R3-R1

一、配置IP

二、为R2R3R4配置IGP动态路由OSPF

R2:

ospf 100

area 0.0.0.0

network 12.1.1.0 0.0.0.255

network 24.1.1.0 0.0.0.255

R3:

ospf 100

area 0.0.0.0

network 13.1.1.0 0.0.0.255

network 34.1.1.0 0.0.0.255

R4:

ospf 100

area 0.0.0.0

network 24.1.1.0 0.0.0.255

network 45.1.1.0 0.0.0.255

network 34.1.1.0 0.0.0.255

 

配置bgp

R1:

bgp 100

  router-id 1.1.1.1

  peer 12.1.1.2 as-number 200

  peer 13.1.1.3 as-number 200

   network 1.1.1.1 255.255.255.255

R2:

bgp 200

router-id 2.2.2.2

  peer 12.1.1.1 as-number 100

  peer 24.1.1.4 as-number 200

  import-route ospf 100

  peer 24.1.1.4 next-hop-local

R3:

bgp 200

  router-id 3.3.3.3

  peer 13.1.1.1 as-number 100

  peer 34.1.1.4 as-number 200

  import-route ospf 100

  peer 34.1.1.4 next-hop-local

R4:

bgp 200

  router-id 4.4.4.4

  peer 24.1.1.2 as-number 200

  peer 34.1.1.3 as-number 200

  peer 45.1.1.5 as-number 300

  undo synchronization

  import-route ospf 100

  peer 24.1.1.2 next-hop-local

  peer 34.1.1.3 next-hop-local

R5:

bgp 300

  router-id 5.5.5.5

  peer 45.1.1.4 as-number 200

  network 5.5.5.5 255.255.255.255

 

配置选路规则

R2:

route-policy shang permit node 10  (shang为名字,可以自己设置)

apply local-preference 222

bgp 200

peer 12.1.1.1 route-policy shang export

R3

route-policy xie permit node 10  (xia为名字,可以自己设置)

 

apply local-preference 222

bgp 200

peer 34.1.1.4 route-policy xie export