본문으로 바로가기

0. OSPF(Open Shortest Path First)

 

 - Link-State 알고리즘
 - Classless Routing Protocol
 - VLSM, CIDR
 - IGP
 - RIP,EIGRP보다는 복잡하지만 대규모 네트워크에 많이 사용된다.

 - 224.0.0.5와 224.0.0.6의 멀티캐스트 주소를 사용. 프로토콜 번호 89

 - 경로(링크)에 상태에 변화가 생기면 변화된 부분만 업데이트 실시하고 업데이트 할 내용이 없더라도 30분간격으로

   link state refresh 기능을 통해 주기적으로 라우팅 업데이트 정보를 교환

 - rip은 hop count, EIGRP는 대역폭과 지연값, OSPF는 링크의 비용(cost)를 메트릭으로 사용하여 가장작은 메트릭값의 목적지 네트워크로 경로를 결정

 

 - OSPF는 라우팅 테이블의 생성, 유지,관리를 위해 5가지 독특한 패킹유형이 있다.

      1. hello: 설정된 라우터의 인접 관계를 맺기 위해 사용되는 패킷

      2. DBD: 링크 상태 정보의 데이터베이스, 이웃라우터 간의 데이터베이스를 동기화하는데 사용

      3. LSU : 데이터베이스에 그 경로가 있을때 링크 상태 정보를 요청할때 사용

      4. LSR : LSU의 응답으로 사용하고 이웃라우터에게 비용이라던지 상태 정보를 LSA에게 전달한다. 

      5. LSAck : 다른 패킷 유형에 대한 수신확인

 

OSPF핼로 패킷을 자신과 이웃한 라우터에 보낸후 네이버 관계를 맺는다. 인접성을 맺기위해서는 몇가지 조건이 있다. 첫번째가 동일한 영역(번호가 같아야 함)에 속해야 하며 두번째로 인접성을 맺는 라우터 간에는 동일한 Hello 및 dead interval 값을 가져야 한다.

 

 

네이버 관계를 맺여도 라우팅 테이블을 교환한 네이버가 있고 라우팅 테이블을 교환하지 않은 테이블이 있으며

네이버 관계를 형성하여 라우팅 테이블을 교환한 네이버를 adjacent neighbor라고 한다.

OSPF에서는 라우팅 정보를 LSA( Link  state advertise ment) 라고 한다.

 

LSA교환이 끝나면 이를 근거로 SPF(Shortest Path First) 또는(Dijkstra)라는 알고리즘을 이용하여 각 목적지까지 최적경로를 계산하고 이를 라우팅 테이블에 저장을 합니다.

 

 

 

1. ospf 동작과정 : debug ip ospf adj로 확인가능

 

- 1.down state : ospf설정을 했지만 동작하지 않은 상태

- 2. init state(아이나이트) : 헬로우 패킷을 교환이 진행 중인 상태 아직 이웃라우터를 모른다.

                               즉, 네이버 이웃라우터로부터 헬로우 패킷을 받았으나 상대방은 받지 못한 상태

- 3. two-way state : 상호 라우터 간에 Hello 패킷이 교환된 상태

- 4. Exstart state :DBD라는 패킷을 교환하는데 라우터 id를 서로 비교해서 라우터 id가 높은것이 마스터라우터가 되고, 그 다음이 슬레이브라우터가 된다.

 

-----> hello 패킷을 사용

-------------------------------------------------------------------------------------------------------------------------

 5. Exchange state :: 교환하는 단계,,EIGRP는 토폴로지라는 테이블이있지만 osfp는 데이터베이스 테이블(LInk state Data base:(LSDB): 링크정보를 관리한다. 예를 들어서 R2라우터에 링크정보가 1,2,3이 있고 R1라우터에는 1,2번 정보가 있다고 가정하자.

이때 R1과 R2는 자신의 데이터베이스에 있는 링크 정보를 header부분만 DBD라는 패킷에 넣어서 라우팅 정보를 교환하게 된다.

마스터에서 먼저 나간다. R2가 R1으로 내보내게 되면 DBD안에 3번정보가 있게 되는것 즉 R1라우터에 3번정보가 들어가게 되는것이다.

 

 6. loading state : R1이 EX change일때 DBD를 받았을것이다. DBD에 링크정보가 1,2,3번이 있는데 자신이 받은 정보데이터베이스에 있는 링크 정보를 비교하게 된다. 데이터베이스에 3번링크가 없으므로  LSR패킷을 통해 3번이라는 정보를 요청하게 된다. R2는 LSR을 받으면 링크 스테이트 업데이트(LSU)를 하게 해주는데 잘받았으면 ACK

 7. Full state : 네이버간에 Routing UPdate 가 모두 끝난 상태, 데이터베이스가 동기화가 완료가 된상태이다.

 

 

 

2. OSPF 네이버 성립 조건 : 명령어 show ip ospf interface 해당 시리얼인터페이스

 

 - 같은 네트워크은 동일한 Area에 포함되어야 한다.
 - 같은 네트워크은 OSPF Hello/Dead 주기 시간이 동일해야 한다.
 - 같은 네트워크은 MTU 사이즈가 동일해야 한다.
 - 라우터 아이디가 중복되면 안된다.

 

R3#show ip ospf interface s0/2/0
Serial0/2/0 is up, line protocol is up
  Internet address is 203.230.11.1/24, Area 0
  Process ID 1, Router ID 3.3.3.3, Network Type POINT-TO-POINT, Cost: 64
  Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0
  No designated router on this network
  No backup designated router on this network
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:04
  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 0 msec, maximum is 0 msec
  Neighbor Count is 1 , Adjacent neighbor count is 1
    Adjacent with neighbor 1.1.1.1
  Suppress hello for 0 neighbor(s)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

R3#show int s0/2/0
Serial0/2/0 is up, line protocol is up (connected)
  Hardware is HD64570
  Internet address is 203.230.11.1/24
  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 

 [실습 환경]

 

 

 


3. 라우터 아이디(Router-ID)

 

 - OSPF 라우터를 구분하기 위한 식별자
 - 형식 : IPv4 주소 형식

 

 

 1) 물리적인 인터페이스만 있을 경우, 그 중에 IP 주소가 가장 높은 IP 주소로 선출

 

