Dynamic Routing - OSPF (교육 14일차)

SW·2022년 12월 9일
0







(참고) 와일드카드 마스크

  • 서브넷 마스크와 구분하기 위해서 ‘0’과 ‘1’을 반대로 사용한다.
  • 맨 앞에 비트부터 ‘1’과 ‘0’이 불연속이 가능한 32bit 체계 마스크
  • 즉, 서브넷 마스크처럼 앞에서부터 ‘1’이 연속되어야 하는 규칙이 없음
  • 장점 : 긴 설정을 짧게 함, 특정 서브넷만 설정 가능함
  • 사용 : EIGRP, OSPF, ACL (라우터에 들어있는 방화벽 (fire wall)) 에도 적용됨


실습> 와일드카드 마스크

서브넷마스크: 255.255.255.0


200.200.200.0
255.255.255.0

서브넷 마스크를 0을 1로 1을 0으로 변경하면 와일드카드 마스크 된다.

255.255.255.0 : 11111111.11111111.11111111.00000000
0.0.0.255 : 00000000.00000000.00000000.11111111

255.255.255.128: 11111111.11111111.11111111.10000000
0.0.0.127 : 00000000.00000000.00000000.01111111

👀 서브넷 계산기 참고
https://www.subnet-calculator.com/


실습> OSPF 네트워크 설정하기

  1. PC 설정
    PC1
    IP Address: 1.1.1.2
    Subnet Mask: 255.255.255.0
    Default Gateway: 1.1.1.253

PC2
IP Address: 3.3.3.2
Subnet Mask: 255.255.255.0
Default Gateway: 3.3.3.253

PC3
IP Address: 5.5.5.2
Subnet Mask: 255.255.255.0
Default Gateway: 5.5.5.253

  1. 라우터 설정
    !R1
    en
    conf t
    hostname R1
    no ip domain-lookup
    int f0/0
    ip add 1.1.1.253 255.255.255.0
    no sh
    int s0/0/0
    ip add 2.2.2.1 255.255.255.0
    no sh
    do sh ip int b
    !

!R2
en
conf t
hostname R2
no ip domain-lookup
int f0/0
ip add 3.3.3.253 255.255.255.0
no sh
int s0/0/0
ip add 2.2.2.2 255.255.255.0
no sh
int s0/0/1
ip add 4.4.4.1 255.255.255.0
no sh
do sh ip int b
!

!R3
en
conf t
int f0/0
ip add 5.5.5.253 255.255.255.0
no sh
int s0/0/0
ip add 4.4.4.2 255.255.255.0
no sh
do sh ip int b
!

  1. OSPF 라우팅 설정
    router ospf [Process-ID]: 동적 라우팅 프로토콜 OSPF 설정
    router-id [IP address format] : 라우터 아이디 (라우터 이름이라고 생각하자) (생략 가능)
    network [Network address][wildcard mask] area [area number]: 광고할 네트워크 정보
    passive-interface: (Option) 불필요한 interface로 광고하지 않도록 설정

!R1
conf t
router ospf 1
router-id 1.1.1.1
network 1.1.1.0 0.0.0.255 area 0
network 2.2.2.0 0.0.0.255 area 0
passive-interface fa0/0
end
!

!R2
conf t
router ospf 1
router-id 2.2.2.2
network 2.2.2.0 0.0.0.255 area 0
network 3.3.3.0 0.0.0.255 area 0
network 4.4.4.0 0.0.0.255 area 0
passive-interface fa0/0
end
!

!R3
conf t
router ospf 1
router-id 3.3.3.3
network 4.4.4.0 0.0.0.255 area 0
network 5.5.5.0 0.0.0.255 area 0
passive-interface fa0/0
end
!

  1. 라우팅 테이블 확인
    네트워크가 총 5개가 나오면 성공이다.
    R1#sh 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, FastEthernet0/0
L 1.1.1.253/32 is directly connected, FastEthernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Serial0/0/0
L 2.2.2.1/32 is directly connected, Serial0/0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0/24 [110/65] via 2.2.2.2, 00:00:49, Serial0/0/0
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0/24 [110/128] via 2.2.2.2, 00:00:49, Serial0/0/0
5.0.0.0/24 is subnetted, 1 subnets
O 5.5.5.0/24 [110/129] via 2.2.2.2, 00:00:07, Serial0/0/0

