2008/11/20 15:19

# Cisco IOS CLI 4단계 모드 및 명령어

 - Tap키 : 명령어 자동 완성 기능(리눅스에서와 같다)
 - 명령어 축약 기능 지원
Router>en
Router#
 - Ctrl + A : 커서를 맨 앞으로 이동
 - Ctrl + E : 커서를 맨 뒤로 이동
 - Ctrl + C : 해당 라인 취소
 - exit : 한 단계 전 모드로 이동

 - 명령어 축약 정보가 빈약한 경우

Router#sh ru
% Ambiguous command:  "sh ru"

 - 명령어가 오타인 경우

Router#sh rq
           ^
% Invalid input detected at '^' marker.

Router>   [User Mode] 사용자 모드
   - 기본적인 정보 확인 및 테스트 정도만 가능한 모드
   - 라우터에 영향을 주는 명령어 및 정보 확인 불가능하다.
Router#enable
------------------------------------------------------------------------------------
Router#   [Privilege Exec Mode] 관리자 모드
   - 정보 확인, 저장, 삭제, 재부팅, 테스트, 접속 가능
   - 라우터에 영향을 주는 설정은 줄가능하다.
   - 'show' 접두어 명령어를 이용하여 정적 정보 확인
   - 'debug' 접두어 명령어를 이용하여 동적 정보 확인
   - 'copy' 접두어 명령어를 이용하여 저장 가능
   - 'erase' 접두어 명령어를 이용하여 삭제 가능
   - 'reload' 명령어를 이용하여 라우터 재부팅
   - 'ping' 명령어를 이용하여 IP 데이터 도달 가능성 확인
   - 'telnet' 명령어를 이용하여 원격 접속 가능

Router#configure terminal         ←conf t로 축약가능
------------------------------------------------------------------------------------
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#  [Global Exec Mode] 라우터 설정 모드
   - 라우터 관련 설정이 시작되는 모드
------------------------------------------------------------------------------------
1. 라우터 호스트 네임 설정

Router>enable
Router>conf t
Router(config)#hostname R1
R1(config)#no hostname R1
Router(config)#

------------------------------------------------------------------------------------
[참고] RAM & NVRAM

 1) RAM

  - 라우터에서 설정을 실시하면 설정 내용이 'running-config' 파일로 자동으로 RAM에
     저장되며, 라우터는 이 내용을 참조하여 바로 동작한다.

  - 라우터에서는 저장된 설정 내용을 'Running-Config'라고 하며, 'show running-config'
     명령어를 이용하여 확인이 가능하다. (sh run)

  - 대신, 라우터가 재부팅이 되면, RAM에 저장된 설정 내용은 다 삭제된다.
     (휘발성 메모리)

 2) NVRAM

  - RAM에 저장된 설정 내용을 'startup-config' 파일로 수동으로 저장하여 보관한다.
 
  - 라우터에서는 'Startup-Config'라고 하며, 'show startup-config' 명령어를 이용하여
     확인이 가능하다. (sh start)

  - 라우터가 재부팅이 되면, 저장된 설정 내용이 삭제되지 않는 비휘발성 메모리이다.

  - NVRAM은 라우터가 부팅될때 참조한다.

 1. POST
 2. Bootstrap을 이용한 CPU Access
 3. IOS 찾음 (Flash 메모리 -> TFTP 서버 요청 -> ROM[Mini IOS])
 4. OS 로딩
 5. NVRAM 참조

if)NVRAM 참조시 저장된 설정 내용이 있다면, RAM으로 복구시켜 라우터 동작 실시

if)NVRAM 참조시 저장된 설정 내용이 없다면, 다음과 같다.

      --- System Configuration Dialog ---

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

 3) NVRAM에 저장하는 명령어

Router# copy running-config startup-config <- copy run start <- wr

 4) NVRAM 삭제하는 명령어

Router# erase startup-config <- erase start

 5) 라우터 재부팅

