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

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Оксененко С. Поправил примеры с BGO

...

Функция Destination NAT (DNAT) состоит в преобразовании IP-адреса назначения у пакетов, проходящих через сетевой шлюз. DNAT используется для перенаправления трафика, идущего на некоторый «виртуальный» адрес в публичной сети, на «реальный» сервер в локальной сети, находящийся за сетевым шлюзом.

Пример настройки

Задача:
  • организовать публичный доступа к серверу, находящемуся в частной сети и не имеющему публичного сетевого адреса;
  • сервер доступен по адресу: 192.0.2.10/24;














Исходная конфигурация кластера:
Блок кода
cluster
  cluster-interface bridge 1
  unit 1
    mac-address cc:9d:a2:71:83:78
  exit
  unit 2
    mac-address cc:9d:a2:71:82:38
  exit
  enable
exit
  
hostname ESR-1 unit 1
hostname ESR-2 unit 2
  
security zone SYNC
exit
security zone DMZ
exit
security zone WAN
exit
  
bridge 1
  vlan 1
  security-zone SYNC
  ip address 198.51.100.254/24 unit 1
  ip address 198.51.100.253/24 unit 2
  vrrp id 1
  vrrp ip 198.51.100.1/24
  vrrp group 1
  vrrp
  enable
exit
  
interface gigabitethernet 1/0/1
  security-zone WAN
  ip address 203.0.113.254/24
exit
interface gigabitethernet 1/0/3
  mode switchport
  spanning-tree disable
exit
interface gigabitethernet 2/0/1
  security-zone WAN
  ip address 203.0.113.253/24
exit
interface gigabitethernet 2/0/3
  mode switchport
  spanning-tree disable
exit
  
security zone-pair SYNC self
  rule 1
    action permit
    match protocol icmp
    enable
  exit
  rule 2
    action permit
    match protocol vrrp
    enable
  exit
  rule 3
    action permit
    match protocol ah
    enable
  exit
exit
security zone-pair WAN self
  rule 1
    action permit
    enable
  exit
exit

...

Блок кода
titleESR-1
ESR-1(config)# security zone-pair WAN DMZ 
ESR-1(config-security-zone-pair)# rule 1
ESR-1(config-security-zone-pair-rule)# match destination-nat 
ESR-1(config-security-zone-pair-rule)# action permit 
ESR-1(config-security-zone-pair-rule)# enable 
ESR-1(config-security-zone-pair-rule)# exit 
ESR-1(config-security-zone-pair)# exit 
Итоговая конфигурация кластера:
Блок кода
cluster
  cluster-interface bridge 1
  unit 1
    mac-address 68:13:e2:7f:22:c0
  exit
  unit 2
    mac-address 68:13:e2:7f:10:30
  exit
  enable
exit

hostname ESR-1 unit 1
hostname ESR-2 unit 2

object-group service SERVER_DMZ
  port-range 80
exit

object-group network EXTERNAL_VIPS
  ip address-range 192.18.4.2
  ip address-range 192.18.5.2
exit

security zone SYNC
exit
security zone DMZ
exit
security zone WAN
exit

bridge 1
  vlan 1
  security-zone SYNC
  ip address 198.51.100.254/24 unit 1
  ip address 198.51.100.253/24 unit 2
  vrrp id 1
  vrrp ip 198.51.100.1/24
  vrrp group 1
  vrrp
  enable
exit

interface gigabitethernet 1/0/1
  security-zone WAN
  ip address 203.0.113.254/24
exit
interface gigabitethernet 1/0/2
  security-zone DMZ
  ip address 192.0.2.254/24
  vrrp id 10
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp
exit
interface gigabitethernet 1/0/3
  mode switchport
  spanning-tree disable
exit
interface gigabitethernet 2/0/1
  security-zone WAN
  ip address 203.0.113.253/24
exit
interface gigabitethernet 2/0/2
  security-zone DMZ
  ip address 192.0.2.253/24
  vrrp id 10
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp
exit
interface gigabitethernet 2/0/3
  mode switchport
  spanning-tree disable
exit

security zone-pair SYNC self
  rule 1
    action permit
    match protocol icmp
    enable
  exit
  rule 2
    action permit
    match protocol vrrp
    enable
  exit
  rule 3
    action permit
    match protocol ah
    enable
  exit
exit
security zone-pair WAN self
  rule 1
    action permit
    enable
  exit
exit
security zone-pair WAN DMZ
  rule 1
    action permit
    match destination-nat
    enable
  exit
exit