R2#sh 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 2.2.2.1, 00:03:07, Serial0/0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Serial0/0/0
L 2.2.2.2/32 is directly connected, Serial0/0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, FastEthernet0/0
L 3.3.3.253/32 is directly connected, FastEthernet0/0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Serial0/0/1
L 4.4.4.1/32 is directly connected, Serial0/0/1
5.0.0.0/24 is subnetted, 1 subnets
O 5.5.5.0/24 [110/65] via 4.4.4.2, 00:02:30, Serial0/0/1

R3#sh 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/129] via 4.4.4.1, 00:02:54, Serial0/0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0/24 [110/128] via 4.4.4.1, 00:02:54, Serial0/0/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0/24 [110/65] via 4.4.4.1, 00:02:54, Serial0/0/0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Serial0/0/0
L 4.4.4.2/32 is directly connected, Serial0/0/0
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, FastEthernet0/0
L 5.5.5.253/32 is directly connected, FastEthernet0/0

  1. OSPF 확인
    R1#sh ip ospf ?
    <1-65535> Process ID number
    border-routers Border and Boundary Router Information
    database Database summary
    interface Interface information
    neighbor Neighbor list
    virtual-links Virtual link information

R1#sh ip ospf
Routing Process "ospf 1" with ID 1.1.1.1
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm executed 3 times
Area ranges are
Number of LSA 3. Checksum Sum 0x028e30
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

R1#sh ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:32 2.2.2.2 Serial0/0/0

R2#sh ip ospf
Routing Process "ospf 1" with ID 2.2.2.2
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 3
Area has no authentication
SPF algorithm executed 2 times
Area ranges are
Number of LSA 3. Checksum Sum 0x028e30
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#
R2#sh ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 0 FULL/ - 00:00:36 2.2.2.1 Serial0/0/0
3.3.3.3 0 FULL/ - 00:00:36 4.4.4.2 Serial0/0/1

R3#sh ip ospf
Routing Process "ospf 1" with ID 3.3.3.3
Supports only single TOS(TOS0) routes
Supports opaque LSA
SPF schedule delay 5 secs, Hold time between two SPFs 10 secs
Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs
Number of external LSA 0. Checksum Sum 0x000000
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm executed 2 times
Area ranges are
Number of LSA 3. Checksum Sum 0x028e30
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

R3#sh ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:35 4.4.4.1 Serial0/0/0

  1. 통신 확인
    PC1>ping 2.2.2.2
    PC1>ping 4.4.4.2
    PC1>ping 3.3.3.2
    PC1>ping 5.5.5.2

  2. 라우터 전체 설정
    !R1
    en
    conf t
    hostname R1
    no ip domain-lookup
    int f0/0
    ip add 1.1.1.253 255.255.255.0
    no sh
    int s0/0/0
    ip add 2.2.2.1 255.255.255.0
    no sh
    do sh ip int b
    router ospf 1
    router-id 1.1.1.1
    network 1.1.1.0 0.0.0.255 area 0
    network 2.2.2.0 0.0.0.255 area 0
    passive-interface fa0/0
    end
    !

!R2
en
conf t
hostname R2
no ip domain-lookup
int f0/0
ip add 3.3.3.253 255.255.255.0
no sh
int s0/0/0
ip add 2.2.2.2 255.255.255.0
no sh
int s0/0/1
ip add 4.4.4.1 255.255.255.0
no sh
do sh ip int b
router ospf 1
router-id 2.2.2.2
network 2.2.2.0 0.0.0.255 area 0
network 3.3.3.0 0.0.0.255 area 0
network 4.4.4.0 0.0.0.255 area 0
passive-interface fa0/0
end
!

!R3
en
conf t
int f0/0
ip add 5.5.5.253 255.255.255.0
no sh
int s0/0/0
ip add 4.4.4.2 255.255.255.0
no sh
do sh ip int b
router ospf 1
router-id 3.3.3.3
network 4.4.4.0 0.0.0.255 area 0
network 5.5.5.0 0.0.0.255 area 0
passive-interface fa0/0
end
!

미션> OSPF 네트워크 설정하기 2

미션> OSPF 네트워크 설정하기 3

라우팅: OSPF (동적라우팅 프로토콜) + 서브네팅

  1. 서브네팅
    192.168.3.0/24, 192.168.4.0/24 네트워크를 서브네팅으로 분할한다.

서브넷팅을 하지 않은 경우
C class: 192.168.3.0
C class Subnet Mask: 255.255.255.0

192.168.3.00000000 0
192.168.3.11111111 255

서브네팅을 한 경우
192.168.3.0 0000000 0
192.168.3.1 0000000 128

