вторник, 5 апреля 2016 г.

Common Routing Problem with OSPF Forwarding Address

OSPF Forwarding Address

Концепция OSPF forwarding address была введена для предотвращения лишнего хопа, в процессе маршрутизации трафика во внешнюю автономную систему (external autonomous system), как это отражено на рисунке ниже.
10a.gif
На рисунке мы видим 2 маршрутизатора в OSPF домене, которые подключены к внешнему домену. Тем не менее, только Router 1 обменивается маршрутной информацией с Router 100. Router 1 перераспределяет (redistributes) полученную маршрутную информацию от Router 100 в OSPF домен.
При этом, Router 1 становится next hop (или forwarding address) для маршрутов которые были перераспределены (redistribute) в OSPF domain. Когда Router 2 получает пакет с внутреннего OSPF домена, направленный на external domain, он отправляет пакет на Router 1. Router 1 потом отправляет его на Router 100.

Концепция forwarding address позволяет избежать ситуации с дополнительным хопом, потому что становится возможным Router 1 назначить IP адрес другого роутера в качестве forwarding address. в нашем рисунке, Router 1 может назначить Router 100 в качестве  forwarding address для внешних маршрутов которые  Router 1 перераспределяет в OSPF домен. Когда Router 2 получает пакет с OSPF домена предназначенный для адреса во внешней AS, он отправляет его на Router 100, вместо Router 1. Как результат - мы избавились от лишнего и ненужного промежуточного узла на пути прохождения трафика.
Значение forwarding address устанавливается autonomous system boundary router (ASBR) (Router 1 на нашей картинке) и может быть как 0.0.0.0 так и non-zero. Значение 0.0.0.0  говорит о том, что originating router (the ASBR) является next hop-ом.. Forwarding address определяется по следующим критериям:


Forwarding address устанавливается в 0.0.0.0:
  •  ASBR redistributes routes and OSPF is not enabled on the next hop interface for those routes
 Это справедливо для нашего рисунка, если в конфигурации Router 1 OSPF не включен на Ethernet интерфейсе.


Forwarding address устанавливается в non-zero:
  • OSPF is enabled on the ASBR's next hop interface AND
  • ASBR's next hop interface is non-passive under OSPF AND
  • ASBR's next hop interface is not point-to-point AND
  • ASBR's next hop interface is not point-to-multipoint AND
  • ASBR's next hop interface address falls under the network range specified in the router ospf command.
  • Любые другие условия, кроме этих установят значение поля forwarding address в 0.0.0.0.
Для информации о том, как устанавливается forwarding address и как влияет на выбор пути смотрите The Effects of the Forwarding Address on Type 5 LSA Path Selection.

Common OSPF Routing Problem Related to the Forwarding Address

10b_01.gif
Маршрутизатор  R2513 работает только по RIP-у, включен в сеть Token Ring как на рисунке. Когда маршруты полученные от R2513 будут перераспределены в OSPF домен нашим ASBR (R2515), некоторые из этих маршрутов так и не попадут в RIB некоторых из этих маршрутизаторов. Конфигурация представлена ниже.
hostname R2504
interface Serial0
ip address 1.1.1.2 255.255.255.0
         
interface TokenRing0
ip address 3.3.4.2 255.255.255.0
         
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
network 3.0.0.0 0.255.255.255 area 1
area 1 range 3.0.0.0 255.0.0.0
hostname R2507
interface Serial0
ip address 1.1.1.1 255.255.255.0
         
interface Serial1
ip address 7.7.7.1 255.255.255.0
         
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
default- information originate metric 20
         
ip route 0.0.0.0 0.0.0.0 Serial1 
hostname R2513
interface TokenRing0
ip address 3.3.4.4 255.255.255.0
       
interface ethernet 0
ip address 200.1.1.4 255.255.255.0
       
router rip
network 3.0.0.0
network 200.1.1.0
hostname R2515
interface TokenRing0
ip address 3.3.4.3 255.255.255.0
       
interface ethernet 0
ip address 3.44.66.3 255.255.255.0
       
