기술노트

기술노트

게시물 상세
cisco 장비 기본 명령어
작성자 : 관리자(jieun@ehostidc.co.kr)  작성일 : 2019-04-04   조회수 : 5999
Router>      <--- 유저모드
             기본적인 확인을 위한 명령어실행
            
Router> enable
Router#      <--- 프리빌리지모드
             유저모드+ 저장,삭제가 가능
Router# configure terminal
Router(config)#   <--- 글로벌 컨피그 모드
                  라우터, 스위치 전체에 영향을 미치는 명령어 
Router(config)# interface fa0/0
Router(config-if)# <--- 인터페이스모드
                   각각의 세부기관의 구성
                   interface,line,routing,dhcp,nat 등을 구성할 수 있다.
──────────────────────────────────────────────────────
# 배너 구성하기 !!!!
login         로그인시
motd         접속과 동시에
TEST123(config)# banner motd !
배너의 처음과 끝을 표시할 때 쓰는 임의의 문자 -> '!'.
!
======================
   HELLO EVERYONE
======================
!
TEST123(config)#
──────────────────────────────────────────────────────
라우터를 위한 telnet 구성하기
enable password 를 구성해 주어야한다.
TEST(config)# enable password cisco
원격접속을 위한 터미널을 구성해야한다.
TEST(config)# line vty 0 4 (최대 5명)
TEST(config-line)# password test
TEST(config-line)# login
TEST# show run (지금까지 작업확인)
보안성을 강화하기 위한 방법
 1. cisco(config)# service password-encryption
  enable password 7 060506324F41
 구성값 내부의 모든 password 를 암호화한다.
 임시로 사용추천. 장기적으로 전혀 안전하지 않다.
 2. enable secret password
 cisco(config)# enable secret hyunseok
cisco# show ip int brief (포트별 아이피와 연결확인)
──────────────────────────────────────────────────────
라우터 설정 저장 방법.
라우터의 구성 값(running-config)을 nvram 에 저장하고, tftp서버(192.168.2.101) 에도 저장하라.
sol.)
HYUNSEOK# copy run start (run파일 start로 저장)
Destination filename [startup-config]?
Building configuration...
[OK]
HYUNSEOK# wr <- copy run start 와 같다
Building configuration...
[OK]
HYUNSEOK# copy run tftp:
Address or name of remote host []? 192.168.2.101 (tftp 아이피주소 입력)
Destination filename [hyundai-confg]?
──────────────────────────────────────────────────────
DHCP 구성하기
R1(config)# ip dhcp excluded-address
             192.168.1.17   192.168.1.19
R1(config)#
R1(config)# ip dhcp pool TEST1
R1(dhcp-config)# network 192.168.1.16 /28
R1(dhcp-config)# lease 0 6 30
R1(dhcp-config)# default-router 192.168.1.30
R1(dhcp-config)# dns-server 168.126.63.1 8.8.8.8
R1(dhcp-config)# domain-name skbroadband.com
R1(dhcp-config)# exit
R1(config)#
R1(config)# int fa0/0
R1(config-if)# ip add 192.168.1.30  255.255.255.240
R1(config-if)# no sh
R1(config-if)#
해석
R1(config)# ip dhcp excluded-address [ip] [ip]
            해당 구역의 ip를 제외시킴.
R1(config)#
R1(config)# ip dhcp pool [Name] 풀 이름 지정
R1(dhcp-config)# network [ip]/[prefix] 네트워크주소
R1(dhcp-config)# lease 일 시간 분
R1(dhcp-config)# default-router [ip] 기본 게이트웨이
R1(dhcp-config)# dns-server [ip] dns 서버아이피
R1(dhcp-config)# domain-name [도메인이름]
R1(dhcp-config)# exit
R1(config)#
R1(config)# int fa0/0
R1(config-if)# ip add [ip] [subnet mask] D.G.를 입력
R1(config-if)# no sh [활성화]
R1(config-if)#
──────────────────────────────────────────────────────
라우터에서 SSH 구성하기
R1(config)# ip domain-name test.com
R1(config)# username user1 secret user1
R1(config)# crypto key generate
            rsa general-keys modulus 1024
The name for the keys will be: R1.test.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-export  able...[OK]
R1(config)# line vty 0 19
R1(config-line)# login local
R1(config-line)# transport input ssh
R1(config-line)#

해석
R1(config)# ip domain-name [도메인이름]
R1(config)# username [ID] secret [password]
R1(config)# crypto key generate
            rsa general-keys modulus [512 – 2048]
[사용하는 유저정보를 암호화 하는 방법]
The name for the keys will be: R1.test.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-export  able...[OK]
R1(config)# line vty 0 19
R1(config-line)# login local [정해놓은 유저정보 물어봄]
R1(config-line)# transport input ssh
                 ssh으로만 접속가능