#3_1/25 에 부여한다.
첫 번째 네트워크: 192.168.3.0/25
Subnet Mask: 255.255.255.128
네트워크 ID: 192.168.3.0 <-- 실장비에 부여할 수 없는 IP주소
브로드캐스트 주소: 192.168.3.127 <-- 실장비에 부여할 수 없는 IP주소
가용 IP주소 범위: 192.168.3.1 ~ 126 <-- 실장비에 부여할 수 있는 IP주소
가용 IP주소 개수: 126개
192.168.3.0 0000000 0
192.168.3.0 1111111 127

#3_2/25 에 부여한다.
두 번째 네트워크: 192.168.3.128/25
Subnet Mask: 255.255.255.128
네트워크 ID: 192.168.3.128 <-- 실장비에 부여할 수 없는 IP주소
브로드캐스트 주소: 192.168.3.255 <-- 실장비에 부여할 수 없는 IP주소
가용 IP주소 범위: 192.168.3.129 ~ 254 <-- 실장비에 부여할 수 있는 IP주소
가용 IP주소 개수: 126개
192.168.3.1 0000000 128
192.168.3.1 1111111 255

서브넷팅을 하지 않은 경우
C class: 192.168.4.0
C class Subnet Mask: 255.255.255.0

192.168.4.00000000 0
192.168.4.11111111 255

서브네팅을 한 경우
192.168.4.00 000000 0
192.168.4.01 000000 64
192.168.4.10 000000 128
192.168.4.11 000000 192 미사용

#4_1/26
첫 번째 네트워크: 192.168.4.0/26
Subnet Mask: 255.255.255.192
네트워크 ID: 192.168.4.0 <-- 실장비에 부여할 수 없는 IP주소
브로드캐스트 주소: 192.168.4.63 <-- 실장비에 부여할 수 없는 IP주소
가용 IP주소 범위: 192.168.4.1 ~ 62 <-- 실장비에 부여할 수 있는 IP주소
가용 IP주소 개수: 62개
192.168.4.00 000000 0
192.168.4.00 111111 63

#4_2/26
두 번째 네트워크: 192.168.4.64/26
Subnet Mask: 255.255.255.192
네트워크 ID: 192.168.4.64 <-- 실장비에 부여할 수 없는 IP주소
브로드캐스트 주소: 192.168.4.127 <-- 실장비에 부여할 수 없는 IP주소
가용 IP주소 범위: 192.168.4.65 ~ 126 <-- 실장비에 부여할 수 있는 IP주소
가용 IP주소 개수: 62개
192.168.4.01 000000 64
192.168.4.01 111111 127

#4_3/26
세 번째 네트워크: 192.168.4.128/26
Subnet Mask: 255.255.255.192
네트워크 ID: 192.168.4.128 <-- 실장비에 부여할 수 없는 IP주소
브로드캐스트 주소: 192.168.4.191 <-- 실장비에 부여할 수 없는 IP주소
가용 IP주소 범위: 192.168.4.129 ~ 190 <-- 실장비에 부여할 수 있는 IP주소
가용 IP주소 개수: 62개
192.168.4.10 000000 128
192.168.4.10 111111 191

네 번째 네트워크 (미사용)
192.168.4.11 000000 192
192.168.4.11 111111 255

  1. PC 설정
    PC1
    IP Address: 192.168.3.129
    Subnet Mask: 255.255.255.128
    Default Gateway: 192.168.3.254

PC2
IP Address: 192.168.3.1
Subnet Mask: 255.255.255.128
Default Gateway: 192.168.3.126

PC3
IP Address: 192.168.4.1
Subnet Mask: 255.255.255.192
Default Gateway: 192.168.4.62

  1. 라우터 설정

!R1
en
conf t
hostname R1
no ip domain-lookup
int f0/0
ip add 192.168.3.254 255.255.255.128
no sh
int s0/0/0
ip add 192.168.4.65 255.255.255.192
no sh
!

!R2
en
conf t
hostname R2
no ip domain-lookup
int f0/0
ip add 192.168.3.126 255.255.255.128
no sh
int s0/0/0
ip add 192.168.4.66 255.255.255.192
no sh
int s0/0/1
ip add 192.168.4.129 255.255.255.192
no sh
!

!R3
en
conf t
hostname R3
no ip domain-lookup
int f0/0
ip add 192.168.4.62 255.255.255.192
no sh
int s0/0/0
ip add 192.168.4.130 255.255.255.192
no sh
!

  1. 라우팅 설정
    !R1
    en
    conf t
    router ospf 1
    network 192.168.3.128 0.0.0.127 area 0
    network 192.168.4.64 0.0.0.63 area 0
    passive-interface f0/0
    !