interface ethernet 1
ip address 3.22.88.3 255.255.255.0
       
router ospf 1
redistribute rip metric 20 subnets
network 0.0.0.0 255.255.255.255 area 1
       
router rip
network 3.0.0.0

passive-interface ethernet 0
passive-interface ethernet 1
В конфигурации видно , что наш ASBR  R2515 делает редистрибьюцию  RIP в OSPF , а также то что R2504 (area border router [ABR]) создает суммарный маршрут до сети 3.0.0.0/8.
Внизу представлена таблица RIB для каждого маршрутизатора с включенным OSPF:
R2507# 
show ip route

Gateway of last resort is 0.0.0.0 to network 0.0.0.0
         1.0.0.0/ 24 is subnetted, 1 subnets
C          1.1.1.0 is directly connected, Serial0
         3.0.0.0/ 8 is variably subnetted, 4 subnets, 2 masks
O IA        3.0.0.0/ 8 [110/ 70] via 1.1.1.2, 00: 15: 37, Serial0
O E2        3.3.4.0/ 24 [110/ 20] via 1.1.1.2, 00: 06: 37, Serial0
O E2        3.22.88.0/ 24 [110/ 20] via 1.1.1.2, 00: 06: 37, Serial0
O E2        3.44.66.0/ 24 [110/ 20] via 1.1.1.2, 00: 06: 37, Serial0
          7.0.0.0/ 24 is subnetted, 1 subnets
C           7.7.7.0 is directly connected, Serial1
S*     0.0.0.0/ 0 is directly connected, Serial1


R2504# show ip route
Gateway of last resort is 1.1.1.1 to network 0.0.0.0
            1.0.0.0/ 24 is subnetted, 1 subnets
C             1.1.1.0 is directly connected, Serial0
            3.0.0.0/ 8 is variably subnetted, 4 subnets, 2 masks
S             3.0.0.0/ 8 is directly connected, Null0
C             3.3.4.0/ 24 is directly connected, TokenRing0
O             3.22.88.0/ 24 [110/ 11117] via 3.3.4.3, 00: 15: 16, TokenRing0
O             3.44.66.0/ 24 [110/ 11117] via 3.3.4.3, 00: 15: 16, TokenRing0
O  E2 200.1.1.0/ 24 [110/ 20] via 3.3.4.4, 00: 06: 16, TokenRing0
O* E2 0.0.0.0/ 0 [110/ 20] via 1.1.1.1, 00: 15: 16, Serial0

R2515# show ip route
 Gateway of last resort is 3.3.4.2 to network 0.0.0.0
            1.0.0.0/ 24 is subnetted, 1 subnets
 O IA         1.1.1.0 [110/ 70] via 3.3.4.2, 00: 10: 28, TokenRing0
            3.0.0.0/ 24 is subnetted, 3 subnets
 C            3.3.4.0 is directly connected, TokenRing0
 R          200.1.1.0/ 24 [120/ 1] via 3.3.4.4, 00: 00: 10, TokenRing0
 O* E2 0.0.0.0/ 0 [110/ 20] via 3.3.4.2, 00: 10: 28, TokenRing0

Отсутствие сети в RIB (200.1.1.0/24)

R2515 получил через RIP (R) маршрут для сети 200.1.1.0/24. R2515 наш  ASBR и он редистрибьюирует RIP в OSPF. 
R2504 получил маршрут на сеть 200.1.1.0/24 от R2515 и поместил их в свою RIB как OSPF external type 2 (E2) маршрут. 
Проблема же здесь заключается в том, что R2507(Internet Border Router) не имеет даже представления о сети 200.1.1.0/24.
К тому же R2507 в RIB имеет записи о внешних сетях 3.3.4.0/24, 3.22.88.0/24 и 3.44.66.0/24, не смотря на то что все они подлежат суммаризации в сеть 3.0.0.0/8.
Причина, по которой эти внешние (external routes), видны в RIB, это то, что на ASBR, который перераспределяет RIP в OSPF,  запущен RIP для этих подсетей. Поэтому эти подсети становятся  external routes в OSPF домене. Поскольку эти подсети являются external маршрутами, они не подлежат суммаризации на ABR (R2504). Внешние маршруты могут быть сумированы только на ASBR.

  • External OSPF маршруты могут быть суммированы только  ASBR-ом. В нашем случае это - R2515. 
  • ABR делает суммирование только для internal OSPF route  из area 1 в area 0.
