문서의 이전 판입니다!


Cisco Switch 설정

시스코 펌웨어 다운로드 : https://cdn.technet24.ir/Downloads/Cisco/IOS/

패스워드 분실 또는 공장 초기화를 위한 Rommon mode 진입방법
전면 mode 버튼 누른채로 전원 입력

그러면 rommon mode 로 진입이 된다.

가장 먼저 해야할 일은 BAUD RATE 설정이다.

switch: set BAUD 115200

// 변경하는 순간 터미널이 동작하지 않을수 있다. 이런경우 터미널 속도를 115200으로 변경 후 재 접속한다.

switch: set
BAUD=115200
...

스위치 초기화
초기화 방법은 VLAN 정보가 저장된 vlan.dat 파일을 delete vlan.dat 명령어를 사용하여 삭제한다.
또 erase start 명령어를 사용하여 설정파일도 지운후 reload 명령어를 사용하여 재부팅한다.
reload 명령어 사용시 설정사항 저장여부를 물으면 no 라고한다

#del vlan.dat
#erase start
#reload
no
switch#>show version // 버전확인
switch#>show interface vlan // 아이피 주소 설정 표시
switch#>show running-config //현재 활성화된 설정 표시

R1# show flash                                         -> Flash 정보 확인
R1# show ip route                                     -> 라우팅 테이블
R1# show ip interface brief                       -> 인터페이스 정보
R1# show interface [Interface Name]        -> 인터페이스 상황과 통계치
R1# show controllers [Interface Name]      -> 인터페이스에 연결된 케이블이 확인 및 점검
R1# show cdp neighbor                            -> 이웃 장비 확인
R1# show cdp neighbor detail                    -> 인접한 장비의 IP 및 호스트네임 기타 등등 자세히
R1# show running-config                          -> Running-Config (RAM) 확인
R1# show startup-config                           -> Startup-Config (NVRAM) 확인
R1# copy running-config startup-config      -> RAM에서 NVRAM으로 설정 사항 저장
R1# erase startup-config                          -> NVRAM 삭제
Switch# configure terminal
Switch(config)# interface vlan 1
Switch(config-if)# ip address 192.168.1.2 255.255.255.0
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# ip default-gateway 192.168.1.1

DHCP 이용하여 설정
1. 전역 설정 모드에서 interface vlan 1 명령어로 VLAN 1 설정 모드로 진입한다.
2. ip address dhcp 명령어로 IP 주소와 서브넷 마스크 설정한다.
3. no shutdown 명령어로 VLAN 1 가상 인터페이스 활성화한다.
4번이었던 디폴트 게이트웨이 설정을 하지 않는다는 것이 차이점이 있다.

한 가지 알아야 할 점은 dhcp로 IP 주소를 설정할 경우 show running-config 명령어로는 IP 주소를 볼 수 없다.
이때는 show dhcp lease 명령어나 show interface vlan 1 명령어를 통해 IP 주소를 확인할 수 있다.

# conf t
(config) # service timestaps debug datetime localtime  // debug 타임스탬프 변경
(config) # service timestaps log deatetime localtime  // log 타임스탬프 변경
# sh clock  // 장비 현재 시간 확인
# clock set 13:13:13 april 20 2020  // 장비 시간 설정
# clock timezone kst 9  // 타임존 설정 (한국시간)

# conf t
(config) # ntp server time.bora.net  // NTP 서버 지정 (boranet)
# sh ntp status  // NTP 서버 동기화 상태 확인
switch#conf t                                                          <- configure terminal 약자 
switch(config)#vlan 2                                           <- vlan 2번을 생성  
switch(config-vlan)#name VLAN_NUM2          <- 이름은 'VLAN_NUM2' 라고 함
switch(config-vlan)#exit                                        <- 설정 저장하고 나가기 
switch(config)#exit                                                 <- 설정 저장하고 나가기 
switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                                 active    Gi0/1, Gi0/2, Gi0/17, Gi0/26
2    VLAN_NUM2                      active

VLAN 2번에 VLAN_NUM2 라는 이름으로 새로운 vlan이 생성된것을 확인 할 수 있습니다.

switch#conf t
switch(config)#interface gigabitEthernet 0/2      <- vlan에 포함 시킬 포트
switch(config-if)#switchport access vlan 2        <- vlan2에 등록 함 
switch(config-if)#exit
switch(config)#exit
switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                                 active    Gi0/1, Gi0/17, Gi0/26
2    VLAN_NUM2                      active    Gi0/2

VLAN2Gi0/2가 포함되어 있는게 보이시죠?