nat destination
  pool SERVER_DMZ
    ip address 192.0.2.10
  exit
  ruleset DNAT_SERVER_DMZ
    from zone WAN
    rule 1
      match protocol tcp
      match destination-address object-group EXTERNAL_VIPS
      match destination-port object-group SERVER_DMZ
      action destination-nat pool SERVER_DMZ
      enable
    exit
    rule 2
      match protocol udp
      match destination-address object-group EXTERNAL_VIPS
      match destination-port object-group SERVER_DMZ
      action destination-nat pool SERVER_DMZ
      enable
    exit
  exit
exit

...

С алгоритмом настройки BGP можно ознакомиться по ссылке в разделе: Алгоритм настройки BGP.

Пример настройки

...

eBGP с общим IP-адресом

Задача:

Настроить BGP-протокол в кластере маршрутизаторов ESR-1 и ESR-2 со следующими параметрами:

...

Блок кода
titleESR-1
cluster
  cluster-interface bridge 1
  unit 1
    mac-address cc:9d:a2:71:83:78
  exit
  unit 2
    mac-address cc:9d:a2:71:82:38
  exit
  enable
exit

hostname ESR-1 unit 1
hostname ESR-2 unit 2

security zone SYNC
exit
security zone LAN
exit

bridge 1
  vlan 1
  security-zone SYNC
  ip address 198.51.100.254/24 unit 1
  ip address 198.51.100.253/24 unit 2
  vrrp id 1
  vrrp ip 198.51.100.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
  enable
exit

interface gigabitethernet 1/0/2
  security-zone LAN
  ip address 192.0.2.254/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 1/0/3
  mode switchport
  spanning-tree disable
exit
interface gigabitethernet 2/0/2
  security-zone LAN
  ip address 192.0.2.253/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 2/0/3
  mode switchport
  spanning-tree disable
exit

security zone-pair SYNC self
  rule 1
    action permit
    match protocol icmp
    enable
  exit
  rule 2
    action permit
    match protocol vrrp
    enable
  exit
  rule 3
    action permit
    match protocol ah
    enable
  exit
exit
security zone-pair LAN self
  rule 1
    action permit
    match protocol vrrp
    enable
  exit
  rule 2
    action permit
    match protocol ah
    enable
  exit
exit
Решение:

Сконфигурируем необходимые сетевые интерфейсы:

Блок кода
ESR-1(config)# interface gigabitethernet 1/0/1
ESR-1(config-if-gi)# ip address 203.0.113.254/24
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# ip address 203.0.113.253/24
ESR-1(config-if-gi)# exit

Сконфигурируем зону безопасности WAN, настроем firewall для приема маршрутизатором BGP-трафика из зоны безопасности WAN, а также разрешим прохождение трафика из зоны LAN в зону WAN:

Блок кода
ESR-1(config)# object-group service og_bgp
ESR-1(config-object-group-service)# port-range 179
ESR-1(config-object-group-service)# exit
ESR-1(config)# security zone WAN
ESR-1(config-security-zone)# exit
ESR-1(config)# security zone-pair WAN self 
ESR-1(config-security-zone-pair)# rule 1
ESR-1(config-security-zone-pair-rule)# action permit
ESR-1(config-security-zone-pair-rule)# match protocol vrrp
ESR-1(config-security-zone-pair-rule)# enable
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# rule 2
ESR-1(config-security-zone-pair-rule)# action permit
ESR-1(config-security-zone-pair-rule)# match protocol ah
ESR-1(config-security-zone-pair-rule)# enable
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# rule 3
ESR-1(config-security-zone-pair-rule)# action permit
ESR-1(config-security-zone-pair-rule)# match protocol icmp
ESR-1(config-security-zone-pair-rule)# enable
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# rule 4
ESR-1(config-security-zone-pair-rule)# match protocol tcp
ESR-1(config-security-zone-pair-rule)# match destination-port object-group og_bgp 
ESR-1(config-security-zone-pair-rule)# action permit 
ESR-1(config-security-zone-pair-rule)# enable 
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# exit

И укажем принадлежность интерфейсов к зоне безопасности:

Блок кода

ESR-1(config)# interface gigabitethernet 1/0/1 security zone-pair LAN WAN 
ESR-1(config-security-ifzone-gipair)# security-zone WAN rule 1
ESR-1(config-if-gisecurity-zone-pair-rule)# action exitpermit
ESR-1(config-security-zone-pair-rule)# interface gigabitethernet 2/0/1enable
ESR-1(config-security-zone-ifpair-girule)# security-zone WAN exit
ESR-1(config-ifsecurity-zone-gipair)# exit

Укажем принадлежность интерфейсов к зоне безопасности:

Блок кода
ESR-1(config)# interface gigabitethernet 1/0/1
ESR-1(config-if-gi)# security-zone WAN 
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# security-zone WAN 
ESR-1(config-if-gi)# exit

Scroll Pagebreak

Настроем vrrp адрес на интерфейсе, с которого в дальнейшем будем строить BGP соседство:

