IT이야기

CISCO 2960s 초기화 후 기본설정

somick 2020. 7. 30. 00:53

굴러다니던 스위치로 새로운 세그먼트 설정을 할 필요가 생겼기에 이리저리 조사해보고 초기화+기본설정을 했다.

초기화 부터 작업한 적은 처음이므로 메모 로서 남겨둔다.

스위치 초기화

sw> en
sw# ter len 0
sw# show run
sw# show flash:
sw# erase startup-config
sw# delete flash:vlan.dat
sw# reload

‘ter len0’ 명령어와 show 명령어들은 현재 상태를 확인 하는 차원에서 입력한 명령어다. 필요하다면 출력결과를 백업 해놓는 편이 좋을 수도 있다.

스위치는 전원을 넣은 후 부팅 하면서 ‘startup-config’ 라는 파일로부터 설정을 읽어들인다. 그러므로 ‘erase startup-config’ 명령어로 설정파일을 지워버리면 다음 부팅시에 파일이 없으니 초기화 화면을 표시해 준다.

 

마지막으로 ‘flash:vlan.dat’ 명령어 인데 vlan 설정들은 스위치 설정과 별도로 vlan.dat 파일에 들어 있으니 이 파일을 지워두지 않으면 스위치 재설정 후 vlan 정보는 초기화 이전의 데이터가 그대로 남아 있는 현상이 발생한다.

초기설정

스위치를 초기화 하고 재부팅을 시키면 아래와 같은 초기설정 화면이 나온다. 호스트명, 관리IP어드레스 등을 입력해준다.

Would you like to enter the initial configuration dialog? [yes/no]:yes
 
Would you like to enter basic management setup? [yes/no]:yes
  Enter host name [Switch]:2960S-My-SW
  Enter enable secret:
  Enter enable password:
  Enter virtual terminal password:
  Configure SNMP Network Management? [no]:no
Enter interface name used to connect to the
management network from the above interface summary:FastEthernet0/24
Configuring interface FastEthernet0/48:
  Configure IP on this interface? [no]:yes
    IP address for this interface: 192.168.0.254
    Subnet mask for this interface [255.255.255.0] : 255.255.255.0
    Class C network is 192.168.0.0, 24 subnet bits; mask is /24
Would you like to enable as a cluster command switch? [yes/no]:no
[0] Go to the IOS command prompt without saving this config.
[1] Return back to the setup without saving this config.
[2] Save this configuration to nvram and exit.
Enter your selection [2]:2
2960S-My-SW>

snmp같은 것들은 환경에 맞추어서, 목적에 맞추어서 입력 or 무시

상세설정

중요한 설정값들은 공개가 힘드니 적당히 변경해서 기술하니 약간 이상한 곳이 있을지도.

sw> en
sw# ter len 0
sw# conf t
sw(conf)# no service dhcp
sw(conf)# service tcp-keepalives-in
sw(conf)# service sequence-numbers
sw(conf)# clock timezone JST 9 0
sw(conf)# no ip source-route
sw(conf)# no ip domain-lookup
sw(conf)# no ip igmp snooping
sw(conf)# vtp domain mydomain
sw(conf)# vtp mode transparent
sw(conf)# spanning-tree mode rapid-pvst
sw(conf)# spanning-tree portfast bpduguard default
sw(conf)# spanning-tree extend system-id
sw(conf)# spanning-tree vlan 10 priority 12288
sw(conf)# service password-encryption
sw(conf)# errdisable recovery cause udld
sw(conf)# errdisable recovery cause bpduguard
sw(conf)# errdisable recovery interval 600
sw(conf)# vlan 10
sw(conf-vlan)# name VLAN10
sw(conf-vlan)# end
sw# conf t
sw(conf)# int vlan10
sw(conf-if)# ip address 192.168.0.254 255.255.255.0
sw(conf-if)# ip default-gateway 192.168.0.1
sw(conf-if)# no ip redirects
sw(conf-if)# no ip unreachables
sw(conf-if)# no ip proxy-arp
sw(conf-if)# no ip http server
sw(conf-if)# no ip http secure-server
sw(conf-if)# end
 
sw# conf t
sw(conf)# int Gi0/1
sw(conf-if)# switchport mode access
sw(conf-if)# switchport access vlan 10
sw(conf-if)# no cdp enable
sw(conf-if)# exit
///// 반복 /////
sw(conf)# int Gi0/24
sw(conf-if)# switchport mode access
sw(conf-if)# switchport access vlan 6
sw(conf-if)# spanning-tree portfast
sw(conf-if)# no cdp enable
sw(conf-if)# exit
sw# conf t
 
sw(conf)# ntp source vlan6
sw(conf)# ntp server 192.168.0.1
sw(conf)# end
sw# write memory
sw# copy running-config startup-config
sw# exit

특별한 설정은 없다. ntp설정해주고, VLAN10설정해주고, 모든 포트들을 VLAN10으로 지정해주었다.

그리고 다른 VLAN10 스위치와 연결할 예정이니 spanning-tree도 지정해주었다.