높고 넓은 파도

[OSPF] OSPF 기본 설정(Backbone Area) / Neighbor 선출 과정 본문

네트워크/OSPF

[OSPF] OSPF 기본 설정(Backbone Area) / Neighbor 선출 과정

김파도_ 2025. 4. 15. 21:00
반응형

사용 장비 Arista(eveng)
version  EOS 4.31.4M
routing protocol model multi-agent

 

OSPF 기본 설정 

Router1 Router2 Router3
interface Ethernet1
   no switchport
   ip address 10.1.12.1/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Ethernet2
   no switchport
   ip address 10.1.13.1/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Loopback0
   ip address 1.1.1.1/32
!
ip routing
!
router ospf 10
   router-id 1.1.1.1
   auto-cost reference-bandwidth 100000
   max-lsa 12000
interface Ethernet1
   no switchport
   ip address 10.1.12.2/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Ethernet2
   no switchport
   ip address 10.1.24.1/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Ethernet3
   no switchport
   ip address 10.1.26.1/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Loopback0
   ip address 1.1.1.2/32
!
ip routing
!
router ospf 10
   router-id 1.1.1.2
   auto-cost reference-bandwidth 100000
   max-lsa 12000
!
interface Ethernet1
   no switchport
   ip address 10.1.35.1/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Ethernet2
   no switchport
   ip address 10.1.13.2/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Loopback0
   ip address 1.1.1.3/32
!
ip routing
!
router ospf 10
   router-id 1.1.1.3
   auto-cost reference-bandwidth 100000
   max-lsa 12000
Router4 Router5 Router6
interface Ethernet2
   no switchport
   ip address 10.1.24.2/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Loopback0
   ip address 1.1.1.4/32
!
ip routing
!
router ospf 10
   router-id 1.1.1.4
   auto-cost reference-bandwidth 100000
   max-lsa 12000
interface Ethernet1
   no switchport
   ip address 10.1.35.2/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Loopback0
   ip address 1.1.1.5/32
!
ip routing
!
router ospf 10
   router-id 1.1.1.5
   auto-cost reference-bandwidth 100000
   max-lsa 12000
interface Ethernet3
   no switchport
   ip address 10.1.26.2/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0
!
interface Loopback0
   ip address 1.1.1.6/32
!
ip routing
!
router ospf 10
   router-id 1.1.1.6
   auto-cost reference-bandwidth 100000
   max-lsa 12000

 

- 기본적으로 area와 network type만 지정해 줘도 neighbor가 잘 맺어진다.(현재는 모두 backbone area로 지정하여 area가 모두 0.0.0.0이다)

Router3#sh log 10
Apr 11 10:26:03 Router3 Ospf: Instance 10: %OSPF-4-OSPF_ADJACENCY_ESTABLISHED: NGB 1.1.1.6, interface 10.1.35.1 adjacency established
Apr 11 10:26:13 Router3 Ospf: Instance 10: %OSPF-4-OSPF_ADJACENCY_ESTABLISHED: NGB 1.1.1.5, interface 10.1.35.1 adjacency established

Router3#sh ip ospf nei
Neighbor ID     Instance VRF      Pri State                  Dead Time   Address         Interface
1.1.1.1         10       default  0   FULL                   00:00:36    10.1.13.1       Ethernet2
1.1.1.5         10       default  0   FULL                   00:00:33    10.1.35.2       Ethernet1

- State가 FULL로 보이면 neighbor가 잘 맺어졌다는 의미이다.

 

- router ospf  명령어를 사용하여 OSPF 설정을 넣어줘야 neighbor를 확인할 수 있다.

Router3#sh run sec router ospf
router ospf 10
   router-id 1.1.1.3
   auto-cost reference-bandwidth 100000
   max-lsa 12000
  • Process ID는 라우터 별로 다른 값을 가져도 상관 없음.
  • router-id는 지정하지 않아도 자동으로 결정되지만 loopback 주소로 직접 지정하는 것이 안전함.
  • 직접 지정하지 않게 되면 OSPF가 설정될 당시 동작중인 인터페이스의 IP 주소 중에서 자동으로 선택함. 루프백 인터페이스가 있다면 그 중에서 가장 높은 것이 router-id가 됨. 루프백 인터페이스가 없다면 동작 중인 물리적인 인터페이스 중 가장 높은 IP 주소가 router-id가 됨.
  • auto-cost reference-bandwidth : 경로 선택을 위한 메트릭인 Cost를 계산할 때 사용하는 기준 대역폭(Reference Bandwidth)을 설정하는 명령어 - 100G:1이 기준이 됨(10G-10, 1G-100)
  • max-lsa : 라우터가 유지할 수 있는 최대 LSA 개수 지정 (0으로 설정시 무제한)