Блок кода
ESR-1(config)# interface gigabitethernet 1/0/1
ESR-1(config-if-gi)# vrrp id 4
ESR-1(config-if-gi)# vrrp ip 203.0.113.1/24
ESR-1(config-if-gi)# vrrp group 1
ESR-1(config-if-gi)# vrrp authentication key ascii-text encrypted 88B11079B51D
ESR-1(config-if-gi)# vrrp authentication algorithm md5
ESR-1(config-if-gi)# vrrp
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# vrrp id 4
ESR-1(config-if-gi)# vrrp ip 203.0.113.1/24
ESR-1(config-if-gi)# vrrp group 1
ESR-1(config-if-gi)# vrrp authentication key ascii-text encrypted 88B11079B51D
ESR-1(config-if-gi)# vrrp authentication algorithm md5
ESR-1(config-if-gi)#   vrrp
ESR-1(config-if-gi)# exit

...

Блок кода
ESR-1(config)# route-map bgp-out
ESR-1(config-route-map)# rule 1
ESR-1(config-route-map-rule)# match ip address 198.51.100.0/24
ESR-1(config-route-map-rule)# action deny
ESR-1(config-route-map-rule)# exit
ESR-1(config-route-map)# rule 2
ESR-1(config-route-map-rule)# action permit
ESR-1(config-route-map-rule)# exit
ESR-1(config-route-map)# exit

...

Блок кода
ESR-1(config-bgp-neighbor)# enable
ESR-1(config-bgp-neighbor)# exit
ESR-1(config-bgp)# enable
ESR-1(config-bgp)# exit

Применим конфигурацию на Active устройстве.

Информацию о BGP-пирах можно посмотреть командой show bgp neighbors:

Блок кода
ESR-1# show bgp neighbors 
BGP neighbor is 203.0.113.2
    BGP state:                          Established
    Type:                               Static neighbor
    Neighbor address:                   203.0.113.2
    Neighbor AS:                        3000
    Neighbor ID:                        8.8.8.8
    Neighbor caps:                      refresh enhanced-refresh restart-aware AS4
    Session:                            external AS4
    Source address:                     203.0.113.1
    Weight:                             0
    Hold timer:                         111/180
    Keepalive timer:                    23/60
    RR client:                          No
    Address family ipv4 unicast:       
      Send-label:                       No
      Default originate:                No
      Default information originate:    No
      Outgoing route-map:               bgp-out
      Preference:                       170
      Remove private AS:                No
      Next-hop self:                    No
      Next-hop unchanged:               No
    Uptime (d,h:m:s):                   00,00:03:06

...

Примечание

В случае выхода из строя Active устройства, BGP будет полностью переустанавливаться со Standby устройством.

Итоговая конфигурация кластера:

Пример настройки eBGP с каждым участником кластера по индивидуальным IP-адресам

Задача:

Настроить BGP-протокол в кластере маршрутизаторов ESR-1 и ESR-2 со следующими параметрами:

  • соседство устанавливается с каждым маршрутизатором в кластере индивидуально;
  • клиентская подсеть: 192.0.2.0/24;
  • анонсирование подсетей, подключенных напрямую;
  • собственная AS 2500;
  • соседство для ESR-1 – подсеть 203.0.113.0/30, IP-адрес для подключения 203.0.113.1, IP-адрес соседа 203.0.113.2, AS3000;
  • соседство для ESR-2 – подсеть 203.0.113.4/30, IP-адрес для подключения 203.0.113.5, IP-адрес соседа 203.0.113.6, AS3500.

Image Added

Исходные конфигурации маршрутизаторов в кластере:
Блок кода
titleESR-1
cluster
  cluster-interface bridge 1
  unit 1
Блок кода
cluster
  cluster-interface bridge 1
  unit 1
    mac-address cc:9d:a2:71:83:78
  exit
  unit 2
    mac-address cc:9d:a2:71:82:38
  exit
  enable
exit

hostname ESR-1 unit 1
hostname ESR-2 unit 2

object-group service og_bgp
  port-range 179
exit

security zone SYNC
exit
security zone LAN
exit
security zone WAN
exit

route-map bgp-out
bridge 1
  rulevlan 1
  security-zone SYNC
 match ip address 198.51.100.0254/24
 unit   action deny1
  exit
ip  rule 2
  exit
exit

router bgp 2500
  neighbor 203.0.113.address 198.51.100.253/24 unit 2
  vrrp id remote-as 30001
  vrrp ip update-source 203.0.113198.51.100.1/24
  vrrp  address-family ipv4 unicastgroup 1
  vrrp authentication key  routeascii-maptext bgp-outencrypted out88B11079B51D
  vrrp authentication algorithm  enablemd5
    exitvrrp
    enable
  exit
  address-family ipv4 unicast
    redistribute connected
  exit
  enable
