OSPF 실습

OSPF 프로세스 활성화 및 Router ID 설정

R1

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1

R2

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.1

R3

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.1

 

각 인터페이스를 등록한다.

R1

R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 192.168.12.1 0.0.0.0 area 0
R1(config-router)#network 192.168.31.1 0.0.0.0 area 0

R2

R2(config-router)#network 2.2.2.1 0.0.0.0 area 0
R2(config-router)#network 192.168.12.2 0.0.0.0 area 0
R2(config-router)#network 192.168.23.2 0.0.0.0 area 0

R3

R3(config-router)#network 3.3.3.1 0.0.0.0 area 0
R3(config-router)#network 192.168.31.3 0.0.0.0 area 0
R3(config-router)#network 192.168.23.3 0.0.0.0 area 0

 

OSPF 설정 확인

R1

R1#show ip protocol

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:
    1.1.1.1 0.0.0.0 area 0
    192.168.12.1 0.0.0.0 area 0
    192.168.31.1 0.0.0.0 area 0
  Routing Information Sources:  
    Gateway         Distance      Last Update 
    1.1.1.1              110      00:01:32
    2.2.2.1              110      00:01:32
    3.3.3.1              110      00:01:32
  Distance: (default is 110)

R2

R2#show ip protocol

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.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    2.2.2.1 0.0.0.0 area 0
    192.168.12.2 0.0.0.0 area 0
    192.168.23.2 0.0.0.0 area 0
  Routing Information Sources:  
    Gateway         Distance      Last Update 
    1.1.1.1              110      00:10:45
    2.2.2.1              110      00:10:46
    3.3.3.1              110      00:10:45
  Distance: (default is 110)

R3

R3#show ip protocol

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.1
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    3.3.3.1 0.0.0.0 area 0
    192.168.31.3 0.0.0.0 area 0
    192.168.23.3 0.0.0.0 area 0
  Routing Information Sources:  
    Gateway         Distance      Last Update 
    1.1.1.1              110      00:12:33
    2.2.2.1              110      00:12:33
    3.3.3.1              110      00:12:33
  Distance: (default is 110)

 

neighbor 컴퓨터 확인

R1

R1#show ip ospf neighbor


Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.1           0   FULL/  -        00:00:38    192.168.12.2    Serial0/0/0
3.3.3.1           0   FULL/  -        00:00:34    192.168.31.3    Serial0/0/1
R1#show ip ospf int s0/0/0

Serial0/0/0 is up, line protocol is up
  Internet address is 192.168.12.1/24, Area 0
  Process ID 1, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 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:05
  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)

R2

R2#show ip ospf neighbor


Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.1           0   FULL/  -        00:00:33    192.168.23.3    Serial0/0/0
1.1.1.1           0   FULL/  -        00:00:32    192.168.12.1    Serial0/0/1
R2#show ip ospf int s0/0/0

Serial0/0/0 is up, line protocol is up
  Internet address is 192.168.23.2/24, Area 0
  Process ID 1, Router ID 2.2.2.1, Network Type POINT-TO-POINT, Cost: 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:02
  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 3.3.3.1
  Suppress hello for 0 neighbor(s)

R3

R3#show ip ospf neighbor


Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.1           0   FULL/  -        00:00:30    192.168.23.2    Serial0/0/1
1.1.1.1           0   FULL/  -        00:00:30    192.168.31.1    Serial0/0/0
R3#show ip ospf int s0/0/0

Serial0/0/0 is up, line protocol is up
  Internet address is 192.168.31.3/24, Area 0
  Process ID 1, Router ID 3.3.3.1, Network Type POINT-TO-POINT, Cost: 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:08
  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 1.1.1.1
  Suppress hello for 0 neighbor(s)

 

OSPF에 의해 라우팅 정보 받아왔는지 확인

R1

R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

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, GigabitEthernet0/0
L       1.1.1.1/32 is directly connected, GigabitEthernet0/0
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0/24 [110/65] via 192.168.12.2, 00:03:05, Serial0/0/0
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0/24 [110/65] via 192.168.31.3, 00:02:25, Serial0/0/1
     192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.12.0/24 is directly connected, Serial0/0/0
L       192.168.12.1/32 is directly connected, Serial0/0/0
O    192.168.23.0/24 [110/128] via 192.168.12.2, 00:02:25, Serial0/0/0
                     [110/128] via 192.168.31.3, 00:02:25, Serial0/0/1
     192.168.31.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.31.0/24 is directly connected, Serial0/0/1
L       192.168.31.1/32 is directly connected, Serial0/0/1

R2

R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0/24 [110/65] via 192.168.12.1, 00:11:16, Serial0/0/1
     2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       2.2.2.0/24 is directly connected, GigabitEthernet0/0
L       2.2.2.1/32 is directly connected, GigabitEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0/24 [110/65] via 192.168.23.3, 00:10:56, Serial0/0/0
     192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.12.0/24 is directly connected, Serial0/0/1