g0/0 : 203.230.9.1
S0/2/1 : 203.230.12.1 <- 라우터 아이디 선출

 


 2) Loopback 인터페이스가 있을 경우, Loopback 중에 IP 주소가 가장 높은 IP 주소로 선출

 

g0/0 : 203.230.9.1
S0/2/1 : 203.230.12.1
Lo172 : 172.16.1.1 <- 라우터 아이디 선출

 

 - 단, Down 상태인 인터페이스 IP 주소로는 선출하지 않는다.

 


 3) 'router-id' 명령어를 이용한 수동 선출

 

R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1(하는것을 권장)

 

 

 

show ip protocols의 명령어를 이용하면 라우터 ID를 확인할 수 있다.

 

ex)

@R1

 

R1#show ip protocols

Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set 
  Router ID 1.1.1.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    203.230.7.0 0.0.0.255 area 0
    203.230.10.0 0.0.0.255 area 0
    203.230.11.0 0.0.0.255 area 0
  Routing Information Sources: 
    Gateway         Distance      Last Update
    1.1.1.1              110      00:17:42
    2.2.2.2              110      00:17:42
    3.3.3.3              110      00:17:42
  Distance: (default is 110)

 

@R2

Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 2.2.2.2
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    203.230.9.0 0.0.0.255 area 0
    203.230.10.0 0.0.0.255 area 0
    203.230.12.0 0.0.0.255 area 0
  Routing Information Sources: 
    Gateway         Distance      Last Update
    1.1.1.1              110      00:18:14
    2.2.2.2              110      00:18:14
    3.3.3.3              110      00:18:14
  Distance: (default is 110)

 

@R3

 

Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set 
  Router ID 3.3.3.3
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    203.230.8.0 0.0.0.255 area 0
    203.230.11.0 0.0.0.255 area 0
    203.230.12.0 0.0.0.255 area 0
  Routing Information Sources: 
    Gateway         Distance      Last Update
    1.1.1.1              110      00:20:54
    2.2.2.2              110      00:20:54
    3.3.3.3              110      00:20:54
  Distance: (default is 110)

 

 *** show ip protocols 동작 상세를 알아보기 위해 debug ip ospf events명령어를 사용해보자.

 

@R3

 

R3#debug ip ospf events
OSPF events debugging is on
R3#
00:58:52: OSPF: Rcv hello from 1.1.1.1 area 0 from Serial0/2/0 203.230.11.2

00:58:52: OSPF: End of hello processing

00:58:52: OSPF: Rcv hello from 2.2.2.2 area 0 from Serial0/2/1 203.230.12.1

00:58:52: OSPF: End of hello processing

00:59:02: OSPF: Rcv hello from 1.1.1.1 area 0 from Serial0/2/0 203.230.11.2

00:59:02: OSPF: End of hello processing

00:59:02: OSPF: Rcv hello from 2.2.2.2 area 0 from Serial0/2/1 203.230.12.1

00:59:02: OSPF: End of hello processing

 

 

--------------> 10초에 한번씩 헬로 패킷을 받고 있음을 알 수 있다.

 

 

4. Area 설계

 

 - OSPF 광고양을 최소화하기 위해서 Area 설계를 실시한다.
 - 같은 Area 안에서는 전체 광고되지만, 다른 Area로는 추가/삭제된 부분만 광고한다.


 - Area 설계 방법 : 모든 Area는 Area 0을 경유하도록 설계해야 한다.

 - Area 0 = Backbone Area (모든 Area가 경유하는 Area)
 - ABR = Area 0과 Area X 사이에 있는 라우터
 - ASBR = 외부 네트워크 정보를 OSPF 환경으로 라우팅 업데이트하는 라우터

 