──────────────────────────────────────────────────────
VLAN(Virtual Local Area Network)
SW1(config)# vlan 10                         <-- vlan 10 생성
SW1(config-vlan)# name SALES                 <-- vlan 10 의 이름 변경
SW1(config-vlan)#
SW1(config-vlan)# vlan 20
SW1(config-vlan)# name ENG
SW1(config-vlan)#
SW1(config-vlan)# vlan 30                    <-- vlan 30 생성
SW1(config-vlan)# no vlan 30                 <-- vlan 30 삭제
SW1(config)#
SW1(config)# int e1/2                        <-- e1/2 로 진입
SW1(config-if)# switchport mode access       <-- 이 포트는 액세스포트이다
SW1(config-if)# switchport access vlan 10    <-- vlan 10 에 access 한다
SW1(config-if)#
SW1(config)# int e1/3
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config-if)#
SW1(config-if)# int range e2/0 - 1           <-- e2/0 부터 e2/1 까지 동시에 설정
SW1(config-if-range)# sw mode acc            <-- e2/0,e2/1 둘 다 액세스포트이다
SW1(config-if-range)# sw acc vlan 20         <-- e2/0,e2/1 둘 다 vlan 20에 액세스
SW1(config-if-range)# 
──────────────────────────────────────────────────────
스위치 포트에서 트렁크 설정 하는 방법.
SW2(config)# int e0/1 (라우터와 연결된 포트)
SW2(config-if)# sw trunk encap dot1q
SW2(config-if)# sw mode trunk
──────────────────────────────────────────────────────
라우터에서 Vlan 연결 게이트웨이 설정 방법
R1(config)# int f0/1
R1(config-if)# no sh
R1(config)# int f0/1.10(10은 Vlan에 맞춰서 함.)
R1(config-subif)# encapsulation dot1q 10(Vlan 번호)
R1(config-subif)#ip add [vlan D.G. ip] [subneting]
──────────────────────────────────────────────────────
vtp domain 설정하기
SW1(config)# vtp domain TEST
(sw1은 기본 vtp모드가 sever로 지정됨.)
──────────────────────────────────────────────────────
vtp mode 조정
SW2(config)# vtp mode client
(sw2를 클라이언트로 지정.)
──────────────────────────────────────────────────────
STP 경로 조정
SW1(config)# spanning-tree vlan 10 root primary (루트브릿지로 설정)
SW2(config)# spanning-tree vlan 10 root secondary (두번째 루트로 지정)
──────────────────────────────────────────────────────
[STP설정 확인]
SW1(config)# spanning-tree mode rapid-pvst
──────────────────────────────────────────────────────
인터넷 연결 가능 방법(NAT구성)
R_HY(config)# ip nat inside source list 1 int fa0/0 overload
R_HY(config)# access-list 1 per any
R_HY(config)#
R_HY(config)# int fa0/0
R_HY(config-if)# ip nat outside
R_HY(config-if)#
R_HY(config-if)# int fa0/1
R_HY(config-if)# ip nat inside
──────────────────────────────────────────────────────
telnet 구성
enable password / enable secret(패스워드지정)
virtual terminal 구성
R_HY(config)#line vty
  login or login local
  login 이라면
R_HY(config-line)# line vty  0 4
R_HY(config-line)# password cisco
R_HY(config-line)# login
  login local 이라면
R_HY(config-line)# line vty 0 4
R_HY(config-line)# login local
R_HY(config-)# username [ID] password [P/W]
──────────────────────────────────────────────────────
native vlan 설정하기
SW(config)# int range e0/1 , e1/0
SW(config-if-range)# sw tr all vlan 10,20,999
SW(config-if-range)# sw tr nat vlan 444
SW(config-if-range)#
SW(config)# int fa0/1.444
SW(config-if)# encapsulation dot1Q 444 native

R1-SW1 간에는 native vlan 문제가 발생할 것이다. 따라서 R1에서도 native vlan 을 SW와 동일한 vlan 으로 지정해 주어야한다.
-> 실제 통신에 이용한 인터페이스가 아니므로 IP 주소를 입력해 둘 필요는 없다.
──────────────────────────────────────────────────────
Active Standby 설정하기
SW1 <<-- vlan 10 : Active/ vlan20 : Standby
int vlan 10
 standby 10 ip 172.16.1.254
 standby 10 priority 110
 standby 10 preempt
 standby 10 track e0/0 20
!
int vlan 20
  standby 20 ip 172.16.2.254
  standby 20 preempt
!
SW2 <<-- vlan 20 : Active/ vlan10 : Standby
int vlan 20
 standby 20 ip 172.16.2.254
 standby 20 priority 110
 standby 20 preempt
 standby 20 track e0/0 20
!
int vlan 10
  standby 10 ip 172.16.1.254
  standby 10 preempt
!
──────────────────────────────────────────────────────
CDP 확인방법
# show cdp neighbor         <-- 연결포트,기종,IOS
# show cdp neighbor detail  <-- 추가적으로 IP주소도 확인가능
──────────────────────────────────────────────────────
이더채널 구성하기
SW1,2에서
  int range e1/1 - 2
     channel-group 1 mode active
     exit
  int port-channel 1
     switchport trunk encapsulation dot1q
     switchport mode trunk
SW1(config)# int range e1/1 - 2
SW1(config-if-range)# switchport trunk encapsulation dot1q
SW1(config-if-range)# switchport mode trunk
SW1(config-if-range)# channel-group 1 mode active
SW1(config-if-range)# exit
SW1(config)# int port-channel 1
SW1(config-if)# switchport trunk encapsulation dot1q
SW1(config-if)# switchport mode trunk
SW1(config-if)#
[확인방법]
# show int trunk
# show int port-channel 1  BW 부분을 확인하세요!!!
# show spanning-tree vlan 1  하여 blocking port 찾으세요
# debug spanning-tree event [STP에서의 상태변화확인]
──────────────────────────────────────────────────────
이전글 MySQL 특정 테이블 crashed 에러 발생시 조치 방법
다음글 IIS X-Forwarded-For 로깅 설정