OSPF – uwierzytelnianie

Cele:

Adresy IP routerów:

R1

Interfejs IP
FastEthernet 0/0 172.16.12.1/24
FastEthernet 1/0 172.16.13.1/24
Loopback 0 1.1.1.1/24

R2

Interfejs IP
FastEthernet 0/0 172.16.12.2/24
FastEthernet 1/0 172.16.23.2/24
Loopback 0 2.2.2.2/24

R3

Interfejs IP
FastEthernet 0/0 172.16.23.3/24
FastEthernet 1/0 172.16.13.3/24
FastEthernet 2/0 172.16.34.3/24
Loopback 0 3.3.3.3/24

R4

Interfejs IP
FastEthernet 0/0 172.16.34.4/24
FastEthernet 1/0 172.16.45.4/24
Loopback 0 4.4.4.4/24

R5

Interfejs IP
FastEthernet 0/0 172.16.45.5/24
Loopback 0 4.4.4.4/24

Schemat sieci:

ospf - uwierzytelnianie i virtual link

Router: 3640
IOS: c3640-jk9o3s-mz.124-16a.bin

Rozwiązanie

Skonfiguruj OSPF zgodnie ze schematem sieci na wszystkich routerach i rozgłoś wszystkie podłączone podsieci.

Na każdym z routerów uruchamiamy proces OSPF i rozgłosimy wszystkie podłączone podsieci. Na schemacie zaznaczone mamy 4 różne obszary (numery 0, 34, 45 i 500), dlatego należy zwrócić uwagę do którego z nich należy dany interfejs routera. Widzimy też, że area 45 oraz area 500 nie mają bezpośredniego połączenia z obszarem zerowym. Ale zaczniemy najpierw od podstawowej konfiguracji OSPF:

R1(config)#router ospf 1
R1(config-router)#network 172.16.12.0 0.0.0.255 area 0
R1(config-router)#network 172.16.13.0 0.0.0.255 area 0
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0 
R2(config)#router ospf 1
R2(config-router)#network 172.16.12.0 0.0.0.255 area 0
R2(config-router)#network 172.16.23.0 0.0.0.255 area 0
R2(config-router)#network 2.2.2.0 0.0.0.255 area 0
R3(config)#router ospf 1
R3(config-router)#network 172.16.13.0 0.0.0.255 area 0
R3(config-router)#network 172.16.23.0 0.0.0.255 area 0
R3(config-router)#network 3.3.3.0 0.0.0.255 area 0
R3(config-router)#network 172.16.34.0 0.0.0.255 area 34
R4(config)#router  ospf 1
R4(config-router)#network 172.16.34.0 0.0.0.255 area 34
R4(config-router)#network 172.16.45.0 0.0.0.255 area 45
R4(config-router)#network 4.4.4.4 0.0.0.255 area 34
R5(config)#router ospf 1
R5(config-router)#network 172.16.45.0 0.0.0.255 area 45
R5(config-router)#network 5.5.5.0 0.0.0.255 area 500

Upewnij się, że masz pełną łączność (Virtual Link).

Proces OSPF działa na wszystkich routerach, jednak taka podstawowa konfiguracja nie zapewnia nam pełnej łączności. Obszary 45 i 500 nie są bezpośrednio wpięte do obszaru 0, więc nie mogą wymieniać informacji na temat tras. Problem rozwiążemy przy pomocy łącz wirtualnych (Virtual Link). Pierwszym krokiem będzie połączenie ze sobą routerów R3 i R4, następnie R4 i R5. Zanim zaczniemy, wyświetlmy jeszcze tablice routingu od R1:

R1#show ip route  ospf 
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 172.16.12.2, 00:04:10, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 172.16.13.3, 00:04:10, FastEthernet1/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/3] via 172.16.13.3, 00:04:10, FastEthernet1/0
     172.16.0.0/24 is subnetted, 4 subnets
O IA    172.16.34.0 [110/2] via 172.16.13.3, 00:04:10, FastEthernet1/0
O       172.16.23.0 [110/2] via 172.16.13.3, 00:04:10, FastEthernet1/0
                    [110/2] via 172.16.12.2, 00:04:10, FastEthernet0/0

Mamy w niej informacje o wszystkich sieciach z obszaru 0 i 34. Po utworzeniu wirtualnego łącza, router R1 dostanie informacje na temat sieci 172.16.45.0.

R3(config)#router ospf 1
R3(config-router)#area 34 virtual-link 4.4.4.4
R3(config-router)#^Z
R3#
*Mar  1 21:26:24.054: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on OSPF_VL1 from LOADING to FULL, Loading Done
R4(config)#router ospf 1
R4(config-router)#area 34 virtual-link 3.3.3.3
R4#
*Mar  1 21:26:29.186: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on OSPF_VL2 from LOADING to FULL, Loading Done

Zgodnie z naszymi przewidywaniami sieć 172.16.45.0 pojawiła się w tablicy routingu od R1:

R1#show ip route ospf  | include 172.16.45.0
O IA    172.16.45.0 [110/3] via 172.16.13.3, 00:01:10, FastEthernet1/0