5. OSPF 설정

 

Router(config)# router ospf [1~65535 Process-ID]
Router(config-router)# router-id x.x.x.x
Router(config-router)# network [로컬 네트워크] [와일드카드 마스크] area [area 주소]

Router(config-router)# passive-interface [Interface Name]

 

@ R1

 

router ospf 1
 router-id 1.1.1.1
 network 203.230.10.2 0.0.0.255 area 0
 network 203.230.11.2 0.0.0.255 area 0
 network 203.230.7.1 0.0.0.255 area 0

 

@ R2

 

router ospf 1
 router-id 2.2.2.2
 network 203.230.9.1 0.0.0.255 area 0
 network 203.230.12.1 0.0.0.255 area 0
 network 203.230.10.1 0.0.0.255 area 0

 

@ R3

 

router ospf 1
 router-id 3.3.3.3
 network 203.230.11.1 0.0.0.255 area 0
 network 203.230.12.2 0.0.0.255 area 0
 network 203.230.8.1 0.0.0.255 area 0
 

 

R1,R2,R3#show run
R1,R2,R3#show ip ospf neighbor : osfp도 eigrp와 마찬가지로 데이터 패킷을 성립하기 위해서는 라우터간에 네이버 관계를 맺어야 한다.

 R1>show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/  -        00:00:38    203.230.10.1    Serial0/2/0
3.3.3.3           0   FULL/  -        00:00:38    203.230.11.1    Serial0/2/1

 

R2>show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           0   FULL/  -        00:00:36    203.230.10.2    Serial0/2/0
3.3.3.3           0   FULL/  -        00:00:36    203.230.12.2    Serial0/2/1

 

R3#show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           0   FULL/  -        00:00:36    203.230.11.2    Serial0/2/0
2.2.2.2           0   FULL/  -        00:00:36    203.230.12.1    Serial0/2/1

 

neighbor id : 이웃하은 네이버 라우터의 id

pri : 우선 순위

state : 현재 ospf상태를 나타냄......FULL이란 정상적으로 네이버 관계를 맺고 있음을 나타냄\

dead time : 헬로 패킷을 수신하기 위해 기다리는 시간을 나타냄.

address : 직접연결된 라우터의 주소

interface : 출구인터페이스

 

R1,R2,R3#show ip route : ospf로 받아 오는 경로는 맨앞에 대문자 O로 표시 된다.

Gateway of last resort is not set


1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 1.1.1.0/24 is directly connected, Loopback0

L 1.1.1.1/32 is directly connected, Loopback0

2.0.0.0/32 is subnetted, 1 subnets

O 2.2.2.1/32 [110/65] via 203.230.10.1, 00:03:32, Serial0/2/0

3.0.0.0/32 is subnetted, 1 subnets

O 3.3.3.1/32 [110/65] via 203.230.11.1, 00:02:12, Serial0/2/1

203.230.7.0/24 is variably subnetted, 2 subnets, 2 masks

C 203.230.7.0/24 is directly connected, GigabitEthernet0/0

L 203.230.7.1/32 is directly connected, GigabitEthernet0/0

O 203.230.8.0/24 [110/65] via 203.230.11.1, 00:02:22, Serial0/2/1

O 203.230.9.0/24 [110/65] via 203.230.10.1, 00:04:32, Serial0/2/0

203.230.10.0/24 is variably subnetted, 2 subnets, 2 masks

C 203.230.10.0/24 is directly connected, Serial0/2/0

L 203.230.10.2/32 is directly connected, Serial0/2/0

203.230.11.0/24 is variably subnetted, 2 subnets, 2 masks

C 203.230.11.0/24 is directly connected, Serial0/2/1

L 203.230.11.2/32 is directly connected, Serial0/2/1

O 203.230.12.0/24 [110/128] via 203.230.10.1, 00:03:59, Serial0/2/0

 

R2,R3동일

 

 

6. OSPF 메트릭

 

 - Cost = 10^8 / Bandwidth

 

Ex) R1-R3-203.230.8.0 네트워크까지 OSPF 메트릭(Cost)은 얼마인가?

 

               
R1------------------------R3----------------203.230.8.0네트워크
              cost = 64     +    cost = 1                                  

 

 64 + 1

 

 

@R1 show ip route

 

O 203.230.8.0/24 [110/65] via 203.230.11.1, 00:02:22, Serial0/2/1

----> 여기에서 보면 203.230.8.0 네트워크로 가려면 비용이 65이고 , s0/2/1로 나가 203.230.11.1로 경유한다는 것을 알수있다.

메트릭 값을 구해보자

 

 

@R1 show ip ospf int s0/2/0

 

Serial0/2/0 is up, line protocol is up