L       192.168.12.2/32 is directly connected, Serial0/0/1
     192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.23.0/24 is directly connected, Serial0/0/0
L       192.168.23.2/32 is directly connected, Serial0/0/0
O    192.168.31.0/24 [110/128] via 192.168.12.1, 00:10:56, Serial0/0/1
                     [110/128] via 192.168.23.3, 00:10:56, Serial0/0/0

R3

R3#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0/24 [110/65] via 192.168.31.1, 00:12:42, Serial0/0/0
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0/24 [110/65] via 192.168.23.2, 00:12:42, Serial0/0/1
     3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       3.3.3.0/24 is directly connected, GigabitEthernet0/0
L       3.3.3.1/32 is directly connected, GigabitEthernet0/0
O    192.168.12.0/24 [110/128] via 192.168.31.1, 00:12:42, Serial0/0/0
                     [110/128] via 192.168.23.2, 00:12:42, Serial0/0/1
     192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.23.0/24 is directly connected, Serial0/0/1
L       192.168.23.3/32 is directly connected, Serial0/0/1
     192.168.31.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.31.0/24 is directly connected, Serial0/0/0
L       192.168.31.3/32 is directly connected, Serial0/0/0

 

PC에서 TEST

PC1

C:\>ping 2.2.2.11

Pinging 2.2.2.11 with 32 bytes of data:

Request timed out.
Reply from 2.2.2.11: bytes=32 time=5ms TTL=126
Reply from 2.2.2.11: bytes=32 time=3ms TTL=126
Reply from 2.2.2.11: bytes=32 time=7ms TTL=126

Ping statistics for 2.2.2.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 3ms, Maximum = 7ms, Average = 5ms

C:\>ping 3.3.3.11

Pinging 3.3.3.11 with 32 bytes of data:

Request timed out.
Reply from 3.3.3.11: bytes=32 time=5ms TTL=126
Reply from 3.3.3.11: bytes=32 time=6ms TTL=126
Reply from 3.3.3.11: bytes=32 time=6ms TTL=126

Ping statistics for 3.3.3.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 5ms, Maximum = 6ms, Average = 5ms

PC2

C:\>ping 1.1.1.11

Pinging 1.1.1.11 with 32 bytes of data:

Reply from 1.1.1.11: bytes=32 time=2ms TTL=126
Reply from 1.1.1.11: bytes=32 time=6ms TTL=126
Reply from 1.1.1.11: bytes=32 time=5ms TTL=126
Reply from 1.1.1.11: bytes=32 time=5ms TTL=126

Ping statistics for 1.1.1.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 6ms, Average = 4ms

C:\>ping 3.3.3.11

Pinging 3.3.3.11 with 32 bytes of data:

Reply from 3.3.3.11: bytes=32 time=6ms TTL=126
Reply from 3.3.3.11: bytes=32 time=5ms TTL=126
Reply from 3.3.3.11: bytes=32 time=5ms TTL=126
Reply from 3.3.3.11: bytes=32 time=6ms TTL=126

Ping statistics for 3.3.3.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 5ms, Maximum = 6ms, Average = 5ms

PC3

C:\>ping 1.1.1.11

Pinging 1.1.1.11 with 32 bytes of data:

Reply from 1.1.1.11: bytes=32 time=6ms TTL=126
Reply from 1.1.1.11: bytes=32 time=2ms TTL=126
Reply from 1.1.1.11: bytes=32 time=6ms TTL=126
Reply from 1.1.1.11: bytes=32 time=7ms TTL=126

Ping statistics for 1.1.1.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 7ms, Average = 5ms

C:\>ping 2.2.2.11

Pinging 2.2.2.11 with 32 bytes of data:

Reply from 2.2.2.11: bytes=32 time=6ms TTL=126
Reply from 2.2.2.11: bytes=32 time=6ms TTL=126
Reply from 2.2.2.11: bytes=32 time=6ms TTL=126
Reply from 2.2.2.11: bytes=32 time=7ms TTL=126

Ping statistics for 2.2.2.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 6ms, Maximum = 7ms, Average = 6ms

OSPF.pkt
0.05MB


아래와 같이 라우터 연결을 하나 끊어도 통신이 잘 되는 것을 확인할 수 있다.

PC2

C:\>ping 1.1.1.11

Pinging 1.1.1.11 with 32 bytes of data:

Reply from 1.1.1.11: bytes=32 time=7ms TTL=126
Reply from 1.1.1.11: bytes=32 time=6ms TTL=126
Reply from 1.1.1.11: bytes=32 time=5ms TTL=126
Reply from 1.1.1.11: bytes=32 time=6ms TTL=126

Ping statistics for 1.1.1.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 5ms, Maximum = 7ms, Average = 6ms

C:\>ping 3.3.3.11

Pinging 3.3.3.11 with 32 bytes of data:

Reply from 3.3.3.11: bytes=32 time=10ms TTL=125
Reply from 3.3.3.11: bytes=32 time=8ms TTL=125
Reply from 3.3.3.11: bytes=32 time=8ms TTL=125
Reply from 3.3.3.11: bytes=32 time=7ms TTL=125

Ping statistics for 3.3.3.11:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 7ms, Maximum = 10ms, Average = 8ms

 

R2의 라우팅 정보는 변경되지 않는다.

R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O       1.1.1.0/24 [110/65] via 192.168.12.1, 00:20:03, Serial0/0/1
     2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       2.2.2.0/24 is directly connected, GigabitEthernet0/0
L       2.2.2.1/32 is directly connected, GigabitEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0/24 [110/129] via 192.168.12.1, 00:03:18, Serial0/0/1
     192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.12.0/24 is directly connected, Serial0/0/1
L       192.168.12.2/32 is directly connected, Serial0/0/1
O    192.168.31.0/24 [110/128] via 192.168.12.1, 00:03:18, Serial0/0/1

OSPF  DR, BDR 실습

OSPF 인터페이스 설정

R1

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 5.5.5.1 0.0.0.0 area 0

R2

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.1
R2(config-router)#network 2.2.2.1 0.0.0.0 area 0
R2(config-router)#network 5.5.5.2 0.0.0.0 area 0

R3

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.1
R3(config-router)#network 3.3.3.1 0.0.0.0 area 0
R3(config-router)#network 5.5.5.3 0.0.0.0 area 0

R4

R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.1
R4(config-router)#network 4.4.4.1 0.0.0.0 area 0
R4(config-router)#network 5.5.5.4 0.0.0.0 area 0

 

DR, BDR 확인

라우터를 킨 순서로 DR, BDR이 선정된다.

DR, BDR이 선정되면 다시 선정하는 작업은 하지 않는다.

R4#show ip ospf neighbor


Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:39    5.5.5.1         GigabitEthernet0/1
3.3.3.1           1   2WAY/DROTHER    00:00:30    5.5.5.3         GigabitEthernet0/1
2.2.2.1           1   FULL/BDR        00:00:33    5.5.5.2         GigabitEthernet0/1

 

DR로 선정된 R1을 끄면 DR이 변경되는 것을 확인할 수 있다.

R3#show ip ospf neighbor


Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.1           1   FULL/DR         00:00:37    5.5.5.2         GigabitEthernet0/1
4.4.4.1           1   FULL/BDR        00:00:37    5.5.5.4         GigabitEthernet0/1
1.1.1.1           1   2WAY/DROTHER    00:00:37    5.5.5.1         GigabitEthernet0/1

 

PC TEST

PC1

C:\>ping 3.3.3.11

Pinging 3.3.3.11 with 32 bytes of data:

Request timed out.
Reply from 3.3.3.11: bytes=32 time<1ms TTL=126
Reply from 3.3.3.11: bytes=32 time<1ms TTL=126
Reply from 3.3.3.11: bytes=32 time<1ms TTL=126

Ping statistics for 3.3.3.11:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

DR_BDR.pkt
0.05MB


Multi area OSPF

Router 설정

R0_1

R0_1(config)#router ospf 1
R0_1(config-router)#router-id 192.168.0.1
R0_1(config-router)#network 192.168.0.1 0.0.0.0 area 0
R0_1(config-router)#network 192.168.1.1 0.0.0.0 area 1

R0_2

R0_2(config)#router ospf 1
R0_2(config-router)#router-id 192.168.0.2
R0_2(config-router)#network 192.168.0.2 0.0.0.0 area 0
R0_2(config-router)#network 192.168.2.1 0.0.0.0 area 2

R1

R1(config)#router ospf 1
R1(config-router)#router-id 192.168.10.1
R1(config-router)#network 192.168.10.1 0.0.0.0 area 1
R1(config-router)#network 192.168.1.2 0.0.0.0 area 1

R2

R2(config)#router ospf 1
R2(config-router)#router-id 192.168.20.1
R2(config-router)#network 192.168.20.1 0.0.0.0 area 2
R2(config-router)#network 192.168.2.2 0.0.0.0 area 2

 

PC1에서 TEST

C:\>ping 192.168.20.3

Pinging 192.168.20.3 with 32 bytes of data:

Request timed out.
Reply from 192.168.20.3: bytes=32 time=59ms TTL=124
Reply from 192.168.20.3: bytes=32 time=11ms TTL=124
Reply from 192.168.20.3: bytes=32 time=10ms TTL=124

Ping statistics for 192.168.20.3:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 10ms, Maximum = 59ms, Average = 26ms

multi area ospf.pkt
0.05MB

'네트워크 공부 기록' 카테고리의 다른 글

신뢰적 Data 전송 : rdt 1.0  (0) 2022.01.18
Transport Layer  (0) 2022.01.18
OSPF  (0) 2022.01.18
RIP 라우팅 구현 실습  (0) 2022.01.17
동적 라우팅 및 RIP  (0) 2022.01.17

+ Recent posts