exit

bridge 1
  vlan 1
interface gigabitethernet 1/0/2
  security-zone SYNCLAN
  ip address 198192.510.1002.254/24
 unit 1 vrrp id 2
  ip address 198.51.100.253/24 unit 2
  vrrp id 1
  vrrp ip 198192.510.1002.1/24
  vrrp group 1
  vrrp
  enable
exit

interface gigabitethernet 1/0/1
  security-zone WAN
  ip address 203.0.113.254/24authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication idalgorithm 4md5
  vrrp
exit
interface ipgigabitethernet 203.0.113.1/241/0/3
  vrrpmode group 1switchport
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
spanning-tree disable
exit
interface gigabitethernet 12/0/2
  security-zone LAN
  ip address 192.0.2.254253/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 12/0/3
  mode switchport
  spanning-tree disable
exit
interface gigabitethernet 2/0/1
security zone-pair SYNC self
  security-zonerule WAN1
  ip  address 203.0.113.253/24
  vrrp id 4action permit
    match protocol icmp
  vrrp  ip 203.0.113.1/24enable
  exit
  vrrprule group 12
  vrrp authentication key ascii-text encrypted 88B11079B51Daction permit
  vrrp authentication algorithmmatch md5
protocol  vrrp
exit
interface gigabitethernet 2/0/2
  security-zone LANenable
  ip address 192.0.2.253/24exit
  vrrprule id 23
  vrrp ip 192.0.2.1/24
  vrrp group 1 action permit
  vrrp authentication keymatch ascii-text encrypted 88B11079B51Dprotocol ah
  vrrp authentication algorithm md5enable
  vrrp
exit
interface gigabitethernet 2/0/3
  mode switchport
  spanning-tree disable
exit

security zone-pair SYNCLAN self
  rule 1
    action permit
    match protocol icmpvrrp
    enable
  exit
  rule 2
    action permit
    match protocol vrrpah
    enable
  exit
exit
Решение:

Сконфигурируем необходимые сетевые интерфейсы:

Блок кода
ESR-1(config)# interface rule 3
    action permit
    match protocol ah
    enable
  exit
exit
security zone-pair LAN self
  rule 1
    action permit
    enable
  exit
exit
security zone-pair WAN self
  rule 1
    action permit
    match protocol vrrp
    enable
  exit
  rule 2
    action permit
    match protocol ah
    enable
  exit
  rule 3
    action permit
    match protocol icmp
    enable
  exit
  rule 4
    action permit
    match protocol tcp
    match destination-port object-group og_bgp
    enable
  exit
exit

Пример настройки 2

Задача:

Настроить BGP-протокол в кластере маршрутизаторов ESR-1 и ESR-2 со следующими параметрами:

  • соседство устанавливается с каждым маршрутизатором в кластере индивидуально;
  • клиентская подсеть: 192.0.2.0/24;
  • анонсирование подсетей, подключенных напрямую;
  • собственная AS 2500;
  • соседство для ESR-1 – подсеть 203.0.113.0/30, IP-адрес для подключения 203.0.113.1, IP-адрес соседа 203.0.113.2, AS3000;
  • соседство для ESR-2 – подсеть 203.0.113.4/30, IP-адрес для подключения 203.0.113.5, IP-адрес соседа 203.0.113.6, AS3500.

Image Removed

Исходные конфигурации маршрутизаторов в кластере:
gigabitethernet 1/0/1
ESR-1(config-if-gi)# ip address 203.0.113.1/30
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# ip address 203.0.113.5/30
ESR-1(config-if-gi)# exit

Сконфигурируем зону безопасности WAN, настроем firewall для приема маршрутизатором BGP-трафика из зоны безопасности WAN, а также разрешим прохождение трафика из зоны LAN в зону WAN:

Блок кода
ESR-1(config)# object-group service og_bgp
ESR-1(config-object-group-service)# port-range 179
ESR-1(config-object-group-service)# exit
ESR-1(config)# security zone WAN
ESR-1(config-security-zone)# exit
ESR-1(config)# security zone-pair WAN self 
ESR-1(config-security-zone-pair)# rule 1
ESR-1(config-security-zone-pair-rule)# action permit
ESR-1(config-security-zone-pair-rule)# match protocol icmp
ESR-1(config-security-zone-pair-rule)# enable
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# rule 2
ESR-1(config-security-zone-pair-rule)# match protocol tcp
ESR-1(config-security-zone-pair-rule)# match destination-port object-group og_bgp 
ESR-1(config-security-zone-pair-rule)# action permit 
ESR-1(config-security-zone-pair-rule)# enable 
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# exit
ESR-1(config)# security zone-pair LAN WAN 
ESR-1(config-security-zone-pair)# rule 1
ESR-1(config-security-zone-pair-rule)# action permit
ESR-1(config-security-zone-pair-rule)# enable
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# exit

