Router, Routing...(교육 11일차)

SW·2022년 12월 6일
0




패킷트레이서로 라우터의 모듈과 인터페이스 타입 등을 확인하고 가상으로 장착 및 시연해 볼 수 있다.

라우터를 처음 올리면 Config 내 Interface를 보면 Fastethernet 포트만이 존재하는데, 아래와 같이 WIC나 NM장비를 Slot에 장착하면 해당 Interface가 추가로 장착됨을 확인할 수 있다. (반드시 라우터 전원을 끄고 슬롯에 장비를 추가해야 한다.)





[라우터 연결 작업]
1. 설정을 위한 접속
: 노트북 -> Router Console 포트 연결
2. IP주소 할당
3. PC에서 원격접속

  • Router 네트워트 설정






















명령어의 도움말 출력
라우터 스위치: ?

명령어의 자동 완성
리눅스: 명령어 탭

명령의 도움말 출력
ls --help
man ls

GUI : Graphic User Interface -> 윈도우
TUI : Text User Interface
CLI : Command line interface -> 네트워크, 서버 등

Router>en

show 명령어는 설정들을 보는 명령어로 sh로 줄여서 사용할 수 있다.
Router#s?
send setup show ssh

sh ip int b: 인터페이스의 상태를 확인한다.
Router#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down

bug: 벌레
debug: 벌레잡이
debugging: 벌레잡는 현재 상태를 말한다.

debug:

  • 오류를 잡기 위해서 사용한다.
  • 분석하기 위해서 사용한다.

debug: Router의 패킷이 전송되는 과정들을 분석할 때 사용한다.

  • 주의할 점은 실장비에서는 많은 패킷들이 전송되므로 debug를 사용하면 문제가 될 수 있다.

실습 : 200.200.200.0/24
1. 서브네팅을 해서 네트워크 4개를 생성한다.
2. 라우터 Fa0/0 인터페이스에 세 번째 네트워크의 첫 번째 가용IP주소를 설정한다.

  • 200.200.200.129/26 255.255.255.192
  1. PC에 세 번째 네트워크의 두 번째 가용IP주소를 설정한다.
  2. 네트워크 설정 후 ping으로 통신을 확인한다.
  3. 연결된 console을 제거한다.

200.200.200.00000000
255.255.255.00 000000

Subnet Mask: 255.255.255.192

#1
255.255.255.00 000000 0 ~
255.255.255.00 111111 63

#2
255.255.255.01 000000 64 ~
255.255.255.01 111111 127

#3
255.255.255.10 000000 128 ~
255.255.255.10 111111 191

#4
255.255.255.11 000000 192 ~
255.255.255.11 111111 255

!R1
en
conf t
int f0/0
ip add 200.200.200.129 255.255.255.192
no sh
end
sh ip int b

Router#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 200.200.200.129 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down

설정 저장 여부 확인
Router#reload
System configuration has been modified. Save? [yes/no]:no
Proceed with reload? [confirm]

:
:

--- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]: no

Press RETURN to get started!

Router>en
Router#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES NVRAM administratively down down
FastEthernet0/1 unassigned YES NVRAM administratively down down
Vlan1 unassigned YES NVRAM administratively down down

부팅 후에 다시 설정한다.
!R1
en
conf t
int f0/0
ip add 200.200.200.129 255.255.255.192
no sh
end
sh ip int b
copy run start <-- RAM -> NVRAM으로 저장한다.
wr <-- 저장

Router#reload
Proceed with reload? [confirm]

:
:(부팅 중)

Router>en
Router#sh ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 200.200.200.129 YES NVRAM up up
FastEthernet0/1 unassigned YES NVRAM administratively down down
Vlan1 unassigned YES NVRAM administratively down down

실습> RAM -> NVRAM에 저장하기

NVRAM: startup-config
RAM: running-config

RAM: 휘발성
NVRAM: 비휘발성
설정에 대한 내용은 모두 running-config에 저장되어 있다.

  1. NVRAM에 저장하지 않은 경우
    라우터를 부팅한 후 호스트명을 변경한다.
    Router>en
    Router#conf t
    Router(config)#hostname R1
    R1(config)#end
    R1#reload
    System configuration has been modified. Save? [yes/no]:no <-- no
    Proceed with reload? [confirm] <-- 엔터
    System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1)
    Copyright (c) 2000 by cisco Systems, Inc.
    Initializing memory for ECC
    ..
    C2800 processor with 524288 Kbytes of main memory
    Main memory is configured to 64 bit mode with ECC enabled

