본문 바로가기
네트워크

OPSF #2(LSA,Stub Area)

by CBROJIN 2025. 3. 30.

[학습 목표]

1) OSPF LSA

2) OSPF Stub Area

 

OSPF 실습 설정
R1(config)#int e0/0
R1(config-if)#ip add 1.1.1.12 255.255.255.0
R1(config-if)#no shut
R1(config)#int lo0      
R1(config-if)#ip add 1.1.11.1 255.255.255.0
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.11.1
R1(config-router)#network 1.1.11.1 0.0.0.0 area 1
R1(config-router)#network 1.1.1.12 0.0.0.0 area 1
R1(config)#int e0/0
R1(config-if)#ip ospf netwrok point-to-point
R1(config)#router ospf 1
R1(config-router)#area 1 stub 
R2(config)#int e0/0
R2(config-if)#ip add 1.1.1.21 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int e0/1
R2(config-if)#ip add 1.1.2.23 255.255.255.0
R2(config-if)#no shut
R2(config)#int lo0
R2(config-if)#ip add 2.2.22.2 255.255.255.0
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.22.2
R2(config-router)#network 2.2.22.2 0.0.0.0 area 0
R2(config-router)#network 1.1.1.21 0.0.0.0 area 1
R2(config-router)#network 1.1.2.23 0.0.0.0 area 0
R2(config)#int range e0/0-1
R2(config-if)#ip ospf netwrok point-to-point
R2(config)#router ospf 1
R2(config-router)#area 1 stub
R2(config)#int lo2
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#redistribute connected subnets 
R3(config)#int e0/1
R3(config-if)#ip add 1.1.2.32 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int e0/2
R3(config-if)#ip add 1.1.3.34 255.255.255.0
R3(config-if)#no shut
R3(config)#int lo0
R3(config-if)#ip add 3.3.33.3 255.255.255.0
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.33.3
R3(config-router)#network 3.3.33.3 0.0.0.0 area 0
R3(config-router)#network 1.1.2.32 0.0.0.0 area 0
R3(config-router)#network 1.1.3.34 0.0.0.0 area 2
R3(config)#int range e0/1-2
R3(config-if)#ip ospf netwrok point-to-point
R3(config)#router ospf 1
R3(config-router)#area 2 nssa default-information-originate
R3(config)#router ospf 1
R3(config-router)#no area 2 nssa
R3(config)#router ospf 1
R3(config-router)#area 2 nssa no-summary
R4(config)#int e0/2
R4(config-if)#ip add 1.1.3.43 255.255.255.0
R4(config-if)#no shut
R4(config)#int lo0
R4(config-if)#ip add 4.4.44.4 255.255.255.0
R4(config-router)#router-id 4.4.44.4
R4(config-router)#network 4.4.44.4 0.0.0.0 area 2
R4(config-router)#network 1.1.3.43 0.0.0.0 area 2
R4(config)#int e0/2
R4(config-if)#ip ospf netwrok point-to-point
R4(config)#int lo5
R4(config-if)#ip address 5.5.5.5 255.255.255.0
R4(config)#router ospf 1
R4(config-router)#redistribute connected subnets 
R4(config)#router ospf 1
R4(config-router)#area 2 nssa

 

1) OSPF LSA 란?

라우터가 자신의 링크 상태 정보(Link-State Information)를 네트워크 상의 다른 라우터들에게 전송하는 메시지 형식.
OSPF는 이 LSA들을 수집해서 LSDB(Link-State Database)를 만들고, SPF 알고리즘으로 라우팅 테이블을 구성한다.


  LSA 타입 LSA 이름 생성 라우터 전송 밤위 확인 명령
1 Type 1 Router LSA 모든 라우터 영역 내 show ip ospf database router
2 Type 2 Network LSA DR 영역 내 show ip ospf database network
3 Type 3 Summary LSA ABR 다른 영역 show ip ospf database summary
4 Type 4 ASBR Summary LSA ABR 다른 영역 show ip ospf database asbr-summary
5 Type 5 AS External LSA ASBR OSPF 전체 show ip ospf database external
6 Type 7 NSSA External LSA NSSA ASBR NSSA ABR통해 전체 show ip ospf database nssa-external  

 

 