!R2
en
conf t
route ospf 1
network 192.168.3.0 0.0.0.127 area 0
network 192.168.4.64 0.0.0.63 area 0
network 192.168.4.128 0.0.0.63 area 0
passive-interface f0/0
!

!R3
en
conf t
route ospf 1
network 192.168.4.128 0.0.0.63 area 0
network 192.168.4.0 0.0.0.63 area 0
passive-interface f0/0
!

라우터 전체 설정
!R1
en
conf t
hostname R1
no ip domain-lookup
int f0/0
ip add 192.168.3.254 255.255.255.128
no sh
int s0/0/0
ip add 192.168.4.65 255.255.255.192
no sh
router ospf 1
network 192.168.3.128 0.0.0.127 area 0
network 192.168.4.64 0.0.0.63 area 0
passive-interface f0/0
end
wr
sh ip int b
sh ip ospf
sh ip ospf neighbor
!

!R2
en
conf t
hostname R2
no ip domain-lookup
int f0/0
ip add 192.168.3.126 255.255.255.128
no sh
int s0/0/0
ip add 192.168.4.66 255.255.255.192
no sh
int s0/0/1
ip add 192.168.4.129 255.255.255.192
no sh
route ospf 1
network 192.168.3.0 0.0.0.127 area 0
network 192.168.4.64 0.0.0.63 area 0
network 192.168.4.128 0.0.0.63 area 0
passive-interface f0/0
end
wr
sh ip int b
sh ip ospf
sh ip ospf neighbor
!

!R3
en
conf t
hostname R3
no ip domain-lookup
int f0/0
ip add 192.168.4.62 255.255.255.192
no sh
int s0/0/0
ip add 192.168.4.130 255.255.255.192
no sh
route ospf 1
network 192.168.4.128 0.0.0.63 area 0
network 192.168.4.0 0.0.0.63 area 0
passive-interface f0/0
en
wr
sh ip int b
sh ip ospf
sh ip neighbor
!

  1. 라우팅 테이블 확인
    R1#sh 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 192.168.3.0/24 is variably subnetted, 3 subnets, 2 masks
O 192.168.3.0/25 [110/65] via 192.168.4.66, 00:02:30, Serial0/0/0
C 192.168.3.128/25 is directly connected, FastEthernet0/0
L 192.168.3.254/32 is directly connected, FastEthernet0/0
192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.4.64/26 is directly connected, Serial0/0/0
L 192.168.4.65/32 is directly connected, Serial0/0/0

R1#sh 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 192.168.3.0/24 is variably subnetted, 3 subnets, 2 masks
O 192.168.3.0/25 [110/65] via 192.168.4.66, 00:06:57, Serial0/0/0
C 192.168.3.128/25 is directly connected, FastEthernet0/0
L 192.168.3.254/32 is directly connected, FastEthernet0/0
192.168.4.0/24 is variably subnetted, 4 subnets, 2 masks
O 192.168.4.0/26 [110/129] via 192.168.4.66, 00:00:20, Serial0/0/0
C 192.168.4.64/26 is directly connected, Serial0/0/0
L 192.168.4.65/32 is directly connected, Serial0/0/0
O 192.168.4.128/26 [110/128] via 192.168.4.66, 00:00:35, Serial0/0/0

R2#sh 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

 192.168.3.0/24 is variably subnetted, 3 subnets, 2 masks

C 192.168.3.0/25 is directly connected, FastEthernet0/0
L 192.168.3.126/32 is directly connected, FastEthernet0/0
O 192.168.3.128/25 [110/65] via 192.168.4.65, 00:07:35, Serial0/0/0
192.168.4.0/24 is variably subnetted, 5 subnets, 2 masks
O 192.168.4.0/26 [110/65] via 192.168.4.130, 00:01:03, Serial0/0/1
C 192.168.4.64/26 is directly connected, Serial0/0/0
L 192.168.4.66/32 is directly connected, Serial0/0/0
C 192.168.4.128/26 is directly connected, Serial0/0/1
L 192.168.4.129/32 is directly connected, Serial0/0/1