Internet address is 203.230.10.2/24, Area 0

Process ID 7, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 64

Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0

No designated router on this network

No backup designated router on this network

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

Hello due in 00:00:01

Index 2/2, flood queue length 0

Next 0x0(0)/0x0(0)

Last flood scan length is 1, maximum is 1

Last flood scan time is 0 msec, maximum is 0 msec

Neighbor Count is 1 , Adjacent neighbor count is 1

Adjacent with neighbor 2.2.2.1

Suppress hello for 0 neighbor(s)

 

비용 뿐만아니라, 프로세스 아이디, 라우터아이디, 네트워크 다입, 우선순위 등을 알 수 있다.

R3>show ip ospf int g0/0

 

GigabitEthernet0/0 is up, line protocol is up

Internet address is 203.230.8.1/24, Area 0

Process ID 7, Router ID 3.3.3.1, Network Type BROADCAST, Cost: 1

Transmit Delay is 1 sec, State DR, Priority 1

Designated Router (ID) 3.3.3.1, Interface address 203.230.8.1

No backup designated router on this network

Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5

Hello due in 00:00:00

Index 1/1, flood queue length 0

Next 0x0(0)/0x0(0)

Last flood scan length is 1, maximum is 1

Last flood scan time is 0 msec, maximum is 0 msec

Neighbor Count is 0, Adjacent neighbor count is 0

Suppress hello for 0 neighbor(s)

 

비용이 1인것을 알수있다,

 

 


7. OSPF 신뢰도

 

R1#show ip route ospf     
     172.16.0.0/24 is subnetted, 2 subnets
O       172.16.3.0 [110/129] via 13.13.12.2, 00:06:43, Serial1/0
     13.0.0.0/24 is subnetted, 5 subnets
O       13.13.20.0 [110/74] via 13.13.12.2, 00:06:43, Serial1/0
O       13.13.23.0 [110/128] via 13.13.12.2, 00:06:43, Serial1/0
O       13.13.30.0 [110/138] via 13.13.12.2, 00:06:43, Serial1/0

 

[참고] 경로 신뢰도

 

Connected 0
Static  1
EIGRP  90
OSPF  110
RIP  120
EIGRP External 170 

 


5. OSPF 라우팅 업데이트 및 변경 사항

 

 - 네트워크 추가 및 삭제될 경우, LSU 패켓을 통해서 업데이트 실시

 

 [실습 환경]

 

 7. OSPF 테이블 유형(2개)

 

 1) 네이버 테이블

 

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2              0   FULL/  -        00:00:30    13.13.12.2      Serial1/0

 


 2) 데이터베이스 테이블(Link-State Database = LSDB) 예시

 

R1#show ip ospf database

   

-라우팅 업데이트 정보를 관리하는 테이블

 

 

-LSA(Link-state advertisement) 광고 타입에 따라 영역별로 관리

 

 

-LSA 광고를 이용하여 동기화 실시

 

 

               

R1#show ip ospf database

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1              50          0x80000006 0x00E351 4
2.2.2.2         2.2.2.2              51          0x80000007 0x008064 5
3.3.3.3         3.3.3.3              840         0x80000004 0x007682 4

 

@ R3 Area 0 링크 - 4개

 

13.13.23.0/24
13.13.30.0/24
172.16.3.0/24
R2와 연결된 S1/1 주소 13.13.23.3

 

@ R2 Area 0 링크 - 5개

 

13.13.12.0/24
13.13.20.0/24
13.13.23.0/24
R3와 연결된 S1/0 주소 13.13.23.2
R1과 연결된 S1/1 주소 13.13.12.2

 

@ R1 Area 0 링크 - 4개

 

13.13.10.0/24
13.13.12.0/24
172.16.1.0/24
R2와 연결된 S1/0 주소 13.13.12.1


R1#show ip ospf database router  ->더 자세하게 볼 수 있음

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

  LS age: 271
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000006
  Checksum: 0xE351
  Length: 72
  Number of Links: 4

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 172.16.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

 

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 2.2.2.2
     (Link Data) Router Interface address: 13.13.12.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.12.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.10.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 10


  LS age: 273
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000007
  Checksum: 0x8064
  Length: 84
  Number of Links: 5

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 1.1.1.1
     (Link Data) Router Interface address: 13.13.12.2
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.12.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.20.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

 

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 3.3.3.3
     (Link Data) Router Interface address: 13.13.23.2
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.23.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64


  LS age: 1063
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000004
  Checksum: 0x7682
  Length: 72
  Number of Links: 4

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 172.16.3.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.30.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

 

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 2.2.2.2
     (Link Data) Router Interface address: 13.13.23.3
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 13.13.23.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

 3) 라우팅 테이블 : 최적의 경로 관리

R1#show ip route ospf 또는 show ip route
     172.16.0.0/24 is subnetted, 2 subnets
