네트워크 및 서버/네트워크

OSPF 설정 명령어 (1) + 실습 예제 및 패킷

잉여토끼 2024. 10. 30. 19:48

OSPF 기본 설정 명령어

1. OSPF 활성화

conf t
router ospf [Process ID]

 

2. Priority 값 설정

conf t
int [Interface] 
ip ospf priority [Priority 값]

 

3. 라우터 ID설정

라우터 ID는 A.B.C.D형태

conf t
router ospf [Process ID]
router-id [Router ID]

 

4. 광고 네트워크 및 Area 설정

conf t
router ospf [Process ID]
network [NI] [Wildcard-mask] area [area-id]

 

5. Redistribute

subnet 정보까지 전달해야하므로 subnet을 붙여야함.

conf t
router ospf [Process ID]
# metric까지 설정.
redistribute [Protocol] metric [value] subnet
# metric은 정의된 값을 사용
redistribute [Protocol] subnet

 

6. OSPF 정보 확인.

# neighbor
show ip ospf neighbor

# LSDB
show ip ospf databse

# Interface OSPF Information
show ip ospf int [Interface]

# Interface OSPF Brief Information
show ip ospf int [Interface] bri

 

 

실습 예제

 

물리랩

  • R1 ~ 3은 BR
  • R3는 ABR
  • R4는 Area 1 IR

 

 

 

설정값

R1 R1 sh run
Building configuration...

Current configuration : 1713 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
!
!
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
!
voice dsp waitstate 0
!
!
!
!
!
!
!
!
!
!
!
!
!
memory-size iomem 0
archive
 log config
  hidekeys
! 
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
interface Loopback0
 ip address 1.1.1.1 255.255.0.0
!
interface FastEthernet0/0
 ip address 10.0.1.1 255.255.255.0
 duplex half
!
interface Serial1/0
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface Ethernet2/0
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/1
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/2
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/3
 no ip address
 shutdown
 duplex half
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.0.0 0.0.255.255 area 0
 network 10.0.1.0 0.0.0.255 area 0
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
!
!
logging alarm informational
no cdp log mismatch duplex
!
!
!
!
!
!
!
control-plane
!
!
!
mgcp fax t38 ecm
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end
R1 sh 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.0.0 0.0.255.255 area 0
    10.0.1.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    3.3.3.3              110      00:21:29
    2.2.2.2              110      00:19:17
  Distance: (default is 110)
R1 sh ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:35    10.0.1.3        FastEthernet0/0
3.3.3.3           1   FULL/DR         00:00:39    10.0.1.2        FastEthernet0/0
R1 sh 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         1201        0x80000004 0x0057A2 2
2.2.2.2         2.2.2.2         1159        0x80000002 0x005DA8 1
3.3.3.3         3.3.3.3         1202        0x80000005 0x00FCFE 1

		Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.1.2        3.3.3.3         1159        0x80000002 0x00C63D

		Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.2         2.2.2.2         1198        0x80000001 0x00FA31
3.3.3.3         3.3.3.3         1598        0x80000001 0x00AE75
4.4.4.4         2.2.2.2         1198        0x80000001 0x0021C2
10.0.2.0        2.2.2.2         1198        0x80000001 0x0037B1
R1 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     0               1.1.1.1/16         1     LOOP  0/0
Fa0/0        1     0               10.0.1.1/24        1     DROTH 2/2
R1 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     0               1.1.1.1/16         1     LOOP  0/0
Fa0/0        1     0               10.0.1.1/24        1     DROTH 2/2
R2 R2 sh run
Building configuration...

Current configuration : 1713 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
!
!
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
!
voice dsp waitstate 0
!
!
!
!
!
!
!
!
!
!
!
!
!
memory-size iomem 0
archive
 log config
  hidekeys
! 
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
interface Loopback0
 ip address 3.3.3.3 255.255.0.0
!
interface FastEthernet0/0
 ip address 10.0.1.2 255.255.255.0
 duplex half
!
interface Serial1/0
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface Ethernet2/0
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/1
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/2
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/3
 no ip address
 shutdown
 duplex half