И укажем принадлежность интерфейсов к зоне безопасности:

Блок кода
ESR-1(config)# interface gigabitethernet 1/0/1
ESR-1(config-if-gi)# security-zone WAN 
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# security-zone WAN 
ESR-1(config-if-gi)# exit

Scroll Pagebreak

Создадим track для последующего управления анонсами маршрутов в кластере.

Блок кода
ESR-1(config)# track 1
ESR-1(config-track)# track vrrp id 1 state not master 
ESR-1(config-track)# enable 
ESR-1(config-track)# exit

Создадим route-map, который будет использоваться в дальнейшем при настройке разрешающих анонсов роутерам из другой AS. В route-map запретим анонсировать подсеть для cluster-interface, а также настроим управление as-path prepend для управлениями анонсами bgp:

Блок кода
ESR-1(config)# route-map bgp-out
ESR-1(config-route-map)# rule 1
ESR-1(config-route-map-rule)# match
Блок кода
titleESR-1
cluster
  cluster-interface bridge 1
  unit 1
    mac-address cc:9d:a2:71:83:78
  exit
  unit 2
    mac-address cc:9d:a2:71:82:38
  exit
  enable
exit

hostname ESR-1 unit 1
hostname ESR-2 unit 2

security zone SYNC
exit
security zone LAN
exit

bridge 1
  vlan 1
  security-zone SYNC
  ip address 198.51.100.254/24 unit 1
  ip address 198.51.100.2530/24 unit 2
  vrrp id 1
  vrrp ip 198.51.100.1/24
  vrrp group 1
  vrrp
  enable
exit

interface gigabitethernet 1/0/2
  security-zone LAN
  ip address 192.0.2.254/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 1/0/3
  mode switchport
  spanning-tree disable
exit
interface gigabitethernet 2/0/2
  security-zone LAN
  ip address 192.0.2.253/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 2/0/3
  mode switchport
  spanning-tree disable
exit

security zone-pair SYNC self
  rule 1
    action permit
    match protocol icmp
    enable
  exit
  rule 2
    action permit
    match protocol vrrp
    enable
  exit
  rule 3
    action permit
    match protocol ah
    enable
  exit
exit
security zone-pair LAN self
  rule 1
    action permit
    enable
  exit
exit
Решение:

Сконфигурируем необходимые сетевые интерфейсы:

Блок кода
ESR-1(config)# interface gigabitethernet 1/0/1
ESR-1(config-if-gi)# ip address 203.0.113.1/30
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# ip address 203.0.113.5/30
ESR-1(config-if-gi)# exit

ESR-1(config-route-map-rule)# action deny 
ESR-1(config-route-map-rule)# exit
ESR-1(config-route-map)# rule 2
ESR-1(config-route-map-rule)# action set as-path prepend 20 track 1
ESR-1(config-route-map-rule)# action permit 
ESR-1(config-route-map-rule)# exit
ESR-1(config-route-map)# exit

Создадим BGP процесс для AS 2500 для ESR-1 и войдем в режим конфигурирования параметров процесса:

Блок кода
ESR-1(config)# router bgp 2500 unit 1

Сконфигурируем анонсирование подсетей, подключенных напрямую:

Блок кода
ESR-1(config-bgp)# address-family ipv4 unicast 
ESR-1(config-bgp-af)# redistribute connected 
ESR-1(config-bgp-af)# exit

Создадим eBGP с вышестоящим роутером:

Блок кода
ESR-1(config-bgp)# neighbor 203.0.113.2
ESR-1(config-bgp-neighbor)# remote-as 3000
ESR-1(config-bgp-neighbor)# update-source 203.0.113.1

И включим обмен IPv4-маршрутами:

Блок кода
ESR-1(config-bgp-neighbor)# address-family ipv4 unicast
ESR-1(config-bgp-neighbor-af)# route-map bgp-out out
ESR-1(config-bgp-neighbor-af)# enable
ESR-1(config-bgp-neighbor-af)# exit

Включим работу протокола:

Блок кода
ESR-1(config-bgp-neighbor)# enable
ESR-1(config-bgp-neighbor)# exit
ESR-1(config-bgp)# enable
ESR-1(config-bgp)# exit

Создадим BGP процесс для AS 2500 для ESR-2 и войдем в режим конфигурирования параметров процесса:

Блок кода
ESR-1(config)# router bgp 2500 unit 2

Сконфигурируем анонсирование подсетей, подключенных напрямую:

Блок кода
ESR-1(config-bgp)# address-family ipv4 unicast 
ESR-1(config-bgp-af)# redistribute connected 
ESR-1(config-bgp-af)# exit

