daemonfreaks.com

Ciscoのスイッチで遊びたい

posted by jun-g at Thu, 20 Mar 2008 11:41 JST

Ciscoといえば、昔足繁く通った、今はもう大阪には無いレコード屋の事しか思い浮かばないんやけど、先日、会社でCatalyst2950っていうスイッチが廃棄されそうになっていたので、なんとなく貰ってきた。

cisco

初期セットアップ用にシリアルケーブルを借りてきたものの、うちにあるPCでシリアルポートを備えているのがFreeBSDの載ったデスクトップマシン一台だけやったので、そこからつないでセットアップ作業を行ってみた。その手順をメモ。

まずはrootになってcuコマンドでシリアルポートに接続。

$ su -
# cu -l /dev/ttyd4 -s 9600
Connected

ここでスイッチ本体のMODEボタンを押しながら電源投入。

C2950 Boot Loader (CALHOUN-HBOOT-M) Version 12.0(5)WC(1), RELEASE SOFTWARE (fc1)
Compiled Tue 27-Mar-01 23:28 by devgoyal
WS-C2950-24 starting...
Base ethernet MAC Address: 00:00:00:00:00:00
Xmodem file system is available.

The system has been interrupted prior to initializing the
flash filesystem.  The following commands will initialize
the flash filesystem, and finish loading the operating 
system software:

    flash_init
    load_helper
    boot

switch:

起動した。次にファイルシステムを初期化。

switch: flash_init
Initializing Flash...
flashfs[0]: 166 files, 2 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 7741440
flashfs[0]: Bytes used: 2967040
flashfs[0]: Bytes available: 4774400
flashfs[0]: flashfs fsck took 6 seconds.
...done initializing flash.
Boot Sector Filesystem (bs:) installed, fsid: 3
Parameter Block Filesystem (pb:) installed, fsid: 4
switch: 

できた。次にヘルプのロード。

switch: load_helper
switch:

できた?わからん。ま、いいや。次に保存されている設定ファイルを避ける。

switch: rename flash:config.text flash:config.old
switch:

そしてIOSを起動!

switch: boot
Loading "flash:c2950-c3h2s-mz.120-5.3.WC.1.bin"...###############################################################################################################################

File "flash:c2950-c3h2s-mz.120-5.3.WC.1.bin" uncompressed and installed, entry point: 0x80010000
executing...

              Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706



Cisco Internetwork Operating System Software 
IOS (tm) C2950 Software (C2950-C3H2S-M), Version 12.0(5.3)WC(1), MAINTENANCE INTERIM SOFTWARE
Copyright (c) 1986-2001 by cisco Systems, Inc.
Compiled Mon 30-Apr-01 07:56 by devgoyal
Image text-base: 0x80010000, data-base: 0x8031A000


Initializing flashfs...
flashfs[1]: 165 files, 2 directories
flashfs[1]: 0 orphaned files, 0 orphaned directories
flashfs[1]: Total bytes: 7741440
flashfs[1]: Bytes used: 2964992
flashfs[1]: Bytes available: 4776448
flashfs[1]: flashfs fsck took 6 seconds.
flashfs[1]: Initialization complete.
Done initializing flashfs.
C2950 POST: System Board Test : Passed
C2950 POST: Ethernet Controller Test : Passed
C2950 POST: MII TEST : Passed

cisco WS-C2950-24 (RC32300) processor (revision B0) with 22260K bytes of memory.
Processor board ID FAB0525Q0AU
Last reset from system-reset

Processor is running Enterprise Edition Software
Cluster command switch capable
Cluster member switch capable
24 FastEthernet/IEEE 802.3 interface(s)

32K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address: 00:00:00:00:00:00
Motherboard assembly number: 00-0000-00
Motherboard serial number: FFFFFFFFFFF
Model revision number: B0
Model number: WS-C2950-24
System serial number: FFFFFFFFFFF
C2950 INIT: Complete

00:00:17: %SYS-5-RESTART: System restarted --
Cisco Internetwork Operating System Software 
IOS (tm) C2950 Software (C2950-C3H2S-M), Version 12.0(5.3)WC(1), MAINTENANCE INTERIM SOFTWARE
Copyright (c) 1986-2001 by cisco Systems, Inc.
Compiled Mon 30-Apr-01 07:56 by devgoyal

         --- System Configuration Dialog ---

At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.

Continue with configuration dialog? [yes/no]: 

うーん、yes。そして言われるがままに設定してゆく。

Continue with configuration dialog? [yes/no]: yes
Enter IP address: 192.168.0.151
Enter IP netmask: 255.255.255.0
Would you like to enter a default gateway address? [yes]: yes
IP address of default gateway: 192.168.0.1
Enter host name [Switch]: Cisco

The enable secret is a one-way cryptographic secret used
instead of the enable password when it exists. 

Enter enable secret: ********

Would you like to configure a Telnet password? [yes]: yes
Enter Telnet password: ********
Would you like to enable as a cluster command switch? [yes/no]: no

The following configuration command script was created:

ip subnet-zero
interface VLAN1
ip address 192.168.0.151 255.255.255.0
ip default-gateway 192.168.0.1
hostname Cisco
enable secret 5 ******************************
line vty 0 15
password ********
snmp community private rw
snmp community public ro
!
end

Use this configuration? [yes/no]: yes
Building configuration...
[OK]
Use the enabled mode 'configure' command to modify this configuration.

Press RETURN to get started.


Cisco>

設定できたかな?確認するためにシリアル通信から抜ける。

Cisco>exit

Cisco con0 is now available

Press RETURN to get started.

ここで

~.

と入力してEnterを押せばcuコマンドから抜ける。最初意味がわからなくてハマった。

次にスイッチにちゃんとIPアドレスが設定されているか確認。スイッチの24番ポートを家LANのHUBに繋いでみた。

# ping 192.168.0.151
PING 192.168.0.151 (192.168.0.151): 56 data bytes
64 bytes from 192.168.0.151: icmp_seq=0 ttl=255 time=7.559 ms
64 bytes from 192.168.0.151: icmp_seq=1 ttl=255 time=7.513 ms
64 bytes from 192.168.0.151: icmp_seq=2 ttl=255 time=7.533 ms
64 bytes from 192.168.0.151: icmp_seq=3 ttl=255 time=7.562 ms
64 bytes from 192.168.0.151: icmp_seq=4 ttl=255 time=7.534 ms
...

ふむ、つながってる。ってことで次はtelnetで接続してみる。

# telnet 192.168.0.151
Trying 192.168.0.151...
Connected to 192.168.0.151.
Escape character is '^]'.


User Access Verification

Password: Kerberos:	No default realm defined for Kerberos!

Kerberos?よくわからんけど、とりあえずさっき設定したパスワードを入力。

Cisco>

うむ、ログインできた。これで今後はシリアルケーブルは不要になった。

ネットワークは素人なので、これで色々勉強してみよう。おわり。

以下、参考にしたサイト。

どうでもいいけど、このスイッチ、ファンがめちゃうるさいな…。