!
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 network 3.3.0.0 0.0.255.255 area 1
 network 10.0.1.0 0.0.0.255 area 0
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
!
!
logging alarm informational
no cdp log mismatch duplex
!
!
!
!
!
!
!
control-plane
!
!
!
mgcp fax t38 ecm
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end
R2 sh 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.3
  It is an area border router
  Number of areas in this router is 2. 2 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    3.3.0.0 0.0.255.255 area 1
    10.0.1.0 0.0.0.255 area 0
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    1.1.1.1              110      00:21:38
    2.2.2.2              110      00:19:20
  Distance: (default is 110)
R2 sh ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DROTHER    00:00:38    10.0.1.1        FastEthernet0/0
2.2.2.2           1   FULL/BDR        00:00:32    10.0.1.3        FastEthernet0/0
R2 sh ip ospf database
            OSPF Router with ID (3.3.3.3) (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         1206        0x80000004 0x0057A2 2
2.2.2.2         2.2.2.2         1163        0x80000002 0x005DA8 1
3.3.3.3         3.3.3.3         1205        0x80000005 0x00FCFE 1

		Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.1.2        3.3.3.3         1162        0x80000002 0x00C63D

		Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.2         2.2.2.2         1202        0x80000001 0x00FA31
3.3.3.3         3.3.3.3         1602        0x80000001 0x00AE75
4.4.4.4         2.2.2.2         1202        0x80000001 0x0021C2
10.0.2.0        2.2.2.2         1202        0x80000001 0x0037B1

		Router Link States (Area 1)

Link ID         ADV Router      Age         
R2 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Fa0/0        1     0               10.0.1.2/24        1     DR    2/2
Lo0          1     1               3.3.3.3/16         1     LOOP  0/0
R2 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Fa0/0        1     0               10.0.1.2/24        1     DR    2/2
Lo0          1     1               3.3.3.3/16         1     LOOP  0/0
R3 R3 sh run
Building configuration...

Current configuration : 1758 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
!
!
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
!
voice dsp waitstate 0
!
!
!
!
!
!
!
!
!
!
!
!
!
memory-size iomem 0
archive
 log config
  hidekeys
! 
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
interface Loopback0
 ip address 2.2.2.2 255.255.0.0
!
interface FastEthernet0/0
 ip address 10.0.1.3 255.255.255.0
 duplex half
!
interface Serial1/0
 ip address 10.0.2.1 255.255.255.0
 serial restart-delay 0
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface Ethernet2/0
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/1
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/2
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/3
 no ip address
 shutdown
 duplex half
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 2.2.0.0 0.0.255.255 area 1
 network 10.0.1.0 0.0.0.255 area 0
 network 10.0.2.0 0.0.0.255 area 1
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
!
!
logging alarm informational
no cdp log mismatch duplex
!
!
!
!
!
!
!
control-plane
!
!
!
mgcp fax t38 ecm
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end
R3 sh 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.2
  It is an area border router
  Number of areas in this router is 2. 2 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    2.2.0.0 0.0.255.255 area 1
    10.0.1.0 0.0.0.255 area 0
    10.0.2.0 0.0.0.255 area 1
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    1.1.1.1              110      00:19:24
    4.4.4.4              110      00:20:04
    3.3.3.3              110      00:19:24
    10.0.2.2             110      00:25:26
  Distance: (default is 110)
R3 sh ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DROTHER    00:00:35    10.0.1.1        FastEthernet0/0
3.3.3.3           1   FULL/DR         00:00:32    10.0.1.2        FastEthernet0/0
4.4.4.4           0   FULL/  -        00:00:35    10.0.2.2        Serial1/0
R3 sh ip ospf database
            OSPF Router with ID (2.2.2.2) (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         1209        0x80000004 0x0057A2 2
2.2.2.2         2.2.2.2         1166        0x80000002 0x005DA8 1
3.3.3.3         3.3.3.3         1210        0x80000005 0x00FCFE 1

		Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.1.2        3.3.3.3         1166        0x80000002 0x00C63D

		Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.2         2.2.2.2         1204        0x80000001 0x00FA31
3.3.3.3         3.3.3.3         1606        0x80000001 0x00AE75
4.4.4.4         2.2.2.2         1204        0x80000001 0x0021C2
10.0.2.0        2.2.2.2         1204        0x80000001 0x0037B1

		Router Link States (Area 1)

Link ID         ADV Router      Age         
R3 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Fa0/0        1     0               10.0.1.3/24        1     BDR   2/2
Lo0          1     1               2.2.2.2/16         1     LOOP  0/0
Se1/0        1     1               10.0.2.1/24        64    P2P   1/1
R3 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Fa0/0        1     0               10.0.1.3/24        1     BDR   2/2
Lo0          1     1               2.2.2.2/16         1     LOOP  0/0
Se1/0        1     1               10.0.2.1/24        64    P2P   1/1
R4 R4 sh run
Building configuration...

Current configuration : 1713 bytes
!
upgrade fpd auto
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
logging message-counter syslog
!
no aaa new-model
ip source-route
no ip icmp rate-limit unreachable
ip cef
!
!
!
!
no ip domain lookup
no ipv6 cef
!
multilink bundle-name authenticated
!
!
voice dsp waitstate 0
!
!
!
!
!
!
!
!
!
!
!
!
!
memory-size iomem 0
archive
 log config
  hidekeys
! 
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
interface Loopback0
 ip address 4.4.4.4 255.255.0.0
!
interface FastEthernet0/0
 no ip address
 shutdown
 duplex half
!
interface Serial1/0
 ip address 10.0.2.2 255.255.255.0
 serial restart-delay 0
!
interface Serial1/1
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/2
 no ip address
 shutdown
 serial restart-delay 0
!
interface Serial1/3
 no ip address
 shutdown
 serial restart-delay 0
!
interface Ethernet2/0
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/1
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/2
 no ip address
 shutdown
 duplex half
!
interface Ethernet2/3
 no ip address
 shutdown
 duplex half
!
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 network 4.4.0.0 0.0.255.255 area 1
 network 10.0.2.0 0.0.0.255 area 1
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
!
!
logging alarm informational
no cdp log mismatch duplex
!
!
!
!
!
!
!
control-plane
!
!
!
mgcp fax t38 ecm
!
!
!
!
gatekeeper
 shutdown
!
!
line con 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line aux 0
 exec-timeout 0 0
 privilege level 15
 logging synchronous
 stopbits 1
line vty 0 4
 login
!
end
R4 sh 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 4.4.4.4
  Number of areas in this router is 1. 1 normal 0 stub 0 nssa
  Maximum path: 4
  Routing for Networks:
    4.4.0.0 0.0.255.255 area 1
    10.0.2.0 0.0.0.255 area 1
 Reference bandwidth unit is 100 mbps
  Routing Information Sources:
    Gateway         Distance      Last Update
    2.2.2.2              110      00:19:27
  Distance: (default is 110)
R4 sh ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/  -        00:00:39    10.0.2.1        Serial1/0
R4 sh ip ospf database
            OSPF Router with ID (4.4.4.4) (Process ID 1)

		Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         1204        0x80000005 0x0076D6 3
4.4.4.4         4.4.4.4         1478        0x80000001 0x009CA4 3

		Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.1         2.2.2.2         1169        0x80000001 0x0033FB
3.3.3.3         2.2.2.2         1169        0x80000001 0x00D650
10.0.1.0        2.2.2.2         1209        0x80000001 0x00C95F
R4 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     1               4.4.4.4/16         1     LOOP  0/0
Se1/0        1     1               10.0.2.2/24        64    P2P   1/1
R4 sh ip ospf int bri
Interface    PID   Area            IP Address/Mask    Cost  State Nbrs F/C
Lo0          1     1               4.4.4.4/16         1     LOOP  0/0
Se1/0        1     1               10.0.2.2/24        64    P2P   1/1

 

 

 

 

Packet

Hello

 

DBDes
LSReq
LSUp
LSAck