Type 1 - Router LSA

  • 생성자: OSPF가 동작하는 모든 라우터가 생성
  • 전파 범위: 같은 영역(Area 내에서만 전파)
  • 내용: 라우터가 가지고 있는 인터페이스, 인접 라우터, 비용(Cost)
  • 특징: 항상 각 라우터마다 생성되며, 라우터의 연결 상태를 설명

🔎R1에서 Type 1 LSA를 확인한 사진이다.(아래)

Link State ID는 Type 1 LSA를 생성한 Router ID를 의미하고,

Adbertising Router는 Type 1 LSA LSA를 광고하는 Router ID를 나타낸다.


Type 2 - Network LSA

  • 생성자: DR(Designated Router)
  • 전파 범위: 같은 영역 내
  • 내용: 특정 멀티액세스 네트워크(예: Ethernet)에 연결된 모든 라우터 정보
  • 특징: DR이 네트워크를 대표하여 생성. DR이 없으면 Type 2는 없음.

🔎R1에서 Type 2 LSA를 확인한 사진이다.(아래)

R1 <-> R2는 Network Type이 Point-to-Point로 되어 있어 DR이 없다. 따라서 정보도 없다.

Network Type이 Broadcast일 때 DR을 선정한다.


Type 3 - Summary LSA

  • 생성자: ABR(Area Border Router)
  • 전파 범위: 다른 영역으로 전달
  • 내용: 다른 영역의 네트워크에 대한 정보
  • 특징: 영역 간 경계를 넘을 때 사용하는 LSA

🔎R1에서 Type 3 LSA를 확인한 사진이다.(아래)

Type 3 LSA의 Link state ID는 타 Area의 네트워크 주소를 말한다.

Advertising Router가 2.2.22.2로 동일 한 것은 Area 1의 ABR이 R2이며, R2의 Router ID가 2.2.22.2 이기 때문이다.

Type 3 LSA는 동일 Area의 ABR가 생성한다.


Type 4 - ASBR Summary LSA

  • 생성자: ABR
  • 전파 범위: 다른 영역으로 전달
  • 내용: ASBR의 위치 정보 (외부 라우트를 가져오는 라우터)
  • 특징: 외부 라우터를 찾기 위해 필요

🔎R1에서 Type 4 LSA를 확인한 사진이다.(아래)

Type 4 LSA는 ASBR Router ID와 Cost를 광고한다.

Link State ID가 4.4.44.4인 것은 ASBR의 Router ID를 나타내는 것이고,

Area 1 내의 ABR인 R2가 광고 하고 있기 때문에 Advertising Router는 2.2.22.2가 된다.

R4에서 외부 네트워크인 5.5.5.5를 E2 타입으로 재분배 했기 때문에 Metric값은 20으로 고정이다.


Type 5 - AS External LSA

  • 생성자: ASBR(Autonomous System Boundary Router)
  • 전파 범위: OSPF 도메인 전체 (Area 0을 통해 확산)
  • 내용: 외부 라우팅 정보 (예: BGP나 Static으로부터 가져온 외부 경로)
  • 특징: 외부 라우팅 정보를 내부 OSPF에 주입할 때 사용

🔎R1에서 Type 5 LSA를 확인한 사진이다.(아래)

Type 5 LSA의 Link State ID는 외부 네트워크 주소를 나타내며,

Advertising Router 4.4.44.4는 생성한 Router ID를 나타낸다.


Type 7 - NSSA External LSA 

  • 생성자: NSSA 영역의 ASBR
  • 전파 범위: NSSA 내부 → ABR가 Type 5로 변환해서 다른 영역으로 전달
  • 내용: 외부 라우팅 정보 (NSSA용)
  • 특징: NSSA 영역에서 외부 경로를 OSPF에 통합할 때 사용

Type 6, 8, 9~11은 잘 사용되지 않거나 OSPFv3에서 사용됨

  • Type 6: Multicast OSPF (MOSPF)
  • Type 8: OSPF over IPv6 (잘 안 씀)
  • Type 9~11: Opaque LSA (LSA 확장용 - MPLS, Traffic Engineering 등에 사용)

 

 보충 설명 - LSA와 LSDB, SPF 관계

LSA 라우터의 상태 정보 광고
LSDB 라우터 마다 모든 LSA가 저장된 데이터베이스
SPF 알고리즘 LSDB를 기반으로 최단 경로 계산
Routing Table 실제 트래픽 전달에 사용하는 테이블(최단 경로 표시)

 

2) OSPF Stub Area란?

