読者です 読者をやめる 読者になる 読者になる

labunix's blog

labunixのラボUnix

WS-C2970G-24T-Eを触ってみた

■設定を初期化
 事前条件として、パスワードが分かっていること。
 以下を参考に初期化を行う。

 Cisco IOS - How to CLI 3
 http://www.infraexpert.com/study/ciscoios3.5.html

 Catalyst 2970 スイッチ ソフトウェア コンフィギュレーション ガイド Cisco IOS Release 12.2(25)SEC
 http://www.cisco.com/cisco/web/support/JP/docs/SW/LANSWT-Access/CAT2970SWT/CG/001/16182_05.html



# dmesg | grep tty
[    0.000000] console [tty0] enabled
[    0.688803] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.709469] 00:08: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

# minicom /dev/ttyS0

■minicomが使えない時はtelnet接続、「reload」して「screen」を使う。
 なので、telnetは用意しておいた方が良い。

# minicom /dev/ttyS0 
minicom: /dev/modem をオープンできません : そのようなファイルやディレクトリはありません

> enable
Password:
# show flash

Directory of flash:/

    2  drwx         192   Mar 1 1993 00:04:49 +00:00  c2970-lanbase-mz.122-25.SEC2
  349  -rwx         106   Mar 1 1993 00:04:49 +00:00  info
  350  -rwx        1391   Mar 1 1993 00:08:27 +00:00  config.text.old
  351  -rwx         736   Mar 1 1993 00:01:13 +00:00  vlan.dat
  352  -rwx        1462   Mar 1 1993 00:34:01 +00:00  config.text
  353  -rwx           5   Mar 1 1993 00:34:01 +00:00  private-config.text

15998976 bytes total (9898496 bytes free)

#rename flash:config.text config.text.2
Destination filename [config.text.2]? 

#show flash: | include config
  350  -rwx        1391   Mar 1 1993 00:08:27 +00:00  config.text.old
  351  -rwx        3050   Mar 1 1993 00:40:54 +00:00  config.text.2
  352  -rwx           5   Mar 1 1993 00:40:54 +00:00  private-config.text

# erase startup-config 
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
# delete flash:vlan.dat
Delete filename [vlan.dat]? 
Delete flash:vlan.dat? [confirm]

# reload
Proceed with reload? [confirm]

■起動したら初期設定は「no」とする。

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

■確認

Switch> enable
Switch# ! no more command
Switch# terminal length 0
Switch# show flash: | include config
  350  -rwx        1391   Mar 1 1993 00:08:27 +00:00  config.text.old
  351  -rwx        3050   Mar 1 1993 00:40:54 +00:00  config.text.2
Switch# write memory 
Building configuration...
[OK]
Switch# show flash: | include config
  350  -rwx        1391   Mar 1 1993 00:08:27 +00:00  config.text.old
  351  -rwx        3050   Mar 1 1993 00:40:54 +00:00  config.text.2
  352  -rwx        1186   Mar 1 1993 00:05:53 +00:00  config.text
  353  -rwx           5   Mar 1 1993 00:05:53 +00:00  private-config.text

Switch# show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/1, Gi0/2, Gi0/3, Gi0/4
                                                Gi0/5, Gi0/6, Gi0/7, Gi0/8
                                                Gi0/9, Gi0/10, Gi0/11, Gi0/12
                                                Gi0/13, Gi0/14, Gi0/15, Gi0/16
                                                Gi0/17, Gi0/18, Gi0/19, Gi0/20
                                                Gi0/21, Gi0/22, Gi0/23, Gi0/24
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

■初期設定

Switch# configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)# hostname S1
S1(config)# interface GigabitEthernet 0/1
S1(config-if)# no shutdown
S1(config-if)# description Manage-Port
S1(config-if)# exit
S1(config)# exit
S1# show interface GigabitEthernet 0/1 description 
Interface                      Status         Protocol Description
Gi0/1                          down           down     Manage-Port

S1# configure terminal
S1(config)# line ?
  <0-16>   First Line number
  console  Primary terminal line
  vty      Virtual terminal

S1(config)# line console 0
S1(config)# logging ?
  synchronous  Synchronized message output

S1(config-line)# logging synchronous
# exit

■パスワード「XXXXX」を設定、暗号化

S1(config)# enable password XXXXX
S1(config)# service password-encryption

■Telnetのログイン名を「labunix」、パスワードを「XXXXX」に設定

S1(config)# username labunix password XXXXX
S1(config)# line vty 0 15
S1(config-line)# transport input telnet
S1(config-line)# login local
S1(config-line)# exit

■Telnetの待ち受けIP設定、GW設定は無しとする

S1(config)# ip telnet source-interface gigabitEthernet 0/1
S1(config-if)# interface vlan 1
S1(config-if)# ip address 172.16.16.201 255.255.255.0
S1(config-if)# no shutdown 
S1(config-if)# exit
S1(config)# exit
S1#write memory 
Building configuration...
[OK]

■Linux側でeth2に、c7980のGi0/1にLANケーブルを接続