O       172.16.3.0 [110/129] via 13.13.12.2, 00:10:32, Serial1/0
     13.0.0.0/24 is subnetted, 5 subnets
O       13.13.20.0 [110/74] via 13.13.12.2, 00:10:33, Serial1/0
O       13.13.23.0 [110/128] via 13.13.12.2, 00:10:33, Serial1/0
O       13.13.30.0 [110/138] via 13.13.12.2, 00:10:33, Serial1/0

 

 

8. OSPF 경로 유형

 

 - O : Intra-Area 경로, 같은 Area 네트워크
 - O IA : Inter-Area 경로, 다른 Area 네트워크
 - O E2 : External 경로, 외부 네트워크

 

OE2: 외부 내트워크를 ospf 내부라우터에게 알린다. E2가 default값으로 고정 메트릭값을 갖는다.
OIA : 다른 Area에 소속된 네트워크를 현재 Area에 속한 라우터에게 광고
OE1 : 외부 내트워크를 ospf 내부라우터에게 알린다. E1은 경로에 따라서 메트릭값이 변한다.

 

R3(config)#int lo 100
R3(config-if)#ip address 100.100.1.1 255.255.255.0
R3(config-if)#ip address 100.100.2.1 255.255.255.0 secondary
R3(config-if)#ip address 100.100.3.1 255.255.255.0 secondary
R3(config-if)#
R3(config-if)#int lo 200
R3(config-if)#ip address 200.200.1.1 255.255.255.0
R3(config-if)#ip address 200.200.2.1 255.255.255.0 secondary
R3(config-if)#ip address 200.200.3.1 255.255.255.0 secondary
R3(config-if)#ip ospf network point-to-point
R3(config-if)#
R3(config-if)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 100.0.0.0
R3(config-router)#
R3(config-router)#router ospf 1
R3(config-router)#network 200.200.0.0 0.0.255.255 area 13
R3(config-router)#redistribute rip subnets

 

 

R1#show ip route ospf
     100.0.0.0/24 is subnetted, 3 subnets
O E2    100.100.1.0 [110/20] via 13.13.12.2, 00:04:11, Serial1/0
O E2    100.100.2.0 [110/20] via 13.13.12.2, 00:04:11, Serial1/0
O E2    100.100.3.0 [110/20] via 13.13.12.2, 00:04:11, Serial1/0
O IA 200.200.1.0/24 [110/129] via 13.13.12.2, 00:04:11, Serial1/0
O IA 200.200.2.0/24 [110/129] via 13.13.12.2, 00:04:11, Serial1/0
     172.16.0.0/24 is subnetted, 2 subnets
O       172.16.3.0 [110/129] via 13.13.12.2, 00:04:11, Serial1/0
O IA 200.200.3.0/24 [110/129] via 13.13.12.2, 00:04:11, Serial1/0
     13.0.0.0/24 is subnetted, 5 subnets
O       13.13.20.0 [110/74] via 13.13.12.2, 00:04:11, Serial1/0
O       13.13.23.0 [110/128] via 13.13.12.2, 00:04:11, Serial1/0
O       13.13.30.0 [110/138] via 13.13.12.2, 00:04:11, Serial1/0

 

 

 


9. ABR, ASBR 라우터 확인: show ip ospf

 

 - ABR : Area 0과 Area X 사이에 있는 라우터
 - ASBR : 외부 네트워크 정보를 OSPF 환경으로 라우팅 업데이트하는 라우터

 

 

 

10. DR/BDR

 ospf는 경로에 변화가 생기면 라우터들 간에 LSA를 주고 받는데 모든 라우터가 LSA를 주고 받으면 소규모 네트워크는 문제 없지만 라우터가 많으면 과도한 LSA 정보를 주고 받기 때문에 설계를 나눈다. 네트워크가 커진다고 해서 계속적으로 영역을 나누는것도 좋지는 않다. 그래서 단일 네트워크 영역에 DR(Designated Router)와 BDR(back designated Router)를 선정하고 LSA 정보는 DR에게만 240.0.0.5 주소를 사용하여 보내고 , 나머지 BDR과 DR others는 240.0.0.6 멀티캐스트 주소를 사용하여 보내게 된다.

 

 

 

 

 - Multi Access 환경에서 DR/BDR을 선출한다. (단, Point-to-Point 환경은 선출 X)
 - Multi Access 환경 : Ethenet 환경

 - DR을 통해서 OSPF 광고를 실시하여, OSPF 광고양을 최소화시킨다.

 - 우선 순위의 기본값은 '1'이며, 우선 순위가 '0'이면 무조건 DROTHER로 동작한다.

 


 - DR 선출 과정

 

 ① OSPF 우선 순위가 높은 라우터가 DR, 두번째가 BDR
 ② OSPF 라우터 아이디가 높은 라우터가 DR, 두번째가 BDR

 

 - DR/BDR 아닌 라우터들은 'DROTHER'라고 한다.
 - DR/BDR은 우선 순위를 조정하여 수동 선출하는 것을 권장한다.

 