Readonly ROMMON initialized

program load complete, entry point: 0x8000f000, size: 0xc940
program load complete, entry point: 0x8000f000, size: 0xc940

program load complete, entry point: 0x8000f000, size: 0x3ed1338
Self decompressing the image :
########################################################################## [OK]
Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

       cisco Systems, Inc.
       170 West Tasman Drive
       San Jose, California 95134-1706

Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 06:21 by pt_rel_team
Image text-base: 0x400A925C, data-base: 0x4372CE20

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.
cisco 2811 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory
Processor board ID JAD05190MTZ (4292891495)
M860 processor: part number 0, mask 49
2 FastEthernet/IEEE 802.3 interface(s)
239K bytes of non-volatile configuration memory.
62720K bytes of ATA CompactFlash (Read/Write)
Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 18-Jul-07 06:21 by pt_rel_team

     --- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]: no

Press RETURN to get started!

Router> <-- 설정된 값이 저장되지 않아서 프롬프트가 Router> 로 보인다.

2. NVRAM에 저장하는 경우

Router>en
Router#conf t
Router(config)#hostname R1
R1(config)#end
R1#
R1#copy running-config startup-config <-- copy run start 줄여서 사용 가능
R1#reload

:(생략)
R1> <-- R1으로 호스트명이 변경된 것을 확인할 수 있다.

write 명령어로 저장하기

R1>en
R1#conf t
R1(config)#hostname Router1
Router1(config)#end
Router1#write <-- wr 로 줄여쓸 수 있다.
Router1#reload
:
:(생략)
Router1>

실습> debug 테스트

참고로 debug는 실장비에서는 사용할 때 주의해야 한다.

debug에서 지원하는 전체 명령어 확인 (패킷 트레이서는 모두 지원하지 않음)
debug ?

debug 명령어는 설정모드에서 하면 아래처럼 에러가 발생된다.
R1(config)#debug ip icmp
^
% Invalid input detected at '^' marker.

debug on/off 사용 방법

R1#debug ip icmp
ICMP packet debugging is on
R1#undebug ip icmp
ICMP packet debugging is off
R1#debug ip icmp
ICMP packet debugging is on
R1#undebug all
All possible debugging has been turned off

R1#debug ip icmp
ICMP packet debugging is on

C:>ping 200.200.200.129

Pinging 200.200.200.129 with 32 bytes of data:

Reply from 200.200.200.129: bytes=32 time<1ms TTL=255
Reply from 200.200.200.129: bytes=32 time<1ms TTL=255
Reply from 200.200.200.129: bytes=32 time<1ms TTL=255
Reply from 200.200.200.129: bytes=32 time<1ms TTL=255

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

Debug가 on으로 설정되어 있기 때문에 echo reply가 출력된 것이다.
R1#
ICMP: echo reply sent, src 200.200.200.129, dst 200.200.200.130

ICMP: echo reply sent, src 200.200.200.129, dst 200.200.200.130

ICMP: echo reply sent, src 200.200.200.129, dst 200.200.200.130

ICMP: echo reply sent, src 200.200.200.129, dst 200.200.200.130

실습> debug 테스트 2

아래 조건에 맞게 네트워크를 설정하고 icmp 패킷을 debug로 확인한다.

  1. PC 설정
    PC1> ip 1.1.1.2 255.255.255.128 1.1.1.1
    Checking for duplicate address...
    PC1 : 1.1.1.2 255.255.255.128 gateway 1.1.1.1

PC1> sh ip

NAME : PC1[1]
IP/MASK : 1.1.1.2/25
GATEWAY : 1.1.1.1
DNS :
MAC : 00:50:79:66:68:00
LPORT : 10006
RHOST:PORT : 127.0.0.1:10007
MTU: : 1500

  1. R1 설정
    라우터의 설정을 완료하고 저장한다.
    !R1
    conf t
    int f0/0
    ip add 1.1.1.1 255.255.255.128
    no sh
    end
    sh ip int b
    wr