switch#conf t
switch(config)#interface vlan 2  
switch(config-if)#ip address 10.10.10.2 255.255.255.0     <- vlan2에 ip를 설정 함
switch(config-if)#no shutdown                             <- shutdown 앞에 'no'가 붙었으므로, 인터페이스를 살리라는 뜻. 
switch(config-if)#exit
switch(config)#exit
switch#show interfaces vlan 2                             <- vlan2의 정보 조회 

Vlan2 is up, line protocol is down
  Hardware is EtherSVI, address is 1c17.d3e5.c14e (bia 1c17.d3e5.c14e)
  Internet address is 10.10.10.2/24
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
     reliability 255/255, txload 1/255, rxload 1/255
 .. 이하 생략 .. 

IP주소가 정상적으로 설정 된것을 볼 수 있습니다.

switch#conf t
switch(config)#interface vlan 2  
switch(config-if)#no ip address                              <- vlan2의 ip를 삭제 함
switch(config-if)#exit
switch(config)#exit
switch#show interfaces vlan 2                                <- vlan2의 정보 조회 

Vlan2 is up, line protocol is down
  Hardware is EtherSVI, address is 1c17.d3e5.c14e (bia 1c17.d3e5.c14e)
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
     reliability 255/255, txload 1/255, rxload 1/255
 .. 이하 생략 .. 

IP주소가 정상적으로 제거 된것을 볼 수 있습니다.

switch#conf t
switch(config)#no vlan 2                     <- vlan2 를 삭제함 (cisco 스위치는 앞에 'no'를 붙이면 제거/삭제 의 의미를 가짐)
switch(config)#exit
switch#show interfaces status

Port      Name               Status       Vlan       Duplex  Speed Type
Gi0/1                        notconnect      1            auto   auto 10/100/1000BaseTX
Gi0/2                        notconnect      2            auto   auto 10/100/1000BaseTX

이상하게도.. vlan2를 지웠는데
2번 포트는 여전히 Vlan 2에 포함되어있다고 나옵니다.
default vlan으로 돌아가게 하고 싶다면 아래 명령(인터페이스 제거)을 수행해야 합니다.

switch#conf t
switch(config)#interface gigabitEthernet 0/2                     <- vlan에서 제거할 포트 
switch(config-if)#no switchport access vlan 2                  <- vlan2 에서 제거 
switch(config-if)#exit
switch(config)#exit
switch#show inter status

Port      Name               Status       Vlan       Duplex  Speed Type
Gi0/1                        notconnect      1            auto   auto 10/100/1000BaseTX
Gi0/2                        notconnect      1            auto   auto 10/100/1000BaseTX
  • 로깅 싱크설정

스위치에서 설정작업을 하다보면 명령어 입력도중 시스템 관련메시지가 자동으로 표시되므로
명령어를 제대로 입력하기 위해 싱크작업을 한다

gmate(config)# line 0 16
gmate(config-line)# logg sync
  • 콘솔접속 유지하기
gmate(config)#line console 0
gmate(config-line)# exec-timeout 0
  • 패스워드 설정
gmate(config)# enable secret switch

해당명령어는 관리자 패스워드를 switch 로 설정하겠다는 뜻이다

  • 라인상황 확인하기
gmate#show line

라인상황을 확인후 VTY 설정을 한다

gmate(config)#line vty 0 15
gmate(config-line)# password switch

이러면 원격접속 라인 0~ 15까지 라인의 패스워드가 switch 로 설정된다

  • 컨피그 확인 방법
gmate#show runnign-config
  • vty 패스워드는 암호화 되지 않았기에 암호화를 한다
gmate(config)#service password-encryption
  • 배너달기
gmate(config)#banner motd *
Authonized access only!!
*

시작전후 *을쓴다

  • 한글배너 입력하기
gmate(config)# default-value exec-character-bits 8
gmate(config)# banner motd *
비인가자의 접속을 엄금합니다!!
*
gmate(config)#
  • 인터페이스 설명달기
gmate(config)# interface f 1/0/1
gmate(config)# description gmate1
gmate(config)# interface f 1/0/2
gmate(config)# description gmate2
  • 기본설정파일 셋팅
enable
config terminal
no ip domain-lookup
enable secret $gm@te2oo8

alias exec c config terminal
alias exec r show running-config
alias exec i show ip route
alias exec b show ip interface breif

line consol 0
logging synch
exec-timeout 0
lin vty 0 5
pass $gm@te2oo8
exit
hostname
cisco(config)#
cisco(config)#ip domain-lookup
cisco(config)#ip name-server 210.20.64.21
  • 도메인 검색 끄기
cisco(config)# no ip domain-lookup
  • stp
Switch# show spanning-tree
Switch# show spanning-tree vlan [num]
Switch# show spanning-tree vlan [num] detail
  • 포트상태