Создадим eBGP с вышестоящим роутером:

Блок кода
ESR-1(config-bgp)# neighbor 203.0.113.6
ESR-1(config-bgp-neighbor)# remote-as 3500
ESR-1(config-bgp-neighbor)# update-source 203.0.113.5

И включим обмен IPv4-маршрутамиСконфигурируем firewall для приема маршрутизатором BGP-трафика из зоны безопасности WAN:

Блок кода
ESR-1(config-bgp-neighbor)# objectaddress-groupfamily serviceipv4 og_bgpunicast
ESR-1(config-objectbgp-groupneighbor-serviceaf)# route-map portbgp-rangeout 179out
ESR-1(config-objectbgp-groupneighbor-serviceaf)# exitenable
ESR-1(config)# security zone WAN
ESR-1(config-security-zone-bgp-neighbor-af)# exit

Включим работу протокола:

Блок кода

ESR-1(config)# security zone-pair WAN self 
ESR-1(config-security-zone-pair-bgp-neighbor)# rule 1enable
ESR-1(config-security-zone-pair-rule)# action permit
ESR-1(config-security-zone-pair-rule)# match protocol icmp
ESR-1(config-security-zone-pair-rule)# enable
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# rule 2
ESR-1(config-security-zone-pair-rule)# match protocol tcp
ESR-1(config-security-zone-pair-rule)# match destination-port object-group og_bgp 
ESR-1(config-security-zone-pair-rule)# action permit 
ESR-1(config-security-zone-pair-rule)# enable 
ESR-1(config-security-zone-pair-rule)# exit
ESR-1(config-security-zone-pair)# exit

И укажем принадлежность интерфейсов к зоне безопасности:

Блок кода
ESR-1(config)# interface gigabitethernet 1/0/1
ESR-1(config-if-gi)# security-zone WAN 
ESR-1(config-if-gi)# exit
ESR-1(config)# interface gigabitethernet 2/0/1
ESR-1(config-if-gi)# security-zone WAN 
ESR-1(config-if-gi)# exit

Scroll Pagebreak

Создадим track для последующего управления анонсами маршрутов в кластере.

Блок кода
ESR-1(config)# track 1
ESR-1(config-track)# track vrrp id 1 state not master 
ESR-1(config-track)# enable 
ESR-1(config-track)# exit

Создадим route-map, который будет использоваться в дальнейшем при настройке разрешающих анонсов роутерам из другой AS. В route-map запретим анонсировать подсеть для cluster-interface, а также настроим управление as-path prepend для управлениями анонсами bgp:

Блок кода
ESR-1(config)# route-map bgp-out
ESR-1(config-route-map)# rule 1
ESR-1(config-route-map-rule)# match ip address 198.51.100.0/24
ESR-1(config-route-map-rule)# action deny 
ESR-1(config-route-map-rule)# exit
ESR-1(config-route-map)# rule 2
ESR-1(config-route-map-rule)# action set as-path prepend 20 track 1
ESR-1(config-route-map-rule)# action permit 
ESR-1(config-route-map-rule)# exit
ESR-1(config-route-map)# exit

Создадим BGP процесс для AS 2500 для ESR-1 и войдем в режим конфигурирования параметров процесса:

Блок кода
ESR-1(config)# router bgp 2500 unit 1

Сконфигурируем анонсирование подсетей, подключенных напрямую:

Блок кода
ESR-1(config-bgp)# address-family ipv4 unicast 
ESR-1(config-bgp-af)# redistribute connected 
ESR-1(config-bgp-af)# exit

Создадим eBGP с вышестоящим роутером:

Блок кода
ESR-1(config-bgp)# neighbor 203.0.113.2
ESR-1(config-bgp-neighbor)# remote-as 3000
ESR-1(config-bgp-neighbor)# update-source 203.0.113.1

И включим обмен IPv4-маршрутами:

Блок кода
ESR-1(config-bgp-neighbor)# address-family ipv4 unicast
ESR-1(config-bgp-neighbor-af)# route-map bgp-out out
ESR-1(config-bgp-neighbor-af)# enable
ESR-1(config-bgp-neighbor-af)# exit

Включим работу протокола:

Блок кода
ESR-1(config-bgp-neighbor)# enable
ESR-1(config-bgp-neighbor)# exit
ESR-1(config-bgp)# enable
ESR-1(config-bgp)# exit

Создадим BGP процесс для AS 2500 для ESR-2 и войдем в режим конфигурирования параметров процесса:

Блок кода
ESR-1(config)# router bgp 2500 unit 2

Сконфигурируем анонсирование подсетей, подключенных напрямую:

Блок кода
ESR-1(config-bgp)# address-family ipv4 unicast 
ESR-1(config-bgp-af)# redistribute connected 
ESR-1(config-bgp-af)# exit