Router(config-if)# ip ospf priority [0~255] : ospf 우선순위 설정 명령어

 

 - 우선 순위의 기본값은 '1'이며, 우선 순위가 '0'이면 무조건 DROTHER로 동작한다.

 

 

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   2WAY/DROTHER    00:00:37    13.13.100.1     FastEthernet0/1
2.2.2.2           1   2WAY/DROTHER    00:00:37    13.13.100.2     FastEthernet0/1
4.4.4.4           1   FULL/BDR        00:00:37    13.13.100.4     FastEthernet0/1
5.5.5.5           1   FULL/DR         00:00:37    13.13.100.5     FastEthernet0/1

 

 

Ex) R1을 DR, R2를 BDR, 나머지 라우터는 무조건 DROTHER가 되도록 구성하여라.

 

@ R1


int fa0/1
 ip ospf priority 255

 

 

@ R2


int fa0/1
 ip ospf priority 254

 


@ R3, R4, R5

 

int fa0/1
 ip ospf priority 0

 

 @R3

DRothers를 확인하기 위해 R3에서 네이버 관계를 확인한다.

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1         255   FULL/DR         00:00:35    13.13.100.1     FastEthernet0/1
2.2.2.2         254   FULL/BDR        00:00:35    13.13.100.2     FastEthernet0/1
4.4.4.4           0   2WAY/DROTHER    00:00:35    13.13.100.4     FastEthernet0/1
5.5.5.5           0   2WAY/DROTHER    00:00:35    13.13.100.5     FastEthernet0/1

 

 

11. OSPF 인증 : 영역인증과 네이버인증으로 나뉜다.

 

 - OSPF 패켓 변조 방지

 

Ex) Area 0 구간에 인증을 실시하여라.

 평문을 사용한 네이버 인증

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int gi0/0
R1(config-if)#ip os
R1(config-if)#ip ospf au
R1(config-if)#ip ospf auth
R1(config-if)#ip ospf authen
R1(config-if)#ip ospf authentication
R1(config-if)#ip ospf suth
R1(config-if)#ip ospf authentication-key cisco
R1(config-if)#

 

md5 방식을 사용한 네이버 인증

int g0/0

ip ospf authentication message-digest

ip ospf message-digest-key 1 md5 cisco

 

평문을 사용한 영역 인증

 

R1(config-if)#router ospf 1
R1(config-router)#area 0 auth
R1(config-router)#area 0 authentication
R1(config-router)#exit
R1(config)#int gi0/0
R1(config-if)#ip ospf
R1(config-if)#ip ospf a
R1(config-if)#ip ospf authentication-key cisco
R1(config-if)#

 

 

 

평문을 사용한 영역인증

R1(config-if)#router ospf 1
R1(config-router)#area 0 auth
R1(config-router)#area 0 authentication
R1(config-router)#exit
R1(config)#int gi0/0
R1(config-if)#ip ospf
R1(config-if)#ip ospf a
R1(config-if)#ip ospf authentication-key cisco
R1(config-if)#

 

md5 방식을 사용한 영역 인증

 

router ospf 1

area 0 authentication message-digest

int g0/0

ip ospf message-digest-key 1 md5 cisco

 

 

 

R1,R2,R3#show run
R1,R2,R3#show ip ospf neighbor
R1,R2,R3#show ip route 

 

 

 

[실습 환경]

 

 

 - 그림을 참고하여 OSPF Area 0, Area 13, Area 113을 구성한다.

 

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 13.13.10.0 0.0.0.255 area 0
R1(config-router)#network 13.13.12.0 0.0.0.255 area 0
R1(config-router)#network 172.16.1.0 0.0.0.255 area 0

R1(config-router)#passive-interface fa0/0

R1(config-router)#passive-interface lo172
R1(config-router)#end

 

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 13.13.12.0 0.0.0.255 area 0
R2(config-router)#network 13.13.20.0 0.0.0.255 area 13
R2(config-router)#network 13.13.23.0 0.0.0.255 area 13

R2(config-router)#passive-interface fa0/0
R2(config-router)#end

 

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 13.13.23.0 0.0.0.255 area 13
R3(config-router)#network 13.13.30.0 0.0.0.255 area 13
R3(config-router)#network 172.16.3.0 0.0.0.255 area 113

R3(config-router)#passive-interface fa0/0

R3(config-router)#passive-interface lo172
R3(config-router)#end

 

 

 

 

12. Virtual-Link 설정

 

 - Area 0을 경유하지 못하는 Area가 발생할 경우, 사용하는 기능
 - R2에서 R3의 Area 113 '172.16.3.0/24' 네트워크 정보가 라우팅 업데이트 됬는지 확인한다.

 

R2#show ip route ospf
     172.16.0.0/24 is subnetted, 1 subnets
