Network/GNS
[GNS] 후니책 마지막 Router 문제 및 실습
쓱은감자
2022. 5. 27. 22:29
Router 실습
후니의 쉽게 쓴 CISCO 네트워킹 Vol.2 309p
예제 구성
- 특별한 지시가 없는 한 150.100.0.0/24 주소를 사용해서 설정
- 특별한 지시가 없는 한 모든 라우터의 인터페이스에 핑이 가능해야 한다.
- 특별한 지시가 없는 한 스태틱 라우트(ip route ~) 명령을 사용하지 않는다.
ip ospf network point-to-multipoint
와ip ospf network point-to-point
명령은 사용하지 않는다.- R1은 2개의 서브 인터페이스를 사용해서 구성하고, R2는 하나의 point-to-point 서브 인터페이스를 사용하며, R3와 R4는 서브 인터페이스를 사용하지 않는다.
- R1은 DLCI 번호 102, 103, 104를 사용하고, R2는 DLCI 201번을, R3는 DLCI 301번을, 그리고 R4는 DLCI 401번을 로컬 DLCI로 사용한다.
IP 주소 배정표
R1 | R2 | R3 | R4 | R5 | |
---|---|---|---|---|---|
S2/0.1 | 150.100.1.1/24 | 150.100.1.2/24 | |||
S2/0.2 | 150.100.5.1/24 | ||||
E0 | 150.100.28.9/30 | 150.100.17.1/24 | |||
L0 | 150.100.28.1/30 | 160.100.1.1/24 | 150.100.64.1/24 | ||
L1 | 150.100.28.5/30 | 165.100.1.1/24 | 150.100.65.1/24 | ||
L2 | 150.100.32.1/28 | 150.100.20.1/24 | 150.100.66.1/24 | ||
L3 | 150.100.32.17/28 | 150.100.21.1/24 | |||
L4 | 150.100.36.1/26 | 150.100.22.1/24 | |||
L5 | 150.100.36.65/26 | ||||
S2/0 | 150.100.1.3/24 | 150.100.5.2/24 | 150.100.9.2/24 | ||
S2/1 | 150.100.9.1/24 |
환경 구성
프레임 릴레이 구성
FR-SW(conf)# frame-relay switching
# 2/0 interface 구성
FR-SW(conf)# inter serial 2/0
FR-SW(conf-if)# no shutdown
FR-SW(conf-if)# encapsulation frame-relay
FR-SW(conf-if)# clock rate threshold 56000
FR-SW(conf-if)# frame-relay lmi-type ansi
FR-SW(conf-if)# frame-relay intf-type dce
FR-SW(conf-if)# frame-relay route 102 interface Serial2/1 201
FR-SW(conf-if)# frame-relay route 103 interface Serial2/2 301
FR-SW(conf-if)# frame-relay route 104 interface Serial2/3 401
# 2/1 interface 구성
FR-SW(conf)# inter serial 2/1
FR-SW(conf-if)# no shutdown
FR-SW(conf-if)# encapsulation frame-relay
FR-SW(conf-if)# clock rate threshold 56000
FR-SW(conf-if)# frame-relay lmi-type ansi
FR-SW(conf-if)# frame-relay intf-type dce
FR-SW(conf-if)# frame-relay route 201 interface Serial2/0 102
# 2/2 interface 구성
FR-SW(conf)# inter serial 2/2
FR-SW(conf-if)# no shutdown
FR-SW(conf-if)# encapsulation frame-relay
FR-SW(conf-if)# clock rate threshold 56000
FR-SW(conf-if)# frame-relay lmi-type ansi
FR-SW(conf-if)# frame-relay intf-type dce
FR-SW(conf-if)# frame-relay route 301 interface Serial2/0 103
# 2/3 interface 구성
FR-SW(conf)# inter serial 2/3
FR-SW(conf-if)# no shutdown
FR-SW(conf-if)# encapsulation frame-relay
FR-SW(conf-if)# clock rate threshold 56000
FR-SW(conf-if)# frame-relay lmi-type ansi
FR-SW(conf-if)# frame-relay intf-type dce
FR-SW(conf-if)# frame-relay route 401 interface Serial2/0 104
R1 구성
R1(conf)# interface serial 2/0
R1(conf-if)# no shutdown
R1(conf-if)# no ip directed-broadcast
R1(conf-if)# encapsulation frame-relay
R1(conf-if)# frame-relay lmi-type ansi
R1(conf)# interface serial 2/0.1 multipoint
R1(conf-subif)# no shutdown
R1(conf-subif)# ip address 150.100.1.1 255.255.255.0
R1(conf-subif)# frame-relay map ip 150.100.1.2 102 broadcast
R1(conf-subif)# frame-relay map ip 150.100.1.3 103 broadcast
R1(conf)# interface serial 2/0.2 point-to-point
R1(conf-subif)# no shutdown
R1(conf-subif)# ip address 150.100.5.1 255.255.255.0
R1(conf-subif)# frame-relay interface-dlci 104
R2 구성
R2(conf)# inter serial 2/0
R2(conf-if)# no shutdown
R2(conf-if)# encapsulation frame-relay
R2(conf-if)# frame-relay lmi-type ansi
R2(conf)# inter serial 2/0.1 point-to-point
R2(conf-subif)# no shutdown
R2(conf-subif)# ip address 150.100.1.2 255.255.255.0
R2(conf-subif)# frame-relay interface-dlci 201
R3 구성
R3(conf)# inter serial 2/0
R3(conf-if)# no shutdown
R3(conf-if)# ip address 150.100.1.3 255.255.255.0
R3(conf-if)# encapsulation frame-relay
R3(conf-if)# frame-relay lmi-type ansi
R3(conf-if)# frame-relay map ip 150.100.1.1 301 broadcast
R3(conf-if)# frame-relay map ip 150.100.1.2 301 broadcast
R4 구성
R4(conf)# inter serial 2/0
R4(conf-if)# no shutdown
R4(conf-if)# ip address 150.100.5.2 255.255.255.0
R4(conf-if)# encapsulation frame-relay
R4(conf-if)# no ip mroute-cache
R4(conf-if)# no fair-queue
R4(conf-if)# frame-relay lmi-type ansi
R4(conf-if)# frame-relay map ip 150.100.5.1 401 broadcast
구성 확인
show frame-relay map
문제 1
- 서브넷
150.100.1.0/24
를 사용해서 R1, R2, R3 간을OSPF area 0
으로 구성해라. R1, R2, R3 간에는 서로 핑이 가능해야 한다.- 현재 R1, R2, R3의 인터페이스 타입이 서로 다르기 때문에 Neighbor를 맺지 못해서 통신이 불가능
- R1, R3 - multipoint
- R2 - point-to-point
- 인터페이스 타입
- 서브 인터페이스가 multipoint로 구성되어 있으면 : Non broadcast
- 서브 인터페이스가 point-to-point로 구성되어 있으면 : point-to-point
- 피지컬 인터페이스가 point-to-point로 구성되어 있으면 : Non broadcast
- OSPF 인터페이스를 맞춰주는 명령어
ip ospf network point-to-multipoint
- 이 방식은 DR election이 없는 방식
ip ospf network point-to-point
- 이 방식도 DR election이 없는 방식
ip ospf network nonbroadcast
- 이 방식을 사용할 경우에는 R2에만 입력해 주면 된다. R1, R3는 이미 nonbroadcast이기 때문
- DR 라우터에서 Neighbor 설정 방법
router ospf 100
neighbor 150.100.1.2
neighbor 150.100.1.3
ip ospf network broadcast
- 해당 방식을 사용하면 R1이 DR이 되도록 해줘야 한다. HUB and spoke 구조에서는 항상 hub 라우터가 DR이 되어야 한다는 규칙이 있다. 따라서 나머지 라우터는 절대 DR이 되지 않도록 R2와 R3에서 priority를 0으로 지정해 주어야 한다.
R1 구성
R1(conf)# inter serial 2/0.1
R1(conf-subif)# ip ospf network broadcast
// DR이 되도록 따로 priority 값 수정하지 않음
R1(conf)# router ospf 100
R1(conf-router)# network 150.100.1.0 0.0.0.255 area 0
R2 구성
R2(conf)# inter serial 2/0.1
R2(conf-if)# ip ospf network broadcast
R2(conf-if)# ip ospf priority 0 // DR이 되지 않도록 priority 값 0으로 설정
R2(conf)# router ospf 100
R2(conf-router)# network 150.100.1.0 0.0.0.255 area 0
R3 구성
R3(conf)# inter serial 2/0
R3(conf-if)# ip ospf network broadcast
R3(conf-if)# ip ospf priority 0 // DR이 되지 않도록 priority 값 0으로 설정
R3(conf)# router ospf 100
R3(conf-router)# network 150.100.1.0 0.0.0.255 area 0
연결 확인
- R1 -> R2
- R1 -> R3
문제2
- R1과 R4 사이를 RIP로 구성해라.
- R1의 경우 하나의 피지컬 인터페이스를 2개로 나누어서 서브 인터페이스로 사용하고 있는데 그 중 하나는 OSPF 라우팅으로 사용하고 있기 때문에 하나는 라우팅 업데이트를 제외시켜야 한다.
- 라우팅 업데이트를 보내지 않는 명령어
passive interface
R1 구성
R1(conf)# router rip
R1(conf-router)# passive-interface Serial2/0.1
R1(conf-router)# network 150.100.0.0
R4 구성
R4(conf)# inter serial 2/0
R4(conf-if)# ip split-horizon
# split horizon은 한 번 받은 라우팅 정보를 다시 같은 쪽으로 내보내지 않는다는 의미
# frame relay가 enable되면 자동으로 split horizon이 disable
# 이렇게 되면 나중에 OSPF와 RIP 간에 redistribution을 해줄 때 OSPF에서 RIP 쪽으로 redistribute한 정보가 다시 OSPF쪽으로 redistribute되어서 하나의 네트워크에 대해서 2개의 테이블이 보임
# 따라서 ip split-horizon을 enable시켜야 rip가 받은 OSPF 정보를 다시 OSPF 쪽으로 내보내지 않음
# OSPF가 돌고 있는 쪽은 할 필요가 없고 RIP와 IGRP 프로토콜이 돌고 있는 곳에서 해줘야 함
R4(conf)# router rip
R4(conf-if)# network 150.100.0.0
연결 확인
- R1 -> R4
문제 3
- R2에서 30비트 서브넷 마스크를 이용해서 2개의 Loopback과 하나의 이더넷 인터페이스를 만들고 이것을
OSPF area 22
로 구성해라. 또한 R2에 최소한 14개의 호스트 주소를 가질 수 있는 2개의 loopback 인터페이스를 만들어 OSPF area 25에 위치시켜라.- 최소한 14개의 호스트를 가질 수 있으려면 16개의 호스트를 가질 수 있도록 설정
R2 구성
R2(conf)# inter Loopback0
R2(conf-if)# no shutdown
R2(conf-if)# ip address 150.100.28.1 255.255.255.252 // 30bit subnet mask
R2(conf)# inter Loopback1
R2(conf-if)# no shutdown
R2(conf-if)# ip address 150.100.28.5 255.255.255.252 // 30bit subnet mask
R2(conf)# inter eth0/0
R2(conf-if)# no shutdown
R2(conf-if)# ip address 150.100.28.9 255.255.255.252 // 30bit subnet mask
R2(conf)# inter Loopback2
R2(conf-if)# no shutdown
R2(conf-if)# ip address 150.100.32.1 255.255.255.240 // 최소 14개의 호스트를 가지도록 28bit subnet mask
R2(conf)# inter Loopback3
R2(conf-if)# no shutdown
R2(conf-if)# ip address 150.100.32.17 255.255.255.240 // 최소 14개의 호스트를 가지도록 28bit subnet mask
R2(conf)# router ospf 100
// 각 네트워크마다 라우팅되도록 설정
R2(conf-router)# network 150.100.28.0 0.0.0.3 area 22 // wildcard - 00000011
R2(conf-router)# network 150.100.28.4 0.0.0.3 area 22
R2(conf-router)# network 150.100.28.8 0.0.0.3 area 22
R2(conf-router)# network 150.100.32.0 0.0.0.15 area 25 // wildcard - 00001111
R2(conf-router)# network 150.100.32.16 0.0.0.15 area 25
문제 4
- R3과 R5 사이를
OSPF area 54
로 구성하라. 또한 R5의 E0 인터페이스를OSPF area 33
으로 구성해라. R4를 제외한 모든 라우터들이 R5의Ehternet 0
으로 핑이 가능한지 확인해라.- Area 33이 백본 Area, 즉 area 0과 직접 연결되어 있지 않다.
- 모든 area는 백본 area, 즉 OSPF area 0과 연결되어 있어야 한다는 규칙에 어긋나기 때문에 Virtual Link를 이용
- Virtual Link에서 중요한 것은 라우터의 ID
- Virtual Link에서는 상대편 area의 라우터 ID를 사용하기 때문에 처음에
show ip ospf
를 통해 라우터 ID를 보고 구성해도 새로운 인터페이스를 계속 추가하면 라우터 ID가 바뀔 수 있음 - 절대 바뀌지 않을 만한 값을 루프백 인터페이스로 잡아서 구성
- Virtual Link에서는 상대편 area의 라우터 ID를 사용하기 때문에 처음에
R3 구성
R3(conf)# inter Loopback1
R3(conf-if)# ip address 165.100.1.1 255.255.255.0
# 현재 라우터 IP 주소에 비해 가장 높은 IP 주소를 루프백 주소로 잡아줌으로써 이 주소를 라우터 ID로 만들어 줌
R3(conf)# inter serial 2/1
R3(conf-if)# no shutdown
R3(conf-if)# ip address 150.100.9.1 255.255.255.0
R3(conf)# router ospf 100
R3(conf-router)# area 54 virtual-link 150.100.17.1
# area 54는 'transit area', 즉 Area0과 Area 33 사이에 위치한 area이고 뒤에 붙는 '150.100.17.1'은 상대방 라우터의 ID
R3(conf-router)# network 150.100.9.0 0.0.0.255 area 54
R3# clear ip ospf 100 process
# router id를 다시 할당 받기 위해 ospf process 재시작
R5 구성
R5(conf)# inter eth 0/0
R5(conf-if)# no shutdown
R5(conf-if)# ip address 150.100.17.1 255.255.255.0
R5(conf)# inter serial 2/0
R5(conf-if)# no shutdown
R5(conf-if)# ip address 150.100.9.2 255.255.255.0
R5(conf)# router ospf 100
R5(conf-router)# network 150.100.9.0 0.0.0.255 area 54
R5(conf-router)# network 150.100.17.0 0.0.0.255 area 33
R5(conf-router)# area 54 virtual-link 165.100.1.1
R5# clear ip ospf 100 process
# router id를 다시 할당받기 위해 ospf process 재시작
연결 확인
- R1 -> R5(eth0/0)
- R2- > R5(eth0/0)
- R3 -> R5(eth0/0)