본문 바로가기
네트워크 수업

OSPF 23.04.04

by 6^6 2023. 4. 4.
728x90

OSPF 란
Open Shortest Path First
1. 가장 널리 사용되는 Link-State 라우팅 프로토콜이다.
2. 다익스크라 Dizkstra가 발명해서.., SPF(Shortest Path First) 알고리즘
3. IP Protocol 번호 89번 사용
4. Multicast 방식으로 정보를 교환한다.
 → 224.0.0.5(All-OSPF-Router)
 → 224.0.0.6(DR, BDR 수신)
5. Metric으로 cost를 사용한다.
 cost = 10^8/Bandwidth 
 → total cost 는 각 구간의 cost 를 모두 합한 것이다.
6. Area별 강력한 축약 기능을 제공한다.
7.  모든 Area는 Backborn Area 0번에 접해야한다.
 
 


아까 eigrp 실습한거에 그냥 no router eigrp 4 해주고,,,,
 
R1(config)#router ospf ?
  <1-65535>  Process ID   //eigrp 의 AS 넘버와 똑같다.

R1(config)#router ospf 4
R1(config-router)#router-id 4.4.1.1 
R1(config-router)#network 4.4.1.1 0.0.0.0 area 0
R1(config-router)#network 4.4.12.1 0.0.0.0 area 0
 
모든 area의 기본 area는 백본 area이다.
for example) A0 | A1 | A2 의 area들이 있다면 A0과 A2는 통신이 안된다. 모든 AREA는 백본 Area와 접해야한다.
 
R2(config)#router ospf 4
R2(config-router)#router-id 4.4.2.2 
R2(config-router)#network 4.4.2.2 0.0.0.0 area 0
R2(config-router)#network 4.4.12.2 0.0.0.0 area 0
R2(config-router)#network 4.4.23.2 0.0.0.0 area 0
 
 
R3(config)#router ospf 4
R3(config-router)#router-id 4.4.3.3
R3(config-router)#network 4.4.3.3 0.0.0.0 area 0
R3(config-router)#network 4.4.23.3 0.0.0.0 area 0
R3(config-router)#network 4.4.34.3 0.0.0.0 area 0
 
R4(config)#router ospf 4
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#network 4.4.34.4 0.0.0.0 area 0
 
 
R1#show ip ospf neigh  해보면 아무것도 안나온다.......
 
 

외워야한다.

 Point to Multi와 Non Broadcast Multi-Access는 다른것이다.
 
맵에서보면 s1/0.12m은 물리적인 인터페이스이다.
show int s1/0.12
 

NBMA(Non Broadcast Multi-Access) 이다. = 수동으로 맺어줘야한다는 뜻
 
R1]에게
router ospf 4
neighbor 4.4.12.2 
이걸 해주던가

R2]에게
router ospf 4
neighbor 4.4.12.1
 
둘중하나만 해주면됨
 
show ip ospf neigh 하면 이웃맺어져있음
 
 
R3도 NON broadcast인데 표에보면 neighbor-membership을 auto로 설정된 애들을 보자. 그 중하나인 point 얘로 바꾸면 자동으로 neigh가 맺어질것이다.
바꿔보자.
 
R2(config)#int s1/0.23
R2(config-subif)#ip ospf network point-to-multipoint  
 
R3에가서도
R3(config-router)#int s1/0.23
R3(config-subif)#ip ospf network point-to-multipoint 
 

R3(config-subif)#do show ip ospf neigh
Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   FULL/  -        00:00:39    4.4.34.4        Serial1/0.34
4.4.2.2           0   FULL/  -        00:01:51    4.4.23.2        Serial1/0.23
 
//neighbor가 맺어져있다.
 
 
과제 ]
R1과 R2사이의 OSPF neighbor membership을 p-to-p로 바꾸세요.
R1(config)#do show ip ospf int s1/0 해보면 non broadcast라고 뜬다.
 
 
R1(config-subif)#int s1/0
R1(config-if)#ip ospf network point-to-point
 
R2(config-subif)#int s1/0.12
R2(config-subif)#ip ospf network point-to-point 

FULL이라는것은 라우팅 정보교환이 끝났다는 말이다.
옆에 - 는 BR 선출을 아직 안했다는 뜻
BR이란, 
예를들어 R1~4가 풀메시로 연결되어있다고 하면 Rip같은 경우에는 라우팅정보를 상대방이 싫든말든 30초마다 무조건 준다.
OSPF는 rip처럼 동작을 안하겠다. OSPF 는 Designated Router (지정라우터 = 대장 라우터)를 하나 뽑는다. 루프백에 주소DR 더 높은 게 DR이 된다.(4.4.4.4>4.4.1.1) 우선순위도 있는데 높은게 DR이 된다.(만약 안주면 루프백 주소중 숫자 높은게 DR이된다.) 그리고 먼저켠게 DR, 나중에 켠게 BDR(Backup DR)은 부대장이된다.
 
우선순위는 어떻게 정하나?
R1(config-if)#int s1/0
R1(config-if)#ip ospf priority 0~255사이의 숫자.
 
R1이 DR이 됐으면 R2, R3, R4는 자신이 정보를 전부 다 R1(DR)에게 준다.
DR이 아닌 라우터는 DR-Other 이라고 하는데 DR은 DR-Other에게 각각 다 나눠준다.
그럼 rip과 비교해보면 1/5수준으로 트래픽이 줄어버린다.!!
 
이때 DR이 DR-Other에게 보내는 channel이 224.0.0.5로 준다. => 224.0.0.5는 DR이 쓰는 channel
 
따라서 source ip는 224.0.0.0.5 , destination ip는 224.0.0.6 이다.
 
BDR은 DR에 장애가 생겼을때 DR을 대체할 놈.
 
다시 표를 보면 
DR은 p-to-p와 p-to-m에선 안뽑는다.
 
그래서! R1과 R2에 - 가 그어져있는것.
 
 
그럼 다시 R1과 R2를 broadcast로 바꿔보자.
R1(config-if)#int s1/0
R1(config-if)#ip ospf network broadcast
 
R2(config-subif)#int s1/0.12
R2(config-subif)#ip ospf net broadcast

R1의 루프백이 DR이 되었다.
 
만약 제대로 이웃이 안맺어지면 
clear ip ospf process를 해보자.
 


 

728x90

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

[실습] OSPF 23.04.11  (0) 2023.04.11
[실습] OSPF, EIGRP 23.04.06  (0) 2023.04.06
EIGRP default-route 23.04.04  (0) 2023.04.04
[리눅스] 23.03.31  (0) 2023.03.31
외워야할 이론 23.03.30 23.03.31  (0) 2023.03.30

댓글