Note: With the fix of Cisco bug ID CSCdp72526 (registered customers only) , OSPF does not generate a type-5 link-state advertisement (LSA) of an overlapped external network. R2507 only has a summary inter-area route of 3.0.0.0/8. Then, R2507 installs 200.1.1.0/24 as the forwarding address and it is reachable via inter-area route 3.0.0.0/8. This is in compliance with RFC 2328 leavingcisco.com.
External LSA для сети 200.1.1.0/24 в OSPF database R2507:
R2507# 
show ip ospf data external 200.1.1.0

       OSPF Router with ID (7.7.7.1) (Process ID 1)
       Type- 5 AS External Link States
       LS age: 72
       Options: (No TOS- capability, DC)
       LS Type: AS External Link
       Link State ID: 200.1.1.0 (External Network Number )
       Advertising Router: 3.44.66.3  --- Это наш R2515 ASBR
       LS Seq Number: 80000001
       Checksum: 0xF161
       Length: 36
       Network Mask: /24
                   Metric Type: 2 (Larger than any link state path)
                   TOS: 0
                   Metric: 20
                   Forward Address: 3.3.4.4 --- Это наш R2513 (RIP ROUTER)
                   External Route Tag: 0
OSPF позволяет нашему  ASBR указать другой ROUTER в качестве forwarding address на  external route. В нашем случае  ASBR (R2515) указал 3.3.4.4  в качестве forwarding address для external network 200.1.1.0.
RFC 2328 leavingcisco.com, раздел 16.4 (Calculating AS external routes), говорит:
"If the forwarding address is non-zero, look up the forwarding address in the routing table. The matching routing table entry must specify an intra-area or inter-area path; if no such path exists, do nothing with the LSA and consider the next in the list."

Посему, надо запомнить одно простое правило: 
Для Forward Address мы должны искать в RIB inter или intra area маршруты. Если таковых нет, такой LSA не обрабатывать.
В этом примере, показан маршрут до forwarding address 3.3.4.4:
R2507# 
show ip route 3.3.4.4

       Routing entry for 3.3.4.0/ 24
           Known via "ospf 1", distance 110, metric 20,type extern 2, forward metric 70
           Redistributing via ospf 1
           Last update from 1.1.1.2 on Serial0, 00: 00: 40 ago
           Routing Descriptor Blocks:
           * 1.1.1.2, from 3.44.66.3, 00: 00: 40 ago, via Serial0
              Route metric is 20, traffic share count is 1
Forwarding address  3.3.4.4 виден в RIB как external route 3.3.4.0/24, а не как inter-area summary route 3.0.0.0/8. 

Поскольку маршрутизатор не имеет internal OSPF route к forwarding address, он не устанавливает в RIB external route 200.1.1.0/24. 
Важно!!!
Использование external route для достижения других external route может вызвать петли маршрутизации. Именно поэтому  OSPF не позволяет такое поведение.

Do Not Summarize on the ABR

Как вы можете гарантировать, что установленный ASBR-ом non-zero forwarding address существует в RIB других маршрутизаторов в качестве intra-area или inter-area маршрутов?
Первое решение: не производить суммирование на ABR.
Второе решение заключается в том, чтобы не осуществлять LSA type 3 filtering. Если type 3 routes будут зафильтрованы, то в этом случае Forwarding address который мы увидим в выводе команды show ip ospf database external окажется  "not reachable".  В свою очередь, это сделает что? Правильно! Недоступной и внешнюю сеть. В нашем случае это, R2504. Это приводит к тому что маршрутизаторы в area 0  имеют inter-area маршруты  (instead of external routes) for all the specific subnets in other areas.
Удаляем команду суммаризации на ABR:
R2504(config)# 
router ospf 1