O       172.16.1.0 [110/65] via 13.13.12.1, 00:02:01, Serial1/1
     13.0.0.0/24 is subnetted, 5 subnets
O       13.13.10.0 [110/74] via 13.13.12.1, 00:02:02, Serial1/1
O       13.13.30.0 [110/74] via 13.13.23.3, 00:00:41, Serial1/0

 

 

 - 해결 방법 : 버추얼 링크를 이용하여 ABR R2가 갖고 있는 Area 0 정보를 R3에게 동기화 시킴

 

R2(config)#router ospf 1
R2(config-router)#area 13 virtual-link 3.3.3.3
R2(config-router)#end

 

R3(config)#router ospf 1
R3(config-router)#area 13 virtual-link 2.2.2.2
R3(config-router)#end

 


R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3           0   FULL/  -           -        13.13.23.3      OSPF_VL0
1.1.1.1           0   FULL/  -        00:00:37    13.13.12.1      Serial1/1
3.3.3.3           0   FULL/  -        00:00:34    13.13.23.3      Serial1/0

 

 

R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/  -           -        13.13.23.2      OSPF_VL0
2.2.2.2           0   FULL/  -        00:00:30    13.13.23.2      Serial1/1

 

 

R3#show ip ospf virtual-links
Virtual Link OSPF_VL0 to router 2.2.2.2 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 13, via interface Serial1/1, Cost of using 64
  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:01
    Adjacency State FULL (Hello suppressed)
    Index 1/2, 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

 

 

R3#show ip ospf
 Routing Process "ospf 1" with ID 3.3.3.3
 Start time: 00:49:27.332, Time elapsed: 00:04:22.676
 Supports only single TOS(TOS0) routes
 Supports opaque LSA
 Supports Link-local Signaling (LLS)
 Supports area transit capability
 It is an area border router
 Router is not originating router-LSAs with maximum metric
 Initial SPF schedule delay 5000 msecs
~ 중간 생략 ~


 External flood list length 0
 IETF NSF helper support enabled
 Cisco NSF helper support enabled
    Area BACKBONE(0)
        Number of interfaces in this area is 1
        Area has no authentication
        SPF algorithm last executed 00:00:20.880 ago
        SPF algorithm executed 3 times
        Area ranges are
        Number of LSA 10. Checksum Sum 0x055D60
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 5
        Flood list length 0
    Area 13
        Number of interfaces in this area is 2
        This area has transit capability: Virtual Link Endpoint
        Area has no authentication
        SPF algorithm last executed 00:00:20.912 ago
        SPF algorithm executed 5 times
        Area ranges are
        Number of LSA 6. Checksum Sum 0x0210BE
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0
    Area 113
        Number of interfaces in this area is 1
        Area has no authentication
        SPF algorithm last executed 00:00:31.280 ago
        SPF algorithm executed 3 times
        Area ranges are
        Number of LSA 7. Checksum Sum 0x03C8F2
        Number of opaque link LSA 0. Checksum Sum 0x000000
        Number of DCbitless LSA 0
        Number of indication LSA 0
        Number of DoNotAge LSA 0
        Flood list length 0

 

 

R2#show ip route ospf
     172.16.0.0/24 is subnetted, 2 subnets
O       172.16.1.0 [110/65] via 13.13.12.1, 00:00:33, Serial1/1
O IA    172.16.3.0 [110/65] via 13.13.23.3, 00:00:33, Serial1/0
     13.0.0.0/24 is subnetted, 5 subnets
O       13.13.10.0 [110/74] via 13.13.12.1, 00:00:33, Serial1/1
O       13.13.30.0 [110/74] via 13.13.23.3, 00:00:33, Serial1/0

 

 

***ospf도 Rip이나 EIGRP와 같이 디폴트 정적 경로를 설정하고 이를 동일 영역 내의 모든 라우터에게 광고할 수있다.


 R1(config)#ip route 0.0.0.0 0.0.0.0 lo 0-----> 실재로는 외부네트워크에 설정(isp망과 가까운곳)
R1(config)#router ospf 1
R1(config-router)#de
R1(config-router)#default-information o
R1(config-router)#default-information originate ----> 모든 라우터에게 광고한다.
R1(config-router)#

 

show ip route로 확인하면 밑에

0*E2라고 표기된다. 

 [참고]

 

 

}라우팅 재분배
전체 네트워크를 하나의 라우팅 프로토콜만으로 운영하는 것은 어려울 수 있음.
다중 프로토콜을 사용하는 네트워크를 상호 연결하기 위해서 프로토콜 간에 라우팅 정보를 재분배
서로 다른 라우팅 프로토콜을 사용하는 영역간의 라우팅이 가능하도록 설정하는 것

 

 다음과 같은 토플로지에서 R1과 R3에 연결되있는 컴퓨터끼리 통신이 되게하려면 어떻게 해야될까요?

 

 이런경우, redistribute를 씁니다.

 