S1#show version  | include ^[Cc]isco   
Cisco IOS Software, C2970 Software (C2970-LANBASE-M), Version 12.2(25)SEC2, RELEASE SOFTWARE (fc1)
cisco WS-C2970G-24T-E (PowerPC405) processor (revision L0) with 118784K/12280K bytes of memory.

S1# show interfaces GigabitEthernet 0/1 status

Port      Name               Status       Vlan       Duplex  Speed Type
Gi0/1     Manage-Port        connected    1          a-full a-1000 10/100/1000BaseTX

■同一セグメントの移行用の仮IP/GW設定

$ cat /etc/debian_version 
7.4
$ sudo route add -host 172.16.16.201/32 eth2

■Telnetログイン時刻設定

$ env LANG=C date --date "+10 sec" '+%H:%M:%S %d %b %Y'
22:17:54 26 Mar 2014

$ telnet 172.16.16.201
Trying 172.16.16.201...
Connected to 172.16.16.201.
Escape character is '^]'.

User Access Verification

Username: labunix
Password: 
S1>enable 
Password: 
S1# write memory
Building configuration...
[OK]
S1#clock set 22:17:54 26 Mar 2014

■Telnet軽油でNTP設定、コンフィグ確認

S1#configure terminal 
S1(config)#ntp peer 192.168.1.1
S1(config)#exit
S1#show ntp status
Clock is synchronized, stratum 3, reference is 192.168.1.1
nominal freq is 119.2092 Hz, actual freq is 119.2092 Hz, precision is 2**18
reference time is D6DD5270.4505CFD0 (13:19:44.269 UTC Wed Mar 26 2014)
clock offset is 0.2459 msec, root delay is 11.57 msec
root dispersion is 46.16 msec, peer dispersion is 0.66 msec
S1#write memory 
Building configuration...
[OK]

S1# verify flash:/config.text
Verified flash:/config.text
S1# terminal length 0
S1# show running-config 
Building configuration...

Current configuration : 1463 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
hostname S1
!
enable password 7 XXXXXXXXXXXXXXX
!
username labunix password 7 XXXXXXXXXXXXXXX
no aaa new-model
ip subnet-zero
!
ip telnet source-interface GigabitEthernet0/1
!
!
!
no file verify auto
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
interface GigabitEthernet0/1
 description Manage-Port
!
interface GigabitEthernet0/2
!
interface GigabitEthernet0/3
!
interface GigabitEthernet0/4
!
interface GigabitEthernet0/5
!
interface GigabitEthernet0/6
!
interface GigabitEthernet0/7
!
interface GigabitEthernet0/8
!
interface GigabitEthernet0/9
!
interface GigabitEthernet0/10
!
interface GigabitEthernet0/11
!
interface GigabitEthernet0/12
!
interface GigabitEthernet0/13
!
interface GigabitEthernet0/14
!
interface GigabitEthernet0/15
!
interface GigabitEthernet0/16
!
interface GigabitEthernet0/17
!
interface GigabitEthernet0/18
!
interface GigabitEthernet0/19
!
interface GigabitEthernet0/20
!
interface GigabitEthernet0/21
!
interface GigabitEthernet0/22
!
interface GigabitEthernet0/23
!
interface GigabitEthernet0/24
!
interface Vlan1
 ip address 172.16.16.201 255.255.255.0
 no ip route-cache
!
ip http server
!
control-plane
!
!
line con 0
 logging synchronous
line vty 0 4
 login local
 transport input telnet
line vty 5 15
 login local
 transport input telnet
!
!
end

S1#

■ネットワーク情報確認

S1#show vlan id 1

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi0/1, Gi0/2, Gi0/3, Gi0/4
                                                Gi0/5, Gi0/6, Gi0/7, Gi0/8
                                                Gi0/9, Gi0/10, Gi0/11, Gi0/12
                                                Gi0/13, Gi0/14, Gi0/15, Gi0/16
                                                Gi0/17, Gi0/18, Gi0/19, Gi0/20
                                                Gi0/21, Gi0/22, Gi0/23, Gi0/24

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0   

Remote SPAN VLAN
----------------
Disabled

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------

S1# show vlan summary 
Number of existing VLANs           : 5
 Number of existing VTP VLANs      : 5
 Number of existing extended VLANs : 0

S1# show interfaces Gi0/1 stats
GigabitEthernet0/1
             Switch path    Pkts In   Chars In   Pkts Out  Chars Out
               Processor          0          0       1505     111470
             Route cache          0          0          0          0
                   Total          0          0       1505     111470

S1# show ip interface Gi0/1
GigabitEthernet0/1 is up, line protocol is up
  Inbound  access list is not set

■起動情報確認

S1#show boot 
BOOT path-list      : 
Config file         : flash:/config.text
Private Config file : flash:/private-config.text
Enable Break        : no
Manual Boot         : no
HELPER path-list    : 
Auto upgrade        : yes

■自分の操作以外に再起動していないか

S1#show version  | include uptime
 S1 uptime is 1 hour, 28 minutes

S1#show logging | include RESTART
00:01:32: %SYS-5-RESTART: System restarted --

今日はここまで。