Создадим eBGP с вышестоящим роутером:

Блок кода
ESR-1(config-bgp)# neighbor 203.0.113.6
ESR-1(config-bgp-neighbor)# remote-as 3500
ESR-1(config-bgp-neighbor)# update-source 203.0.113.5

И включим обмен IPv4-маршрутами:

Блок кода
ESR-1(config-bgp-neighbor)# address-family ipv4 unicast
ESR-1(config-bgp-neighbor-af)# route-map bgp-out out
ESR-1(config-bgp-neighbor-af)# enable
ESR-1(config-bgp-neighbor-af)# exit

Включим работу протокола:

Блок кода
ESR-1(config-bgp-neighbor)# enable
ESR-1(config-bgp-neighbor)# exit
ESR-1(config-bgp)# enable
ESR-1(config-bgp)# exit

Информацию о BGP-пирах можно посмотреть командой:

Блок кода
ESR-1# show bgp neighbors 
BGP neighbor is 203.0.113.2
    BGP state:                          Established
    Type:                               Static neighbor
    Neighbor address:                   203.0.113.2
    Neighbor AS:                        3000
    Neighbor ID:                        8.8.8.8
    Neighbor caps:                      refresh enhanced-refresh restart-aware AS4
    Session:                            external AS4
    Source address:                     203.0.113.1
    Weight:                             0
    Hold timer:                         120/180
    Keepalive timer:                    49/60
    RR client:                          No
    Address family ipv4 unicast:       
      Send-label:                       No
      Default originate:                No
      Default information originate:    No
      Outgoing route-map:               bgp-out
      Preference:                       170
      Remove private AS:                No
      Next-hop self:                    No
      Next-hop unchanged:               No
    Uptime (d,h:m:s):                   00,00:03:40  
bgp-neighbor)# exit
ESR-1(config-bgp)# enable
ESR-1(config-bgp)# exit

Применим конфигурацию на Active устройстве.

Информацию о BGP-пирах можно посмотреть командой:

Блок кода
ESR-1#
Блок кода
ESR-2# show bgp neighbors 
BGP neighbor is 203.0.113.62
    BGP state:                          Established
    Type:                               Static neighbor
    Neighbor address:                   203.0.113.62
    Neighbor AS:                        35003000
    Neighbor ID:                        8.8.8.8
    Neighbor caps:                      refresh enhanced-refresh restart-aware AS4
    Session:                            external AS4
    Source address:                     203.0.113.51
    Weight:                             0
    Hold timer:                         138120/180
    Keepalive timer:                    5649/60
    RR client:                          No
    Address family ipv4 unicast:       
      Send-label:                       No
      Default originate:                No
      Default information originate:    No
      Outgoing route-map:               bgp-out
      Preference:                       170
      Remove private AS:                No
      Next-hop self:                    No
      Next-hop unchanged:               No
    Uptime (d,h:m:s):                   00,00:03:40  


Блок кода
ESR-2# show bgp neighbors 
BGP neighbor is 203.0.113.6
    BGP state:           No
    Uptime (d,h:m:s):          Established
    Type:     00,00:03:42 

Таблицу маршрутов протокола BGP можно просмотреть с помощью команды:

Блок кода
ESR-1# show bgp ipv4 unicast neighbor 203.0.113.2 advertise-routes 
Status codes: u - unicast, b - broadcast, m - multicast, a - anycast
    Static neighbor
    Neighbor address:    * - valid, > - best
Origin codes: i - IGP, e - EGP, ? - incomplete
 203.0.113.6
    Neighbor NetworkAS:              Next Hop         3500
    MetricNeighbor ID: LocPrf      Weight Path        
*> u 192.0.2.0/24         203.0.113.1   8.8.8.8
    Neighbor caps:       --      --         refresh enhanced-refresh restart-aware AS4
    Session: 2500 ?
*  u 192.0.2.0/24         203.0.113.1          --    external AS4
 --   Source address:      --     2500 ?
*> u 203.0.113.0/30       203.0.113.15
    Weight:      --      --          --     2500 ?
ESR-1# show bgp ipv4 unicast neighbor 203.0.113.2 routes 
Status codes: u - unicast,Hold btimer: - broadcast, m - multicast, a - anycast
              * - valid, > - best
Origin codes: i - IGP, e - EGP, ? - incomplete

 138/180
    Keepalive timer:          Network          56/60
    NextRR Hopclient:             Metric  LocPrf      Weight Path        
*> u 0.0.0.0/0     No
    Address family ipv4 unicast:       203.0.113.2
      Send-label:    --      100         0    No
  3000 ?
Блок кода
ESR-2# show bgp ipv4 unicastDefault neighbor 203.0.113.6 advertise-routes 
Status codes: u - unicast, b - broadcast, m - multicast, a - anycastoriginate:                No
      Default information originate:    No
  *  - valid, >Outgoing - best