2. RIPv2와 eigrp와의 redistribute 

  - 위 예제에서 Router 0을 기준으로 왼쪽은 RIPv2로 구축되어있고, 오른쪽은 eigrp 100번으로 구축되어있다고 가정.

  - router 0 설정

 

Router(config)#router rip

Router(config-router)#version 2
Router(config-router)#redistribute eigrp 100 metric 4

#### 저기서 4는 rip 라우팅 프로토콜의 메트릭인 홉 수 를 의미함

 

Router(config)#router eigrp 100
Router(config-router)#redistribute rip metric 1544 10 255 1 1500

#### metric 뒤의 5개 숫자는 eigrp 의 메트릭이다. 차례대로 bandwidth, delay, reliability, load, MTU maximum size를 의미한다.

 

 

3. ospf와 eigrp와의 redistribute

  - 위 예제에서 Router 0을 기준으로 왼쪽은 ospf 10번, 오른쪽은 eigrp 100번으로 구축되어있다고 가정.

  - Router 0에서 설정

Router(config)#router ospf 10
Router(config-router)#redistribute eigrp 100 subnets

#### 여기서 subnets를 쓰지 않으면 classful 하게 재분배하기때문에 classless하게 재분배하기위해 쓴다.

 

Router(config)#router eigrp 100
Router(config-router)#redistribute ospf 10 metric 1544 10 255 1 1500

#### metric 뒤의 5개 숫자는 eigrp 의 메트릭이다. 차례대로 bandwidth, delay, reliability, load, MTU maximum size를 의미한다.

 

 

4 rip과 ospf와의 redistribute

  - 위 예제에서 Router 0을 기준으로 왼쪽은 RIP v2, 오른쪽은 ospf 100번으로 구축되어있다고 가정.

  - Router 0에서 설정

Router(config)#router rip

Router(config)#version 2

Router(config-router)#redistribute ospf 100 metric 4

#### 4는 rip protocol의 metric인 hop count이다.

 

Router(config)#router ospf 100
Router(config-router)#redistribute rip subnets

 

 

 

 

@R1

int fa0/1

 ip add 211.242.181.57 255.255.255.252
 no shutdown
!
ip route 0.0.0.0 0.0.0.0 211.242.181.58
!
router ospf 1
 default-information originate
!

@R2 핑테스트
int lo 100
 ip add 198.133.219.25 255.255.255.0
 ip add 168.126.63.1 255.255.255.0

R2,R3#show ip route
R2,R3#ping 198.133.219.25
R2,R3#ping 168.126.63.1

@R1
R1(config-if)#router ospf 1
R1(config-router)#network 211.240.181.14 0.0.0.15 area 0
R1(config-router)#network 211.242.181.57 0.0.0.3 area 0
R1(config-router)#network 211.242.181.49 0.0.0.3 area 0
R1(config-router)#end

@R2

R1(config-if)#router ospf 1
R1(config-router)#network 211.240.181.30 0.0.0.15 area 0
R1(config-router)#network 211.242.181.50 0.0.0.3 area 0
R1(config-router)#network 211.242.181.53.0.0.0.3 area 13
R1(config-router)#end

R2(config-router)#area 13 virtual-link 3.3.3.3
R2(config-router)#
00:29:12: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on OSPF_VL4 from LOADING to FULL, Loading Done

@R3
R3(config-if)#router ospf 1
R3(config-router)#network 211.240.181.46 0.0.0.15 area 113
R3(config-router)#network 211.242.181.54 0.0.0.3 area 13

R3(config-router)#end

R2(config-router)#area 13 virtual-link 2.2.2.2
R2(config-router)#
00:29:12: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on OSPF_VL4 from LOADING to FULL, Loading Done
 

area 13 virtual-link를 사용하는 이유는 Area 0(외부인터넷망 :ABR) 를  거쳐서 Area 13-> area 113을 통신해야하는데....
area 113은 area 0(ABR)을 거쳐서 오지 않기 때문에 인터넷이 안된다....... 따라서 virtua-link를 통해 통신해야한다.

 

 

참고] OSPF 네트워크 환경에 따른 Hello/Dead-Interval 기본값

                                                            Hello   Dead
Point-to-Point                                       10                   40
Broadcast                                            10                   40
Nonbroadcast                                       30                  120
Point-to-Multipoint                                 30                  120
Point-to-Multipoint Nonbroadcast            30                  120

 

 

 

 

 

 

 

 

참고

대역폭계산 = 기준 대역폭 / 링크 대역폭 = 100000000 / 대역폭이 적용된다...  그런데 100Mbps, 1Gps,10Gpbs 속도도 비용이 1이므로 링크 산정에 영향을 줄 수 잇다

이 문제를 해결 하기 위하여

auto-cost reference-bandwidth 명령어를 사용하여 조정한다. 패킷트레이서 지원 안됨

ex)

router ospf 1

auto-cost reference-bandwidth 10000