R3#sh 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 192.168.3.0/25 is subnetted, 2 subnets
O 192.168.3.0/25 [110/65] via 192.168.4.129, 00:01:31, Serial0/0/0
O 192.168.3.128/25 [110/129] via 192.168.4.129, 00:01:31, Serial0/0/0
192.168.4.0/24 is variably subnetted, 5 subnets, 2 masks
C 192.168.4.0/26 is directly connected, FastEthernet0/0
L 192.168.4.62/32 is directly connected, FastEthernet0/0
O 192.168.4.64/26 [110/128] via 192.168.4.129, 00:01:31, Serial0/0/0
C 192.168.4.128/26 is directly connected, Serial0/0/0
L 192.168.4.130/32 is directly connected, Serial0/0/0

  1. 통신 확인
    PC1에서 ping test 를 해서 통신이 잘 되는지 확인한다.
    ping 192.168.4.66
    ping 192.168.4.129
    ping 192.168.4.62
    ping 192.168.3.1
    ping 192.168.4.1

실습> 루프백 주소 설정하기

루프백 인터페이스 ???

루프백 인터페이스(loopback interface)란 라우터나 스위치에 설정하는 가상의 인터페이스. 루프백 인터페이스를 사용하는 이유는 여러가지가 있음. 예를 들어, 실제 네트워크에서는 각 라우터의 이더넷 인터페이스와 스위치를 연결한 후에 PC나 서버 등을 접속한다.
그러나, 라우팅 연습시에는 테스트할 때 마다 라우터의 이더넷 인터페이스와 이더넷 스위치를 연결하려면 귀찮다. 이 경우, 각 라우터에서 이더넷과 같은 물리적인 인터페이스를 사용하는 대신 가상의 인터페이스인 루프백 인터페이스를 만들고, 여기에 할당된 네트워크간에 라우팅을 구현하면 라우팅 연습이 편리하다.

루프백 인터페이스를 사용하면 원하는 만큼 네트워크를 만들 수 있어, 다수개의 네트워크에 대한 라우팅을 구현하는 환경도 쉽게 구성할 수 있다. 루프백 인터페이스는 논리적인 구성이라 튼튼하다.

즉, 장애로 인하여 다운될 수 있는 이더넷, 시리얼 등과 같은 물리적인 인터페이스에 비하여 루프백 인터페이스는 네트워크 관리자가 다운시키거나 라우터가 다운되지 않는 한 동작한다.

루프백 인터페이스는 동적인 라우팅 프로토콜인 OSPF, BGP 등에서 라우터 ID로 사용된다. 루프백 인터페이스는 interface loopback 명령어를 사용하여 만드는 순간 자동으로 활성화된다. 따라서, 별도로 no shutdown 명령어를 사용할 필요가 없다.
루프백 인터페이스를 제거하려면 no interface loopback 명령어를 사용하면 된다.


1. 라우터 설정
!R1
en
conf t
hostname R1
int f0/0
ip add 192.168.0.1 255.255.255.0
no sh
int lo0
ip add 192.168.1.1 255.255.255.0
int lo1
ip add 192.168.2.1 255.255.255.0
!
router ospf 1
network 192.168.0.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
network 192.168.2.0 0.0.0.255 area 0
!
end
sh ip route
sh ip ospf
sh ip ospf neighbor
!

!R2
en
conf t
 hostname R2
 int f0/0
 ip add 192.168.0.2 255.255.255.0
 no sh
 int lo0
 ip add 192.168.3.1 255.255.255.0
 int lo1
 ip add 192.168.4.1 255.255.255.0
 int f0/1
 ip add 192.168.5.1 255.255.255.0
 no sh
!
 router ospf 1
 network 192.168.0.0 0.0.0.255 area 0
 network 192.168.3.0 0.0.0.255 area 0
 network 192.168.4.0 0.0.0.255 area 0
 network 192.168.5.0 0.0.0.255 area 0
!
 end
sh ip route
sh ip ospf
sh ip ospf neighbor
!

!R3
en
conf t
hostname R3
int f0/0
ip add 192.168.5.2 255.255.255.0
no sh
int lo0
ip add 192.168.6.1 255.255.255.0
int lo1
ip add 192.168.7.1 255.255.255.0
!
router ospf 1
network 192.168.5.0 0.0.0.255 area 0
network 192.168.6.0 0.0.0.255 area 0
network 192.168.7.0 0.0.0.255 area 0
!
end
sh ip route
sh ip ospf
sh ip ospf neighbor
!

  1. 라우팅 테이블 확인
    sh ip route 명령어를 실행했을 때 총 네트워크 8개가 나와야 한다.
    R1#sh 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 192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, FastEthernet0/0