Origin codesroute-map: i - IGP, e - EGP, ? - incomplete

     Network bgp-out
      Preference:       Next Hop             Metric  LocPrf170
      WeightRemove Pathprivate AS:       
*> u 192.0.2.0/24       No
  203.0.113.5    Next-hop self:     --      --         No
 --     2500 20 ?
*> u 203.0.113.4/30Next-hop unchanged:          203.0.113.5     No
     --Uptime (d,h:m:s):      --          --   00,00:03:42 

Таблицу маршрутов протокола BGP можно просмотреть с помощью команды:

Блок кода
ESR-1#  2500 20 ?
ESR-2# show bgp ipv4 unicast neighbor 203.0.113.62 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 192.0.2.0/24         203.0.113.1          --      --          --     2500 ?
*  u 192.0.2.0/24         203.0.113.1          --      --          --     2500 ?
*> u 203.0.113.60/30       203.0.113.1          --      --          --     2500  100         0      3500 ?
Итоговая конфигурация кластера:
Блок кода
cluster
  cluster-interface bridge 1
  unit 1
    mac-address cc:9d:a2:71:83:78
  exit
  unit 2
    mac-address cc:9d:a2:71:82:38
  exit
  enable
exit

hostname ESR-1 unit 1
hostname ESR-2 unit 2

object-group service og_bgp
  port-range 179
exit

security zone SYNC
exit
security zone LAN
exit
security zone WAN
exit

route-map bgp-out
  rule 1
    match ip address 198.51.100.0/24
    action deny
  exit
  rule 2
    action set as-path prepend 20 track 1
  exit
exit

router bgp 2500 unit 1
  neighbor 203.0.113.2
    remote-as 3000
    update-source?
ESR-1# show bgp ipv4 unicast neighbor 203.0.113.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 0.0.0.0/0            203.0.113.1
 2   address-family ipv4 unicast
      route-map bgp-out out
     100 enable
    exit
    enable
0  exit
  address-family ipv4 unicast
    redistribute connected
  exit
  enable
exit
router3000 ?


Блок кода
ESR-2# show bgp 2500 unit 2
 ipv4 unicast neighbor 203.0.113.6 advertise-routes 
Status codes: u - remote-as 3500
    update-source 203.0.113.5
    address-family ipv4 unicastunicast, b - broadcast, m - multicast, a - anycast
      route-map bgp-out out
      enable
* - valid, > exit
    enable
  exit
  address-family ipv4 unicast
- best
Origin codes: i - IGP, e - EGP, ? - incomplete

     redistributeNetwork connected
  exit
  enable
exit

bridge 1
  vlan 1
  security-zone SYNC
  ipNext address 198.51.100.254/24 unit 1
  ip address 198.51.100.253/24 unit 2
  vrrp id 1
  vrrp ip 198.51.100.1/24
  vrrp group 1
  vrrp
  enable
exit

interface gigabitethernet 1/0/1
  security-zone WAN
  ip address 203.0.113.1/30
exit
interface gigabitethernet 1/0/2
  security-zone LAN
  ip address 192.0.2.254/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 1/0/3
  mode switchport
  spanning-tree disable
exit
interface gigabitethernet 2/0/1
  security-zone WAN
  ip addressHop             Metric  LocPrf      Weight Path        
*> u 192.0.2.0/24         203.0.113.5          --      --          --     2500 20 ?
*> u 203.0.113.4/30       203.0.113.5/30
exit
interface gigabitethernet 2/0/2
  security-zone LAN
  ip address 192.0.2.253/24
  vrrp id 2
  vrrp ip 192.0.2.1/24
  vrrp group 1
  vrrp authentication key ascii-text encrypted 88B11079B51D
  vrrp authentication algorithm md5
  vrrp
exit
interface gigabitethernet 2/0/3
  mode switchport
  spanning-tree disable
exit

security zone-pair SYNC self
  rule 1
    action permit
    match protocol icmp
    enable
  exit
  rule 2
    action permit
    match protocol vrrp
    enable
  exit
  rule 3
    action permit
    match protocol ah
    enable
  exit
exit
security zone-pair LAN self
  rule 1
    action permit
    enable
  exit
exit
security zone-pair WAN self
  rule 1
    action permit
    match protocol icmp
    enable
  exit
  rule 2
    action permit
    match protocol tcp
    match destination-port object-group og_bgp
    enable
  exit
exit

track 1
  track vrrp id 1 state not master
  enable
exit --      --          --     2500 20 ?
ESR-2# show bgp ipv4 unicast neighbor 203.0.113.6 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 0.0.0.0/0            203.0.113.6          --      100         0      3500 ?