스텁 에어리어란?

Stub Area는 OSPF에서 라우팅 테이블의 크기를 줄이고 불필요한 LSA를 차단하여,

리소스를 절약하기 위해 사용하는 특별한 타입의 영역입니다.

Stub Area는 외부 라우트 (LSA Type 5) 를 허용하지 않고,

대신 기본 경로(default route)를 사용하여 외부 네트워크로 나가도록 설계됩니다.


스텁 영역의 종류와 차이점

유형 허용
LSA
차단
LSA
특징
1. Stub Area 1,2,3 5 일반적인 스텁 영역. 외부 LSA(Type 5)를 차단
2. Totally Stubby Area 1,2 3,5 인터에어리어 LSAs(Type 3)까지 차단. 가장 단순한 라우팅 테이블
3. NSSA (Not-So-Stubby Area) 1,2,3,7 5 Stub이지만 내부에서 외부로 나가는 경로 필요할 때 사용. Type 7 LSA 허용
4. Totally NSSA 1,2 3,5 NSSA에서 Type 3도 차단한 형태. 가장 극단적으로 경로 축소
 
유형 Type 5 LSA Type 3 LSA Type 7 LSA Default Route 재분배 가능
Stub ❌ 차단 ✅ 허용 ❌ 없음 ✅ 존재
Totally Stub ❌ 차단 ❌ 차단 ❌ 없음 ✅ 존재
NSSA ❌ 차단 ✅ 허용 ✅ 허용 ❌ 기본 없음
Totally NSSA ❌ 차단 ❌ 차단 ✅ 허용 ✅ 존재

 

Stub Area

Area 1의 ABR인 R2가 영역내로 OSPF E1,E2 외부 네트워크를 차단하고, 디폴트 루트를 만들어 전송한다.

 

R1(config)#router ospf 1
R1(config-router)#area 1 stub 

R2(config)#router ospf 1
R2(config-router)#area 1 stub 

Stub Area는 외부 네트워크인 Type 5 LSA를 차단하기 때문에,

알필요가 없어진 ASBR까지의 경로를 알리는 Type 4 LSA도 같이 차단된다.

Stub 설정 전 E2 경로 모습

 

Stub 설정 후 E2가 사라지고 디폴트 루트가 생긴 모습

 

Type 4,5 LSA가 차단된 모습

 

 

Totally Stubby Area

OSPF 외부 네트워크 경로(E1,E2)와 다른 영역 네트워크(IA)도 차단한다.(아래)

R1(config)#router ospf 1
R1(config-router)#area 1 stub 

R2(config)#router ospf 1
R2(config-router)#area 1 stub no-summary

# area 1 stub no-summary 명령은 ABR에서만 하면 된다.

totally stuby area 전 ospf 테이블 모습

 

totally stuby area 후 ospf 테이블 모습

 

LSA 3(다른 area)도 차단 하고 디폴트 루트만 광고하기 때문에 Link State ID가 0.0.0.0, Metric이 1로 바뀐 모습이다.(아래)

totally stuby area 전 Type 3 LSA 모습

 

totally stuby area 후 Type 3 LSA 모습

 

NSSA (Not-So-Stubby Area)

Stub Area에서는 Type 5 LSA를 차단하기 때문에 ASBR이 있는 Area에서는 사용할 수 없다.

따라서, 외부 네트워크는 ASBR이 Type 7 LSA로 재분배 하고

이 Type 7 LSA는 ABR(Area Border Router)에서 Type 5 LSA로 변환되어 다른 OSPF 영역에 전달된다.

즉, 외부 네트워크 정보는 ASBR에서 Type 7 LSA를 이용해 받아 내부 Area로 전파하고

내부 Area에서 오는 정보는 ABR에서 차단하는 식이다.

 

R3(config)#router ospf 1
R3(config-router)#area 2 nssa default-information-originate

# default-information-originate 명령어를 사용해야 디폴트 루트를 광고한다.

R4(config)#router ospf 1
R4(config-router)#area 2 nssa

# area 2 nssa default-information-originate 명령은 Area의 ABR에서만 하면 된다.

 

Stub Area와 같이 외부 네트워크 경로(E1,E2)를 차단하고 디폴트 루트를 준 모습니다.(아래)

Stub Area는 O*IA로 표기된 반면 , NSSA는 O*N2로 표기 되있다.