3. 디버그 설정
라우터에서 icmp 패킷을 확인하기 위해서 debug를 설정한다.
!R1
debug ip icmp

4. 통신 확인
PC1에서 R1으로 ping으로 통신을 확인한다.

PC1> ping 1.1.1.1
84 bytes from 1.1.1.1 icmp_seq=1 ttl=255 time=30.840 ms
84 bytes from 1.1.1.1 icmp_seq=2 ttl=255 time=15.674 ms
84 bytes from 1.1.1.1 icmp_seq=3 ttl=255 time=15.391 ms
84 bytes from 1.1.1.1 icmp_seq=4 ttl=255 time=15.003 ms
84 bytes from 1.1.1.1 icmp_seq=5 ttl=255 time=15.284 ms

5. 디버그 확인
라우터에서 icmp 패킷을 확인한다.

R1#
Mar 1 00:04:36.335: ICMP: echo reply sent, src 1.1.1.1, dst 1.1.1.2
R1#
Mar 1 00:04:37.363: ICMP: echo reply sent, src 1.1.1.1, dst 1.1.1.2
R1#
Mar 1 00:04:38.395: ICMP: echo reply sent, src 1.1.1.1, dst 1.1.1.2
R1#
Mar 1 00:04:39.527: ICMP: echo reply sent, src 1.1.1.1, dst 1.1.1.2
R1#
*Mar 1 00:04:40.539: ICMP: echo reply sent, src 1.1.1.1, dst 1.1.1.2

디버그 확인이 완료되면 디버그 종료한다.

R1#undebug ip icmp
ICMP packet debugging is off

실습> 라우터 설정하기

/30 비트
255.255.255.25 26 27 28 29 30 0 0
255.255.255.11111100 -> 00,01,10,11 -> 1, 2만 가용IP
Subnet Mask :
255.255.255.252

  1. R1 설정
    !R1
    en
    conf t
    hostname R1
    int f0/0
    ip add 10.10.10.254 255.255.255.0
    no sh
    int s0/0/0
    ip add 1.0.0.1 255.255.255.252
    no sh
    ip route 20.20.20.0 255.255.255.0 1.0.0.2
    end
    sh ip int b
    sh int f0/0
    wr

  2. R2 설정
    !R2
    en
    conf t
    hostname R2
    int f0/0
    ip add 20.20.20.254 255.255.255.0
    no sh
    int s0/0/0
    ip add 1.0.0.2 255.255.255.252
    no sh
    ip route 10.10.10.0 255.255.255.0 1.0.0.1
    end
    sh ip int b
    sh int f0/0
    wr

  3. PC 설정

PC0 설정
IP Address: 10.10.10.1
Subnet Mask: 255.255.255.0
Default Gateway: 10.10.10.254

PC1 설정
IP Address: 10.10.10.2
Subnet Mask: 255.255.255.0
Default Gateway: 10.10.10.254

PC2 설정
IP Address: 10.10.10.3
Subnet Mask: 255.255.255.0
Default Gateway: 10.10.10.254

PC3 설정
IP Address: 20.20.20.1
Subnet Mask: 255.255.255.0
Default Gateway: 20.20.20.254

PC4설정
IP Address: 10.10.10.2
Subnet Mask: 255.255.255.0
Default Gateway: 10.10.10.254

PC5 설정
IP Address: 10.10.10.3
Subnet Mask: 255.255.255.0
Default Gateway: 10.10.10.254

  1. 통신 확인

C:>ping 20.20.20.1

Pinging 20.20.20.1 with 32 bytes of data:

Reply from 20.20.20.1: bytes=32 time=23ms TTL=126
Reply from 20.20.20.1: bytes=32 time=13ms TTL=126
Reply from 20.20.20.1: bytes=32 time=8ms TTL=126
Reply from 20.20.20.1: bytes=32 time=30ms TTL=126

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

5. DCE/DTE 설정
!R1
end
R1#sh int s0/0/0
Serial0/0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 1.0.0.1/30
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set, keepalive set (10 sec)

=================================