Router# reload (다이나믹스에서는 'dynagen' 실행창에서 reload R1 또는 reload /all)
---------------------------------------------------------------------------
# 라우터 접속 관련 패스워드 설정

1. Console 패스워드 설정

R1(config)#line console 0
R1(config-line)#password ciscocon
R1(config-line)#login

2. Aux 패스워드 설정

R1(config)#line aux 0
R1(config-line)#password ciscoaux
R1(config-line)#login

3. VTY(텔넷) 패스워드 설정

R1(config)#line vty 0 4
R1(config-line)#password ciscotel
R1(config-line)#login

4. 라우터 전역 패스워드(Privilege Password)

Router> enable  [User Mode]

password :  <- 'Enable Secret' & 'Enable Password'

Router#   [Privilege Exec Mode]

 R1(config)# enable secret cisco <- 패스워드 문자를 암호화 O
 R1(config)# enable password ciscofan <- 패스워드 문자를 암호화 X
 - 두개 설정을 동시에 하면, Enable Secret 패스워드로 동작한다.

[참고] 만약, 모든 패스워드를 암호화할 경우에는 다음과 같은 명령어를 사용한다.

R1(config)#service password-encryption
R1# show run
-------------------------------------------------------------------------------
# 라우터 인터페이스 IP 주소 설정 및 활성화

사용자 삽입 이미지

R1(config)# interface fastEthernet 0/0 <- int fa0/0
R1(config-if)# ip address x.x.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface serial 1/0 <- int s1/0
R1(config-if)# ip address x.x.12.1 255.255.255.0
R1(config-if)# clock rate 64000 <- DCE 커넥터가 연결된 경우
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface loopback 172 <- int lo172
R1(config-if)# ip address 172.16.1.1 255.255.255.0
R1(config-if)# Ctrl + Z
R1# show run

R2(config)# int s1/1
R2(config-if)# ip address x.x.12.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# int fa0/0
R2(config-if)# ip address x.x.2.1 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# int s1/0
R2(config-if)# ip address x.x.23.2 255.255.255.0
R2(config-if)# clock rate 64000
R2(config-if)# no shutdown
R2(config-if)# Ctrl + Z
R2# show run

R3(config)# int s1/1
R3(config-if)# ip address x.x.23.3 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# int fa0/0
R3(config-if)# ip address x.x.3.1 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# int lo 172
R3(config-if)# ip address 172.16.3.1 255.255.255.0
R3(config-if)# Ctrl + Z
R3# show run
------------------------------------------------------------------------------
# show ip interface brief

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                    Protocol
FastEthernet0/0         13.13.1.1       YES manual up                         up     
Serial1/0                  13.13.12.1      YES manual up                         up     
Serial1/1                  unassigned      YES unset  administratively down down   
Serial1/2                  unassigned      YES unset  administratively down down   
Serial1/3                  unassigned      YES unset  administratively down down   
FastEthernet2/0         unassigned      YES unset  administratively down down   
Loopback172            172.16.1.1      YES manual up                          up   

R2#show ip interface brief
Interface                  IP-Address      OK? Method Status                   Protocol
FastEthernet0/0         13.13.2.1       YES manual up                         up     
Serial1/0                  13.13.23.3      YES manual up                         up     
Serial1/1                  13.13.12.2      YES manual up                         up     
Serial1/2                  unassigned      YES unset  administratively down down   
Serial1/3                  unassigned      YES unset  administratively down down   
FastEthernet2/0         unassigned      YES unset  administratively down down   

R3#show ip interface brief
Interface                  IP-Address      OK? Method Status                   Protocol
FastEthernet0/0         13.13.3.1       YES manual up                         up     
Serial1/0                  unassigned      YES unset  administratively down down   
Serial1/1                  13.13.23.3      YES manual up                         up     
Serial1/2                  unassigned      YES unset  administratively down down   
Serial1/3                  unassigned      YES unset  administratively down down   
FastEthernet2/0         unassigned      YES unset  administratively down down   
Loopback172             172.16.3.1      YES manual up                         up     

Posted by 시아레