NSSA 설정 전 R4 라우팅 테이블
NSSA 설정 후 라우팅 테이블

 

Area 2의 ASBR인 R4가 Type 7 LSA를 생성한 모습니다.(아래)

 

 

Totally NSSA

Totally NSSA = NSSA + Totally Stub 구조다.

외부 LSA (Type 5), 요약 LSA (Type 3)를 모두 차단한다.

내부에서는 외부 경로 재분배(Type 7 LSA)가 가능하다.

ABR이 기본 경로를 자동으로 주기 때문에 라우팅 테이블이 간단해진다.

 

R3(config)#router ospf 1
R3(config-router)#area 2 nssa no-summary

R4(config)#router ospf 1
R4(config-router)#area 2 nssa

# area 2 nssa no-summary  명령은 Area의 ABR에서만 하면 된다.

 

Totally NSSA 설정으로 Type 3 LSA도 차단되고 디폴트 루트만 보이는 상황이다.(아래)

Totally NSSA 설정 전
Totally NSSA 후

 

 

 

OSPF 실습 설정
R1(config)#int e0/0
R1(config-if)#ip add 1.1.1.12 255.255.255.0
R1(config-if)#no shut
R1(config)#int lo0      
R1(config-if)#ip add 1.1.11.1 255.255.255.0
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.11.1
R1(config-router)#network 1.1.11.1 0.0.0.0 area 1
R1(config-router)#network 1.1.1.12 0.0.0.0 area 1
R1(config)#int e0/0
R1(config-if)#ip ospf netwrok point-to-point
R1(config)#router ospf 1
R1(config-router)#area 1 stub 
R2(config)#int e0/0
R2(config-if)#ip add 1.1.1.21 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int e0/1
R2(config-if)#ip add 1.1.2.23 255.255.255.0
R2(config-if)#no shut
R2(config)#int lo0
R2(config-if)#ip add 2.2.22.2 255.255.255.0
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.22.2
R2(config-router)#network 2.2.22.2 0.0.0.0 area 0
R2(config-router)#network 1.1.1.21 0.0.0.0 area 1
R2(config-router)#network 1.1.2.23 0.0.0.0 area 0
R2(config)#int range e0/0-1
R2(config-if)#ip ospf netwrok point-to-point
R2(config)#router ospf 1
R2(config-router)#area 1 stub
R2(config)#int lo2
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#redistribute connected subnets 
R3(config)#int e0/1
R3(config-if)#ip add 1.1.2.32 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int e0/2
R3(config-if)#ip add 1.1.3.34 255.255.255.0
R3(config-if)#no shut
R3(config)#int lo0
R3(config-if)#ip add 3.3.33.3 255.255.255.0
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.33.3
R3(config-router)#network 3.3.33.3 0.0.0.0 area 0
R3(config-router)#network 1.1.2.32 0.0.0.0 area 0
R3(config-router)#network 1.1.3.34 0.0.0.0 area 2
R3(config)#int range e0/1-2
R3(config-if)#ip ospf netwrok point-to-point
R3(config)#router ospf 1
R3(config-router)#area 2 nssa default-information-originate
R3(config)#router ospf 1
R3(config-router)#no area 2 nssa
R3(config)#router ospf 1
R3(config-router)#area 2 nssa no-summary
R4(config)#int e0/2
R4(config-if)#ip add 1.1.3.43 255.255.255.0
R4(config-if)#no shut
R4(config)#int lo0
R4(config-if)#ip add 4.4.44.4 255.255.255.0
R4(config-router)#router-id 4.4.44.4
R4(config-router)#network 4.4.44.4 0.0.0.0 area 2
R4(config-router)#network 1.1.3.43 0.0.0.0 area 2
R4(config)#int e0/2
R4(config-if)#ip ospf netwrok point-to-point
R4(config)#int lo5
R4(config-if)#ip address 5.5.5.5 255.255.255.0
R4(config)#router ospf 1
R4(config-router)#redistribute connected subnets 
R4(config)#router ospf 1
R4(config-router)#area 2 nssa

 

 

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

OSPF #4(Virtual-link,Demand circuit)  (0) 2025.04.05
OSPF #3(Summarization,Authentication)  (0) 2025.04.02
OSPF #1  (2) 2024.12.07
정적 경로(Static routing)  (2) 2024.11.28
DHCP(Dynamic Host Configuration Protocol)  (0) 2024.11.26