Mamy więc pełną łączność z R4 oraz z interfejsem FastEthernet 0/0 routera R5:

R1#ping 172.16.45.5

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.45.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/59/72 ms
R1#ping 172.16.45.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.45.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/32/44 ms

Został nam tylko interfejs Loopback w obszarze 500. Konfigurujemy R4 i R5:

R4(config)#router ospf 1
R4(config-router)#area 45 virtual-link 5.5.5.5
R4(config-router)#
*Mar  1 21:31:32.178: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on OSPF_VL3 from LOADING to FULL, Loading Done
R5(config)#router  ospf 1
R5(config-router)#area 45 virtual-link 4.4.4.4
R5(config-router)#
*Mar  1 21:31:30.950: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on OSPF_VL1 from LOADING to FULL, Loading Done

Kolejna sieć pojawia się w tablicy routingu (R1):

R1#show ip route ospf              
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 172.16.12.2, 00:01:01, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 172.16.13.3, 00:01:01, FastEthernet1/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/3] via 172.16.13.3, 00:01:01, FastEthernet1/0
     5.0.0.0/32 is subnetted, 1 subnets
O IA    5.5.5.5 [110/4] via 172.16.13.3, 00:01:01, FastEthernet1/0
     172.16.0.0/24 is subnetted, 5 subnets
O IA    172.16.45.0 [110/3] via 172.16.13.3, 00:01:01, FastEthernet1/0
O IA    172.16.34.0 [110/2] via 172.16.13.3, 00:01:01, FastEthernet1/0
O       172.16.23.0 [110/2] via 172.16.13.3, 00:01:01, FastEthernet1/0
                    [110/2] via 172.16.12.2, 00:01:01, FastEthernet0/0

ping i traceroute z R1 do R5:

R1#ping 5.5.5.5  source l0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/59/72 ms
R1#
R1#traceroute 5.5.5.5

Type escape sequence to abort.
Tracing the route to 5.5.5.5

  1 172.16.13.3 4 msec 20 msec 16 msec
  2 172.16.34.4 24 msec 36 msec 44 msec
  3 172.16.45.5 72 msec *  68 msec

Ćwiczenie wykonane, 100% łączność z wszystkimi sieciami osiągnięta.


Włącz uwierzytelnianie w obszarze 45. Hasło powinno być przesyłane w formie zaszyfrowanej (MD5).

W OSPF możemy aktywować uwierzytelnianie dla całego obszaru lub dla poszczególnych interfejsów. Naszym zadaniem jest aktywacja ospf authentication dla obszaru 45. Dodatkowo klucz musi być zaszyfrowany (message-digest), naszym hasłem będzie tajnehaslo. Zacznijmy od routera R4:

R4(config)#int f1/0
R4(config-if)#ip ospf message-digest-key 1 md5 tajnehaslo

Na interfejsie FastEthernet 1/0 aktywowaliśmy klucz typu md5. Teraz w trybie konfiguracji OSPF uruchomimy uwierzytelnianie:

R4(config)#router ospf 1  
R4(config-router)#area 45 authentication message-digest

Po chwili zostajemy poinformowani, że router R4 utracił relacje sąsiedztwa z R5.

R4#
*Mar  1 22:03:59.030: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on FastEthernet1/0 from FULL to DOWN, Neighbor Down: Dead timer expired
R4#
*Mar  1 22:04:04.534: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on OSPF_VL3 from FULL to DOWN, Neighbor Down: Interface down or detached

Musimy oczywiście powtórzyć to samo na R5:

R5(config)#int f0/0
R5(config-if)#ip ospf message-digest-key 1 md5 tajnehaslo
R5(config)#router ospf 1
R5(config-router)#area 45 authentication message-digest

Po chwili relacja sąsiedztwa między R4 i R5 zostaje znów nawiązana:

R4#
*Mar  1 22:06:09.150: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on FastEthernet1/0 from LOADING to FULL, Loading Done
R4#
*Mar  1 22:06:24.242: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on OSPF_VL3 from LOADING to FULL, Loading Done

Włączymy teraz tryb debug dla pakietóœ OSPF na R4:

R4#debug ip ospf packet 
OSPF packet debugging is on
R4#
*Mar  1 22:09:45.290: OSPF: rcv. v:2 t:1 l:48 rid:3.3.3.3
      aid:0.0.0.34 chk:4242 aut:0 auk: from FastEthernet0/0
R4#
*Mar  1 22:09:49.074: OSPF: rcv. v:2 t:1 l:48 rid:5.5.5.5
      aid:0.0.0.45 chk:0 aut:2 keyid:1 seq:0x3C7FF4F8 from FastEthernet1/0

Powyżej mamy informacje na temat 2 pakietów OSPF, które R4 otrzymał od R3 (pierwszy) i R5 (drugi). Wartość aut:0 oznacza brak uwierzytelniania, aut:1 uwierzytelnianie bez szyfrowania (plaintext), natomiast aut:2 hasło jest przesyłane w formie zaszyfrowanej (md5). Wynika z tego, że wszystko działa jak powinno. Na koniec jeszcze wyjście polecenia show ip ospf interface f1/0 na R4:

R4#show ip ospf interface f1/0
FastEthernet1/0 is up, line protocol is up 
  Internet Address 172.16.45.4/24, Area 45 
  Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State BDR, Priority 1 
  Designated Router (ID) 5.5.5.5, Interface address 172.16.45.5
  Backup Designated router (ID) 4.4.4.4, Interface address 172.16.45.4
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:00
  Supports Link-local Signaling (LLS)
  Index 1/2, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 8
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 5.5.5.5  (Designated Router)
  Suppress hello for 0 neighbor(s)
  Message digest authentication enabled
    Youngest key id is 1

W ostatnich 2 liniach mamy kolejne potwierdzenie, że uwierzytelnianie md5 jest aktywne.


Włącz uwierzytelnianie pomiędzy R2 i R3. Hasło powinno być przesyłane w formie niezaszyfrowanej (plaintext).

Tak jak pisaliśmy wyżej uwierzytelnianie może też być aktywowane tylko dla poszczególnych interfejsów (a nie dla całej strefy). Zmiany wykonujemy w trybie konfiguracji interfejsu:

R2(config)#int f1/0
R2(config-if)#ip ospf authentication 
R2(config-if)#ip ospf authentication-key haslo 
R3(config)#int f0/0
R3(config-if)#ip ospf authentication
R3(config-if)#ip ospf authentication-key haslo

Tym razem hasło przesyłane będzie w formie niezaszyfrowanej (plaintext). Naszym hasłem jest łańcuch haslo. Włączymy debugowanie pakietów OSPF na routerze R2:

R2#
*Mar  1 23:34:09.678: OSPF: rcv. v:2 t:1 l:48 rid:3.3.3.3
      aid:0.0.0.0 chk:5C69 aut:1 auk: from FastEthernet1/0

R2 otrzymał pakiet od routera 3.3.3.3, a wartość 1 przy aut potwierdza że uwierzytelnianie jest aktywne. Zobaczmy jeszcze informacje z polecenia show ip ospf interface fastEthernet 1/0:

R2#show ip ospf interface fastEthernet 1/0
FastEthernet1/0 is up, line protocol is up 
  Internet Address 172.16.23.2/24, Area 0 
  Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
  Transmit Delay is 1 sec, State BDR, Priority 1 
  Designated Router (ID) 3.3.3.3, Interface address 172.16.23.3
  Backup Designated router (ID) 2.2.2.2, Interface address 172.16.23.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:04
  Supports Link-local Signaling (LLS)
  Index 3/3, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 1, maximum is 1
  Last flood scan time is 4 msec, maximum is 4 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 3.3.3.3  (Designated Router)
  Suppress hello for 0 neighbor(s)
  Simple password authentication enabled

Interesuje nas ostatnia linijka (Simple password authentication enabled).


Włącz uwierzytelnianie na łączu wirtualnym w strefie 34. Hasło ma być przesyłane w formie zaszyfrowanej.

Wiemy już jak aktywować uwierzytelnianie dla całego obszaru lub dla poszczególnych interfejsów. Została nam jeszcze opcja z Virtual Link. Na samym początku utworzyliśmy takie łącze pomiędzy R3 i R4, teraz musimy dodatkowo zabezpieczyć je hasłem:

R3(config)#router  ospf 1
R3(config-router)#area 34 virtual-link 4.4.4.4 authentication message-digest
R3(config-router)#area 34 virtual-link 4.4.4.4 authentication message-digest-key 1 md5 haslo123
R4(config)#router ospf 1
R4(config-router)#area 34 virtual-link 3.3.3.3 authentication message-digest
R4(config-router)#area 34 virtual-link 3.3.3.3 authentication message-digest-key 1 md5 haslo123

Nasze hasło to haslo123, przesyłane będzie w formie zaszyfrowanej.

R3#show ip ospf virtual-links 
Virtual Link OSPF_VL1 to router 4.4.4.4 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 34, via interface FastEthernet2/0, Cost of using 1
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:00
    Adjacency State FULL (Hello suppressed)
    Index 3/4, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
  Message digest authentication enabled
    Youngest key id is 1

Powyższe polecenie pokazuje nam, że uwierzytelnianie jest aktywne (Message digest authentication enabled). Jednak w przypadku łącz wirtualnych musimy zwrócić uwagę na pewien szczegół. Chodzi tutaj o informację: Adjacency State FULL (Hello suppressed). Oznacza ona, że jeśli nasz Virtual Link już działa, nie będą wysyłane żadne pakiety Hello (normalnie są one wysyłane co 10 sekund). Chcąc wprowadzić nasze zmiany w życie, musimy zrestartować proces OSPF na R3 i R4:

R3#clear ip ospf process 
Reset ALL OSPF processes? [no]: yes
R4#clear ip ospf process 
Reset ALL OSPF processes? [no]:

Zostaw komentarz


Podpowiedź - możesz użyć tych HTML tagów i atrybutów:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Obraz CAPTCHY

*