R2504(config- router)# no area 1 range 3.0.0.0 255.0.0.0
The results of this command in the routing table on R2507 are shown here:
R2507# show ip route
       Gateway of last resort is 0.0.0.0 to network 0.0.0.0
                 1.0.0.0/ 24 is subnetted,        1 subnets
       C            1.1.1.0        is directly connected, Serial0
                 3.0.0.0/ 24 is subnetted,        3 subnets
       O IA      3.3.4.0 [110/ 70] via 1.1.1.2, 00: 00:        48, Serial0
       O IA      3.22.88.0 [110/ 80] via 1.1.1.2, 00:        00: 48, Serial0
       O IA      3.44.66.0 [110/ 80] via 1.1.1.2, 00:        00: 48, Serial0
                 7.0.0.0/ 24 is subnetted,        1 subnets
       C           7.7.7.0 is        directly connected, Serial1
       O E2 200.1.1.0/ 24 [110/ 20] via 1.1.1.2, 00: 00: 48, Serial0
       S*     0.0.0.0/ 0 is directly connected, Serial1
    
   R2507# show ip route 3.3.4.4
     Routing entry for 3.3.4.0/24
      Known via "ospf 1", distance 110, metric 70, type inter area
      Last update from 1.1.1.2 on Serial1, 00:03:52 ago
      Routing Descriptor Blocks:
      * 1.1.1.2, from 3.3.4.2, 00:03:52 ago, via Serial1
          Route metric is 74, traffic share count is 1
From the output, you can see that the address 3.3.4.4 is reachable through an inter-area route to the network 3.3.4.0/24 . The router R2507 learns the route to this network through both a Type-5 LSA and Type-3 LSA, after summarization on the ABR R2504 is removed. Since OSPF prefers an inter-area route over an external route to the same network, it installs it as an inter-area route. Sine R2507 now has an inter-area route to the forwarding address 3.3.4,4, the external network 200.1.1.0/24 is also installed in its routing table.
Note: If the NSSA ( Not So Stubby Area) is used and if the type 3 LSA filtering is done on NSSA ABR, then the same issue Forwarding Address unreachable will exist.

Prevent the Subnet from Being Redistributed into OSPF as an External Route

Another solution is to prevent the subnet 3.3.4.0 from being redistributed into OSPF as an external route, since OSPF runs on it. These configuration commands in the ASBR (R2515) create a route-map. This is used by theredistribute command to allow only network 200.1.1.0/24 to be redistributed into OSPF. The ABR (R2504) still summarizes internal OSPF routes from area 1 into area 0.
R2515# configure terminal
R2515(config)# router ospf 1
R2515(config-router)# redistribute rip metric 20 subnets route-map rip_to_ospf_filter
R2515(config-router)# exit
   
R2515(config)# 
access-list 28 permit 200.1.1.0 0.0.0.255
   
R2515(config)# 
route-map rip_to_ospf_filter permit 10
R2515(config-route-map)# 
match ip address 28

The results of this command in the routing table on R2507 are shown here:
R2507# show ip route
       Gateway of last resort is 0.0.0.0 to network 0.0.0.0
                 1.0.0.0/ 24 is subnetted,        1 subnets
       C            1.1.1.0        is directly connected, Serial0
       O IA  3.0.0.0/ 8 [110/ 70] via 1.1.1.2, 00: 07: 05, Serial0
                 7.0.0.0/ 24 is subnetted,        1 subnets
       C            7.7.7.0        is directly connected, Ethernet0
       O E2  200.1.1.0/ 24 [110/ 20] via 1.1.1.2, 00: 00: 21, Serial0
       S*      0.0.0.0/ 0 is directly connected, Ethernet0

The only external route in the routing table is 200.1.1.0/24. This network is in the routing table because the forwarding address of this external network (3.3.4.1) is covered by the summary route 3.0.0.0/8, which is an inter-area route.

Комментариев нет:

Отправить комментарий