Switch# show interface status
  • link aggregation
Switch(config)# int port-channel 1
Switch(config-if)# int range gi 1/0/5-6
// chnnel-group 1 mode on
channel-group 1 mode active

Switch(config-if)# channel-proto lacp
Switch(config-if)# exit

Switch(config)# int port-channel 1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10

확인
Switch# show lacp neighbor

DTP (Dynamic Trunking Protocol)란 시스코 스위치에서 상대 스위치와 트렁크와 관련된 사항을 협상할 때 사용되는 프로토콜이다. DTP에 의해 결정되는 것은 트렁크 포트 전환여부와 트렁크 포트로 동작시 인캡슐레이션 방식이다. 스위치 포트의 DTP 모드는 다음과 같이 구분할 수 있다.

  • 액세스 (access) : 상대 포트와 상관없이 자신은 액세스 포트로 동작한다. 스위치 포트를 액세스 모드로 설정하려면 인터페이스에서 다음 명령어를 사용한다.
S1(config-if)#switchport mode access
  • 트렁크 (trunk) : 상대 포트와 상관없이 자신은 트렁크 포트로 동작한다. 상대 포트를 트렁크 포트로 동작시키기 위한 DTP 패킷을 전송한다. 스위치 포트를 트렁크 모드로 설정하려면 인터페이스에서 다음 명령어를 사용한다.
S1(config-if)#switchport trunk encapsulation dot1q
S1(config-if)#switchport mode trunk

스위치 포트의 모드를 트렁크로 지정하려면 앞의 예처럼 해당 인터페이스의 트렁크 인캡슐레이션 방식을 미리 지정해야 한다. 스위치 모델에 따라 차이가 나지만 사용가능한 인캡슐레이션 방식은 dot1q (802.1Q), islnegotiate(디폴트)가 있다. 트렁크의 인캡슐레이션 방식을 지정하지 않으면 다음처럼 인캡슐레이션 방식이 Auto일 때는 트렁크 모드로 지정할 수 없다는 에러 메시지가 표시된다.

S1(config-if)#switchport mode trunk

Command rejected: An interface whose trunk encapsulation is "Auto" cannot be configured to "trunk" mode.
  • 다이내믹 디자이어러블 (dynamic desirable) : 다이내믹 디자이어러블이 스위치 포트의 디폴트 DTP 모드이다. 이 모드에서는 상대 포트를 트렁크로 동작시키기 위해 DTP 패킷을 전송하지만, 상대측 포트가 트렁크, 디자이어러블, 오토(auto)인 경우에만 자신도 트렁크로 동작한다. 상대방이 액세스 모드이면 자신도 액세스 모드로 동작한다. 스위치 포트를 다시 다이내믹 디자이어러블로 설정하려면 인터페이스에서 다음 명령어를 사용한다.
S1(config-if)#switchport mode dynamic desirable
  • 다이내믹 오토 (dynamic auto) : 스위치 포트의 DTP 모드가 다이내믹 오토이면 상대측 포트가 트렁크 또는 디자이어러블인 경우에만 트렁크로 동작한다. 상대측 모드가 동일한 오토이거나 액세스 모드이면 자신도 액세스 모드로 동작한다.

스위치 포트를 다이내믹 오토 모드로 설정하려면 인터페이스에서 다음 명령어를 사용한다.

S1(config-if)#switchport mode dynamic auto
  • 노-네고시에이트 (nonegotiate) : 스위치 포트가 트렁크 모드일 때 상대에게 DTP 패킷을 전송하지 않게 하는 옵션으로 인터페이스에서 다음과 같은 명령어를 사용한다.
S1(config-if)#switchport mode trunk

S1(config-if)#switchport nonegotiate

이 명령어는 다이내믹 모드에서는 사용할 수 없다. 다이내믹 모드에서 사용시 다음과 같이 nonegotiate옵션과 dynamic옵션은 동시에 사용할 수 없다는 에러메시지가 표시된다.

S1(config-if)#switchport mode dynamic desirable

Command rejected: Conflict between 'nonegotiate' and 'dynamic' status.

이 옵션을 사용하면 상대측 포트도 반드시 트렁크 모드로 설정해야만 트렁크로 동작한다. 만약 상대측이 다이내믹 디자이어러블 모드인 경우, 상대측이 DTP를 전송해도 이 옵션이 설정된 포트가 이를 무시하기 때문에 한쪽은 트렁크 모드, 또 다른 쪽은 액세스 모드가 된다.

  • cisco_switch_설정.1671612213.txt.gz
  • 마지막으로 수정됨: 2022/12/21 08:43
  • 저자 koov