OSPF Routing Table

Router1#sh ip route

VRF: default
Source Codes:
       C - connected, S - static, K - kernel,
       O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
       E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
       N2 - OSPF NSSA external type2, B - Other BGP Routes,
       B I - iBGP, B E - eBGP, R - RIP, I L1 - IS-IS level 1,
       I L2 - IS-IS level 2, O3 - OSPFv3, A B - BGP Aggregate,
       A O - OSPF Summary, NG - Nexthop Group Static Route,
       V - VXLAN Control Service, M - Martian,
       DH - DHCP client installed default route,
       DP - Dynamic Policy Route, L - VRF Leaked,
       G  - gRIBI, RC - Route Cache Route,
       CL - CBF Leaked Route

Gateway of last resort is not set

 C        1.1.1.1/32
           directly connected, Loopback0
 C        10.1.12.0/30
           directly connected, Ethernet1
 C        10.1.13.0/30
           directly connected, Ethernet2
 O        10.1.24.0/30 [110/200]
           via 10.1.12.2, Ethernet1
        10.1.26.0/30 [110/200]
           via 10.1.12.2, Ethernet1
        10.1.35.0/30 [110/200]
           via 10.1.13.2, Ethernet2

- 설정이 끝난 후 라우팅 테이블을 확인하면 이렇게 'O'라는 기호 표시로 테이블이 올라와있다.

- 현재 다른 라우터들의 Loopback이 올라오지 않는데 올라오게 하고 싶으면 Loopback에 area를 지정해주면 된다. 

*현재는 모두 동일한 Backbone Area여서 모든 Loopback들이 올라온다.

Router2#sh run sec loopback
interface Loopback0
   ip address 1.1.1.2/32
   ip ospf area 0.0.0.0
Router1#sh ip route

VRF: default
Source Codes:
       C - connected, S - static, K - kernel,
       O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1,
       E2 - OSPF external type 2, N1 - OSPF NSSA external type 1,
       N2 - OSPF NSSA external type2, B - Other BGP Routes,
       B I - iBGP, B E - eBGP, R - RIP, I L1 - IS-IS level 1,
       I L2 - IS-IS level 2, O3 - OSPFv3, A B - BGP Aggregate,
       A O - OSPF Summary, NG - Nexthop Group Static Route,
       V - VXLAN Control Service, M - Martian,
       DH - DHCP client installed default route,
       DP - Dynamic Policy Route, L - VRF Leaked,
       G  - gRIBI, RC - Route Cache Route,
       CL - CBF Leaked Route

Gateway of last resort is not set

 C        1.1.1.1/32
           directly connected, Loopback0
 O        1.1.1.2/32 [110/110]
           via 10.1.12.2, Ethernet1
 O        1.1.1.3/32 [110/110]
           via 10.1.13.2, Ethernet2
 O        1.1.1.4/32 [110/210]
           via 10.1.12.2, Ethernet1
 O        1.1.1.5/32 [110/210]
           via 10.1.13.2, Ethernet2
 O        1.1.1.6/32 [110/210]
           via 10.1.12.2, Ethernet1
 C        10.1.12.0/30
           directly connected, Ethernet1
 C        10.1.13.0/30
           directly connected, Ethernet2
 O        10.1.24.0/30 [110/200]
           via 10.1.12.2, Ethernet1
 O        10.1.26.0/30 [110/200]
           via 10.1.12.2, Ethernet1
 O        10.1.35.0/30 [110/200]
           via 10.1.13.2, Ethernet2

OSPF Neighbor 종류

  • OSPF Hello Packet을 이용하여 Neighbor 관계를 수립하더라고 조건에 따라 2가지 타입의 OSPF 네이버가 존재