conf t
int s0/0/0
encapsulation ppp
do sh int s0/0/0

R1(config-if)#do sh int s0/0/0
Serial0/0/0 is up, line protocol is down (disabled)
Hardware is HD64570
Internet address is 1.0.0.1/30
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)

bandwidth 512
clock rate 500000
do sh int s0/0/0

R1(config-if)#do sh int s0/0/0
Serial0/0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 1.0.0.1/30
MTU 1500 bytes, BW 512 Kbit, DLY 20000 usec,
~~
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)

최종적으로 명령어만 본다면

!R1
en
conf t
int s0/0/0
encapsulation ppp
bandwidth 512
clock rate 500000
end
sh int s0/0/0

!

!R2
en
conf t
int s0/0/0
encapsulation ppp
do sh int s0/0/0

R2(config-if)# do sh int s0/0/0
Serial0/0/0 is up, line protocol is down (disabled)
Hardware is HD64570
Internet address is 1.0.0.2/30
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation PPP, loopback not set, keepalive set (10 sec)

~~

bandwidth 512
do sh int s0/0/0
R2(config-if)# do sh int s0/0/0
Serial0/0/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 1.0.0.2/30
MTU 1500 bytes, BW 512 Kbit, DLY 20000 usec,

최종적으로 명령어만 본다면

!R2
en
conf t
int s0/0/0
encapsulation ppp
bandwidth 512
end
sh int s0/0/0

!

6. 오류 정보 확인하기
인터페이스의 IP주소 설정
int f0/0
ip add 10.10.10.254 255.255.255.0
no sh

인터페이스의 IP주소 삭제
int f0/0
no ip add 10.10.10.254 255.255.255.0

라우팅 테이블에 라우팅 정보 설정
ip route 20.20.20.0 255.255.255.0 1.0.0.2

라우팅 테이블에 라우팅 정보 삭제
no ip route 20.20.20.0 255.255.255.0 1.0.0.2

오류 정보 확인하기
- 라우터가 PC에게 오류를 보고할 때는 ICMP 를 사용한다.
PC1 (10.10.10.1) -> PC3 (20.20.20.1)
C:>ping 20.20.20.1

오류 메세지 1
Reply from 10.10.10.254: Destination host unreachable.

R1에서 R2로 패킷을 보낼 수 없는 경우
R1에서 R2의 20.20.20.0/24 네트워크를 모르기 때문에 패킷을 폐기하고
PC1에 오류메세지를 전송한다. 이때 ICMP를 이용한다.
이를 테스트해보기 위해서는 아래처럼 R1에서 라우팅 테이블 정보를 삭제한다.

R1 라우터에서 설정(라우팅 테이블에 라우팅 정보 삭제)
no ip route 20.20.20.0 255.255.255.0 1.0.0.2

오류 메세지 2
Request timed out.

R1에서 R2로 패킷을 보냈지만
R2에서 R1의 10.10.10.0/24 네트워크를 모르기 때문에 패킷을 폐기한다. 그러므로 R1에서 패킷이 오기를 기다리다가 시간이 넘어서 timed out 메세지가 출력된다.
이를 테스트해보기 위해서는 아래처럼 R1에서 라우팅 테이블 정보를 설정하고 R2에서 라우팅 테이블 정보를 삭제한다.

R1 라우터에서 설정(라우팅 테이블에 라우팅 정보 설정)
ip route 20.20.20.0 255.255.255.0 1.0.0.2
R2 라우터에서 설정(라우팅 테이블에 라우팅 정보 삭제)
no ip route 10.10.10.0 255.255.255.0 1.0.0.1

정상적인 설정을 하기 위해서는 Simulation에서 확인한다.
이를 테스트해보기 위해서는 아래처럼 R1/R2에서 라우팅 테이블 정보를 설정한다.

R1 라우터에서 설정(라우팅 테이블에 라우팅 정보 설정)
ip route 20.20.20.0 255.255.255.0 1.0.0.2

R2 라우터에서 설정(라우팅 테이블에 라우팅 정보 설정)
ip route 10.10.10.0 255.255.255.0 1.0.0.1

LAN과 WAN의 L2를 확인한다.

profile
정보보안 전문가

0개의 댓글