Дерево страниц

Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

route-map BGP_OUT
  rule 1
    action permit
  exit
exit
router bgp 1 address-family ipv4 neighbor 192.168.1.1<ipaddr> remote-as 2 route-map BGP_OUT out enable exit enable exit exit

Решение:

Настроим Конфигурация  BGP на ESR:

Блок кода
router bgp 

...

log-neighbor-changes
router bgp 2500
  

...

router-id 185.0.0.1
  neighbor 185.0.0.2
    

...

remote-as 20
    

...

update-source 185.0.0.1
    

...

address-family ipv4 unicast
      enable
    

...

exit
    

...

enable
  exit
 

...

 address-family ipv4 unicast
   

...

 redistribute connected
  exit
  

...

enable
exit

...

interface 

...

gigabitethernet 1/0/1
  ip firewall disable
  

...

ip address 185.0.0.1/24
exit
interface gigabitethernet 1/0/2
  ip firewall disable
  ip address 172.16.1.1/24
exit

Далее создадим необходимые правила для фильтрации маршрутов и добавим в конфигурацию BGP:

Блок кода
route-map in
  rule 10
    

...

match ip address 198.51.100.0/24 eq 28
  exit
 

...

Теперь осталось прикрепить route-map к BGP:

...

 rule 20
    match ip address 203.0.113.0/24 ge 30
  exit
  rule 30
    match ip address 203.0.96.0/20 le 24
  exit
exit
route-map OUT
  rule 1
  exit
exit
router bgp log-neighbor-changes
router bgp 2500
  router-id 185.0.0.1
  neighbor 185.0.0.2
    remote-as 20
    update-source 185.0.0.1
    address-family ipv4 unicast
      route-map in in
      route-map OUT out
      enable
    exit
    enable
  exit
  address-family ipv4 unicast
    redistribute connected
  exit
  enable
exit

interface gigabitethernet 1/0/1
  ip firewall disable
  ip address 185.0.0.1/24
exit
interface gigabitethernet 1/0/2
  ip firewall disable
  ip address 172.16.1.1/24
exit

Вывод диагностических команд:

Блок кода
esr-200# show bgp neighbors 
BGP neighbor is 185.0.0.2
    BGP state:                       Established
    Neighbor address:                185.0.0.2
    Neighbor AS:                     20
    Neighbor ID:                     185.0.0.2
    Neighbor caps:                   refresh enhanced-refresh restart-aware AS4
    Session:                         external AS4
    Source address:                  185.0.0.1
    Weight:                          0
    Hold timer:                      140/180
    Keepalive timer:                 1/60
    Address family ipv4 unicast:    
      Default originate:             No
      Default information originate: No
      Incoming route-map:            in
      Outgoing route-map:            OUT
    Uptime:                          1588 s
esr-200# 
esr-200# sh bgp ipv4 unicast neighbor 185.0.0.2 advertise-routes 
Status codes: u - unicast, b - broadcast, m - multicast, a - anycast
              * - valid, > - best
Origin codes: i - IGP, e - EGP, ? - incomplete

     Network              Next Hop             Metric  LocPrf      Weight Path        
*  u 172.16.1.0/24        185.0.0.1            --      --          --     2500 ?
*  u 185.0.0.0/24         185.0.0.1            --      --          --     2500 ?
esr-200# 
esr-200# sh bgp ipv4 unicast neighbor 185.0.0.2 routes 
Status codes: u - unicast, b - broadcast, m - multicast, a - anycast
              * - valid, > - best
Origin codes: i - IGP, e - EGP, ? - incomplete

     Network              Next Hop             Metric  LocPrf      Weight Path        
*> u 198.51.100.0/28      185.0.0.2            --      100         0      20 i
*> u 203.0.96.0/23        185.0.0.2     

...

       --      

...

100         0      20 i
*> u 203.0.113.0/30       185.0.0.2            --      

...

100 

...

     

...

 

...

  0      20 i