Type Description
OSPF Neighbor OSPF가 활성화된 인터페이스를 통해 맺어진 관계
Adjacency OSPF Neighbor OSPF Database를 동기화 시키는 관계
  • Adjacency OSPF Neighbor 성립 조건
    1. OSPF 동작하는 영역내에서 Router ID는 유일해야함 (중복된 Router ID 있을 경우 LSDB 계속 업데이트 되어 Routing Table 계속 변하여 불안정해짐)
    2. 두 장비의 interface의 IP Subnet은 동일한 대역에 존재해야함.
    3. MTU사이즈가 동일해야함(OSPF는 단편화를 지원하지 않음)
    4. Area 정보, Type 동일해야함(Area number, NSSA, STUB)
    5. Network Type이 같아야함
    6. Hello/Dead interval이 동일해야함 - default Hello 10 / Dead 40
    7. 인증 타입이 동일해야함(MD5, none)
Router1(config-if-Et1)#sh ac
interface Ethernet1
   description Router2
   no switchport
   ip address 10.1.12.1/30
   ip ospf network point-to-point
   ip ospf area 0.0.0.0

Router1(config-if-Et1)#sh ac all | grep hello
   ip ospf hello-interval 10    #hello-interval의 default 값은 10임.

Router1(config-if-Et1)#sh ip ospf nei
Neighbor ID     Instance VRF      Pri State                  Dead Time   Address         Interface
1.1.1.3         10       default  0   FULL                   00:00:29    10.1.13.2       Ethernet2
1.1.1.2         10       default  0   FULL                   00:00:30    10.1.12.2       Ethernet1
Router1(config-if-Et1)#sh ac
interface Ethernet1
   description Router2
   no switchport
   ip address 10.1.12.1/30
   ip ospf hello-interval 2    #hello-interval을 2로 변경
   ip ospf network point-to-point
   ip ospf area 0.0.0.0

Router1(config-router-ospf)#sh ip ospf nei
Neighbor ID     Instance VRF      Pri State                  Dead Time   Address         Interface
1.1.1.3         10       default  0   FULL                   00:00:35    10.1.13.2       Ethernet2

Apr 11 11:14:53 Router1 Ospf: Instance 10: OSPF: invalid HELLO packet from 10.1.12.2: Invalid Hello interval (rcvd/configured: 10/2) (10)  #Router1과 Router2의 hello-interval 값이 달라서 neighbor가 안맺어짐

 

OSPF Neighbor 선출 과정 및 상태

  • OSPF Neighbor 맺는 과정 
상태 설명
DOWN Neighbor 관계 수립 최초의 단계이며 hello packet 수신하지 않은 상태
Attempt NBMA(Non Broadcast Multi Access) 관계가 있으며 OSPF 설정 neighbor 수동으로 지정해 줘야함. 해당 상태는 받은 정보는 없지만 라우터가 계속 통신을 시도하는 경우에 발생
Init 다른 라우터에게 hello packet 수신하였으나 아직 양방향 통신은 되지 않은 상태
2-Way 양방향 통신이 되는 상태이고, DR/BDR 선출이 필요할 경우 해당 단계에서 선출됨
DROTHER 경우 해당 상태가 최종 단계
ExStart adjacency 관계를 맺는 첫번째 단계. 라우터는 LSDB 동기화를 위해 primary 또는 secondary 식별함
Exchange DBD 패킷을 이용하여 LSDB 전체 정보를 교환함.
Link-State Type, Address of Advertising Router, Link's Cost, Sequence Number 정보가 포함됨
OSPF Sequence Number 정보를 이용하여 해당 정보의 최신화 여부를 확인함
Loading LSR 패킷을 neighbor에게 전달하고 가장 최신의 LSU 응답하여 LSDB 동기화 작업을 수행함
Full adjacency neighbor 관계 수립이 완료된 상태

###LSDB를 동기화시키지 않은 Neighbor의 상태는 2-way###

 

728x90

'네트워크 > OSPF' 카테고리의 다른 글

[OSPF] OSPF Packet 설명  (3) 2025.04.25
[OSPF] 실습 - SubArea 설정  (0) 2025.04.21
[OSPF] Forwarding Address  (0) 2025.04.13
[OSPF] Network Area  (0) 2025.04.11
[OSPF] DR(Designated Router) / BDR(Backup Designated Router)  (0) 2024.08.12