L 192.168.0.1/32 is directly connected, FastEthernet0/0
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, Loopback0
L 192.168.1.1/32 is directly connected, Loopback0
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/24 is directly connected, Loopback1
L 192.168.2.1/32 is directly connected, Loopback1
192.168.3.0/32 is subnetted, 1 subnets
O 192.168.3.1/32 [110/2] via 192.168.0.2, 00:05:31, FastEthernet0/0
192.168.4.0/32 is subnetted, 1 subnets
O 192.168.4.1/32 [110/2] via 192.168.0.2, 00:05:31, FastEthernet0/0
O 192.168.5.0/24 [110/2] via 192.168.0.2, 00:04:34, FastEthernet0/0
192.168.6.0/32 is subnetted, 1 subnets
O 192.168.6.1/32 [110/3] via 192.168.0.2, 00:04:34, FastEthernet0/0
192.168.7.0/32 is subnetted, 1 subnets
O 192.168.7.1/32 [110/3] via 192.168.0.2, 00:04:34, FastEthernet0/0

R2#sh 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 192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, FastEthernet0/0
L 192.168.0.2/32 is directly connected, FastEthernet0/0
192.168.1.0/32 is subnetted, 1 subnets
O 192.168.1.1/32 [110/2] via 192.168.0.1, 00:05:56, FastEthernet0/0
192.168.2.0/32 is subnetted, 1 subnets
O 192.168.2.1/32 [110/2] via 192.168.0.1, 00:05:56, FastEthernet0/0
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/24 is directly connected, Loopback0
L 192.168.3.1/32 is directly connected, Loopback0
192.168.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.4.0/24 is directly connected, Loopback1
L 192.168.4.1/32 is directly connected, Loopback1
192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.5.0/24 is directly connected, FastEthernet0/1
L 192.168.5.1/32 is directly connected, FastEthernet0/1
192.168.6.0/32 is subnetted, 1 subnets
O 192.168.6.1/32 [110/2] via 192.168.5.2, 00:05:05, FastEthernet0/1
192.168.7.0/32 is subnetted, 1 subnets
O 192.168.7.1/32 [110/2] via 192.168.5.2, 00:05:05, FastEthernet0/1

R3#sh 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

O 192.168.0.0/24 [110/2] via 192.168.5.1, 00:03:53, FastEthernet0/0
192.168.1.0/32 is subnetted, 1 subnets
O 192.168.1.1/32 [110/3] via 192.168.5.1, 00:03:53, FastEthernet0/0
192.168.2.0/32 is subnetted, 1 subnets
O 192.168.2.1/32 [110/3] via 192.168.5.1, 00:03:53, FastEthernet0/0
192.168.3.0/32 is subnetted, 1 subnets
O 192.168.3.1/32 [110/2] via 192.168.5.1, 00:03:53, FastEthernet0/0
192.168.4.0/32 is subnetted, 1 subnets
O 192.168.4.1/32 [110/2] via 192.168.5.1, 00:03:53, FastEthernet0/0
192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.5.0/24 is directly connected, FastEthernet0/0
L 192.168.5.2/32 is directly connected, FastEthernet0/0
192.168.6.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.6.0/24 is directly connected, Loopback0
L 192.168.6.1/32 is directly connected, Loopback0
192.168.7.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.7.0/24 is directly connected, Loopback1
L 192.168.7.1/32 is directly connected, Loopback1

  1. 통신 확인
    R1에서 ping test를 실시한다.

R3#debug ip icmp
R1#ping 192.168.6.1

R3#debug ip icmp
ICMP packet debugging is on
R3#
ICMP: echo reply sent, src 192.168.6.1, dst 192.168.0.1

ICMP: echo reply sent, src 192.168.6.1, dst 192.168.0.1

ICMP: echo reply sent, src 192.168.6.1, dst 192.168.0.1

ICMP: echo reply sent, src 192.168.6.1, dst 192.168.0.1

ICMP: echo reply sent, src 192.168.6.1, dst 192.168.0.1

패킷 트레이서에서는 안되지만 GNS3에서 실행한다.
출발지 IP주소를 변경하는 형식: ping <목적지IP주소> source <출발지IP주소>
만약 출발지 IP주소는 라우터에 설정한 IP주소만 설정할 수 있다.

R1# ping 192.168.6.1 <-- src: 192.168.0.1
R1# ping 192.168.6.1 source 192.168.1.1 <-- src: 192.168.1.1
R1# ping 192.168.6.1 source 192.168.2.1 <-- src: 192.168.2.1


profile
정보보안 전문가

0개의 댓글