หน้าเว็บ

วันอังคารที่ 27 พฤศจิกายน พ.ศ. 2555

แก้ปัญหา Cisco Switch ไม่สามารถบูทได้ "Error Loading Flash:"

ที่มา : เรียบเรียงจาก Cisco.com
 
เอกสาร นี้อธิบายเกี่ยวกับการแก้ไขปัญหา Cisco Switch เกี่ยวกับการบูทไม่สำเร็จ เนื่องจาก system image เสียหาย ผิดผลาด ถูกลบ หรือมีการกำหนดค่าในการบูทผิด ซึ่งในเอกสารนี้ใช้ได้กับ switch รุ่น 2940, 2950/2955, 2970, 3550, 3560, 3750 and the 3750 Metro series switches.

กำหนดค่า PC สำหรับการ console

ใช้โปรแกรม HyperTerminal ของ Windows เพื่อสร้างการเชื่อมต่อ console session โดยกำหนดค่าดังนี้:
  • Bits per second: 9600
  • Data bits: 8
  • Parity: None
  • Stop bits: 1
  • Flow control: None

ปัญหาที่เกี่ยวข้องกับการบูทของ Switch


  • switch มีการ reboot วน
  • switch ไม่ได้แสดง prompt ปกติ (switch>) แต่แสดง switch:
  • มีข้อความ error ขณะโหลด  flash: 
 

Switch แสดงข้อความ Switch: Prompt or "Error Loading Flash:"


  • เมื่อขึ้น  switch: prompt แสดงถึงการบูทไม่สมบูรณ์ ต้องมีการทำให้ขั้นตอนการบูทสมบูรณ์้
  • เมื่อมีข้อความ  error loading flash:<image> message แสดงว่า ไม่สามารถโหลด image ได้เนื่องจาก ไฟล์เสียหายหรือถูกลบไป
  • อาการไฟล์เสียหายหรือไม่สมบูรณ์อาจเกิดจากตอนดาวโหลดไฟล์มีความผิดพลาด อาจเป็นตอน upgrade หรืออาจมีใครเข้าไปลบไฟล์ที่ flash
ตัวอย่างการบูทที่ไฟล์ image ไม่สมบูรณ์

Error loading "flash:c2950-i6q4l2-mz.121-12c.EA1.bin"
Normally, the switch attempts to automatically boot the next valid image in the Flash file system. Here is an example:
Error loading "flash:c2950-i6q4l2-mz.121-12c.EA1.bin"
Interrupt within 5 seconds to abort boot process.
Loading "flash:/c2950-i6q4l2-mz.121-13.EA1.bin"...######
########################################################

!--- Output suppressed.


ขั้นตอนการแก้ไข

เมื่อ PC มีการเชื่อมต่อกับ Switch ผ่านโปรแกรม Hyperterminal แล้ว

  1. ถอดปลั๊ก power ออก
  2. กดปุ่ม MODE ที่ด้านหน้าของ switch ค้างไว้ แล้วเสียบปลั๊ก
    - ถ้าเป็นรุ่น Catalyst 2940 และ 2950 รอจนไฟ STAT ดับ แล้วจึงปล่อยปุ่ม MODE

      • Catalyst 2940 and 2950 series switches



- ถ้าเป็นรุ่น Catalyst 2970, 3550,3560 และั 3750 Series รอจนไฟ LED ของ 1x (อยู่บนพอร์ตที่) ดับลง จึงปล่อยปุ่ม MODE  

      • Catalyst 2970, 3550, 3560 and 3750 series switches


        - ถ้าเป็น switch รุ่น 2955 ให้กดปุ่ม Ctrl+Break

  จากนั้น prompt ของ Swithc จะขึ้น switch:

  1. ใช้คำสั่ง flash_init command and the load_helper command.
หาก Flash มีการ  initialized สำเร็จจะเป็นดังนี้:

switch: flash_init
 Initializing Flash...
 ...The flash is already initialized.
 switch:

แต่หาก initialized ไม่สำเร็จ จะเป็นดังนี้

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

ใช้คำสั่ง load_helper เพื่อที่จะให้โหลดไฟล์ helper boot image เช่น
switch: load_helper
switch:

  1. ใช้คำสั่ง dir flash: เพื่อดูข้อมูลที่อยู่ใน flash: เช่น
switch: dir flash:
Directory of flash:/
2    -rwx  5        <date>               private-config.text
3    -rwx  110       <date>               info
4    -rwx  976       <date>               vlan.dat
6    -rwx  286       <date>               env_vars
26   -rwx  1592      <date>               config.text
8    drwx  1088      <date>               html
19   -rwx  110       <date>               info.ver
4393472 bytes available (3347968 bytes used)
switch:

!--- No Cisco IOS images or image directories exist in Flash.

ถ้าหากแสดงคล้ายตัวอย่างด้านบนคือ ไม่มีไฟล์ image (ไฟล์นามสกุล .bin) ให้ทำขั้นตอนที่ 5 คือแก้ไขโดยการโหลดไฟล์เข้าไปใหม่โดยผ่าน Xmodem

หากยังพบไฟล์ image อยู่ใน flash ให้ชั้คำสั่ง boot เพื่อพยายามลองบูทอีกครั้ง ตัวอย่างคำสั่งเช่น
 boot flash:filename


เช่น Catalyst 2950
พิมพ์   switch: boot flash:c2950-i6q4l2-mz.121-13.EA1.bin      
!--- This example uses the boot flash:<filename>
!--- command on a 2950.


Loading "flash:c2950-i6q4l2-mz.121-13.EA1.bin"...###########
###########################################################

!--- Output suppressed.
!--- This command syntax is the same for Catalyst 2940 and 2955 series
!--- switches.


รุ่นCatalyst 3550
switch: boot flash:c3550-i5q3l2-mz.121-13.EA1/c3550-i5q3l2-mz.121-13.EA1.bin     
!--- This example uses the boot flash:<filename>/<directory>
!--- command on a 3550.


Loading "flash:c3550-i5q3l2-mz.121-13.EA1/c3550-i5q3l2-mz.121-13.EA1.bin"...####
################################################################################           

!--- Output suppressed.
!--- This command syntax is the same for Catalyst 2970, 3560, and 3750
!--- series switches.


ถ้าใช้ คำสั่ง boot แล้วสำเร็จ prompt จะขึ้นเป็นปกติ คือ  switch>

Press RETURN to get started!
Switch>

!--- The bootup was successful.

หากไม่สำเร็จ ให้ทำตามขั้นตอนที่ 5 คือการโหลดไฟล์ image ใหม่ ผ่านทาง Xmodem ซึ่งอาจลบไฟล์ image เดิมที่ไม่สมบูรณืออกก่อนก็ได้ โดยใช้คำสั่ง delete เช่น
switch: delete flash:c2950-i6q4l2-mz.121-12c.EA1.bin         
!--- Issue the delete flash:<filename>
!--- command in order to delete a Cisco IOS image.


Are you sure you want to delete "flash:c2950-i6q4l2-mz.121-12c.EA1.bin" (y/n)?
y

!--- Enter y for yes if you want to delete the image.

File "flash:c2950-i6q4l2-mz.121-12c.EA1.bin" deleted
switch:

  1. ตัวอย่างต่อไปคือการใช้  Xmodem จากโปรแกรม HyperTerminal เพื่อโหลดไฟล์ image ไปยัง switch
    1. คำสั่ง copy xmodem: flash:filename

ตัวอย่างเช่น
switch: copy xmodem: flash:c2955-i6q4l2-mz.121-13.EA1.bin
Begin the Xmodem or Xmodem-1K transfer now...
CCC

    1. จากโปรแกรม HyperTerminal เลือก Transfer > Send File.
    2. ที่ Protocol เลือก Xmodem  และในช่อง Filename กดปุ่ม Browse และเลือก ไฟล์ Cisco IOS image (.bin file)
    3. กดปุ่ม Send
    4. ระยะเวลาการส่งไฟล์อาจใช้เวลานานขึ้นอยู่กับขนาดของไฟล์  หากสำเร็จจะมีข้อความดังนี้
CCCCCCC.........................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.............................................................................
File "xmodem:" successfully copied to "flash:c2955-i6q4l2-mz.121-13.EA1.bin"

!--- If the Xmodem file transfer fails for some reason, restart the process.
!--- If the Xmodem file transfer is successful, you return to the
!--- switch: prompt.


switch:

  1. หากต้องการระบุไฟล์ที่ต้องการบูท สามารถทำได้ตามตังอย่างดังนี้
boot flash:filename
switch: boot flash:c2955-i6q4l2-mz.121-13.EA1.bin
Loading "flash:c2955-i6q4l2-mz.121-13.EA1.bin"...###############################
################################################################################

!--- Output suppressed.

Press RETURN to get started!
Switch>

!--- The bootup was successful.

ตรวจสอบความถูกต้องเมื่อขั้นตอนการบูทสมบูรณ์ ด้วยคำสั่ง show version เช่น
2955#show version
Cisco Internetwork Operating System Software
IOS (tm) C2955 Software (C2955-I6Q4L2-M), Version
12.1(13)EA1, RELEASE SOFTWARE

!--- This is the current version of software






วันพุธที่ 21 พฤศจิกายน พ.ศ. 2555

Static Route Configuration

ผังการเชื่อมต่อเครือข่ายสำหรับการทดลอง Static and Default Routing


Device
Interface
IP Address
Subnet Mask
Default Gateway
R1
Fa0/0
172.16.3.1
255.255.255.0
n/a

Fa0/1
172.16.2.1
255.255.255.0
n/a
R2
Fa0/0
172.16.1.1
255.255.255.0
n/a

Fa0/1
172.16.2.2
255.255.255.0
n/a

S0/0/1
192.168.1.2
255.255.255.0
n/a
R3
Fa0/0
192.168.2.1
255.255.255.0
n/a

S0/0/1
192.168..1.1
255.255.255.0
n/a
PC1
NIC
172.16.3.10
255.255.255.0
172.16.3.1
PC2
NIC
172.16.1.10
255.255.255.0
172.16.1.1
PC3
NIC
192.168.2.10
255.255.255.0
192.168.2.1



ที่ Router1 แสดงเครือข่าย ที่เราเตอร์รู้จัก จะมีเครือข่ายที่เชื่อมต่ออยู่กับเราเตอร์โดยตรง ซึ่งได้มาจากการกำหนด IP Address ที่อินเตอร์เฟส
R1# show ip route
Gateway of last resort is not set
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.2.0  is directly connected, Ethernet1/0
C       172.16.3.0  is directly connected, FastEthernet0/0
จากนั้นต้องทำการเพิ่มเครือข่ายอื่นๆ ที่เราเตอร์ยังไม่มีข้อมูล ดังนี้
            172.16.1.0/24     ที่เป็นเครือข่าย LAN ของ R2
            192.168.1.0/24    ที่เป็น Serial ที่เชื่อมต่อ R2 และ R3
            192.168.2.0/24    ที่เป็นเครือข่าย LAN ของ R3


การกำหนดเส้นทางให้เราเตอร์แบบ Static โดยทั่วไป ใช้สำหรับบอกเส้นทางไปยังเครือข่ายภายนอกที่มีทางออกเส้นทางเดียว การเช็ต Static route ทำได้โดยใช้คำสั่ง ip route โดยมีรูปแบบคำสั่งดังนี้
             
   Router(config)# ip  route   network-address    subnet-mask   { ip-address |  exit-interface }
               
            อธิบายพารามิเตอร์ต่างๆ ดังนี้
·         network-address คือ เครือข่ายปลายทาง ที่ต้องการเพิ่มเส้นทางให้กับเราเตอร์
·         subnet-mask คือ subnet mask ของ เครือข่ายปลายทางที่เพิ่มให้กับเราเตอร์ ซึ่ง subnet mask สามารถกำหนดในรูปแบบ กลุ่มเครือข่ายได้ (summarize)
·         ip-address คือ ip address ของเราเตอร์ตัวถัดไปที่ติดกับเราเตอร์ที่ต้องการกำหนดเส้นทางออกไป
·         exit-interface คือ interface ที่เป็นเส้นทางออกให้ packet ส่งออกไป 

การกำหนดเครือข่าย Static Route โดยใช้ IP Address เป็นพารามิเตอร์บอกเครือข่ายถัดไป(Next Hop)
ทำการเพิ่มเครือข่ายให้ R1 ด้วยคำสั่งดังนี้
R1(config)# ip route  172.16.1.0   255.255.255.0    172.16.2.2
R1(config)# ip route  192.168.1.0   255.255.255.0   172.16.2.2
R1(config)# ip route  192.168.2.0   255.255.255.0   172.16.2.2

หลังจากเพิ่มเครือข่ายแล้ว สามารถตรวจสอบได้โดย
R1#  show ip route
Gateway of last resort is not set
     172.16.0.0/24 is subnetted, 3 subnets
S       172.16.1.0 [1/0] via  172.16.2.2
C       172.16.2.0 is directly connected, Ethernet1/0
C       172.16.3.0 is directly connected, FastEthernet0/0
S    192.168.1.0/24 [1/0] via  172.16.2.2
S    192.168.2.0/24 [1/0] via  172.16.2.2

การกำหนดเครือข่าย Static Route โดยใช้ Exit Interface เป็นพารามิเตอร์
การกำหนดโดยใช้ exit interface สามารถทำได้โดยใส่ ชื่อ interface ของเราเตอร์ที่จะส่งเพกเกจออกไปยังเครือข่ายอื่น แทน ip address (next-hop)  ตัวอย่างการกำหนด Static route โดยใช้ exit interface ให้กับ R2
R2(config)# ip  route  172.16.3.0   255.25.255.0  fa0/1
R2(config)# ip  route  192.168.2.0   255.255.255.0  se0/0/1
ตรวจสอบเครือข่ายที่เพิ่มขึ้น
Router#sh ip route
Gateway of last resort is not set
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, FastEthernet0/0
C       172.16.2.0 is directly connected, Ethernet1/0
S       172.16.3.0 is directly connected, FastEthernet1/0
C    192.168.1.0/24 is directly connected, Serial0/0
S    192.168.2.0/24 is directly connected, Serial0/0/1

Default Static Routes
การกำหนด default route เป็น static route ชนิดหนึ่ง ซึ่งใช้สำหรับบอกเครือข่ายทั้งหมดที่ไม่ตรงกับที่ระบุเอาไว้ หรือหากมีเครือข่ายใดๆ ที่ไม่ตรงกับเครือข่ายที่มีการกำหนดไว้ ยังไงก็จะตรงกับ default route
ตัวอย่างคำสั่ง default static route

            Router(config)#  ip   route  0.0.0.0   0.0.0.0     { ip-address |  exit-interface }

การกำหนด default route ให้กับ R3
R3(config)#  ip  route  0.0.0.0   0.0.0.0  s0/0/1
R3# show  ip  route
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
C    192.168.1.0/24 is directly connected, Serial0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 is directly connected, Serial0/0/1

Summary Router
ในการกำหนด Static Route ให้กับ R3 สามารถ กำหนดแบบ summary route ได้ เนื่องจาก R3 ต้องมีการกำหนดเครือข่ายเพิ่มทั้งหมด 3 เครือข่ายคือ 172.16.1.0/24, 172.16.2.0/24, 172.16.3.0/24 ซึ่งรายละเอียดของการคำนวน  summary route จะกล่าวถึงในบทถัดไป ในที่นี้จะบอกถึงที่มาของ subnet จากการ summery ทั้ง 3 เครือข่าย ที่เป็นที่มาของ subnet ดังนี้
10101100.00010000.00000001.00000000               ; (มาจาก 172.16.1.0)
10101100.00010000.00000010.00000000              ;  (มาจาก 172.16.2.0)      
10101100.00010000.00000011.00000000              ;  (มาจาก 172.16.3.0)
            จะเห็นว่าเครือข่ายทั้ง 3 ที่จะกำหนดให้กับ R3 มีหมายเลข bit ที่เหมือนกัน 22 bits  ถ้าคิดเป็นหมายเลข subnet mask จะได้เป็น 255.255.252.0  (หรือ 172.16.0.0/22) ดังนั้นหากกำหนด routing แบบ summery จึงสามารถทำได้เพียงหนึ่งบรรทัด ดังนี้

R3(config)# ip  route  172.16.0.0  255.255.252.0  serial 0/0/1

RIP Concepts
RIP เป็น Dynamic Routing protocol ประเภท Distance Vector ปัจจุบันเป็นเวอร์ชั่น 2 (RIPv2) มีการพัฒนาจากเวอร์ชั่น 1 (RIPv1) ซึ่งเราควรทราบเกี่ยวกับความแตกต่างของสองเวอร์ชั่นในเรื่องหลักการทำงานและการกำหนดค่า ในส่วนแรกจะบอกถึงข้อมูลของ RIPv1 อย่างย่อๆก่อน
รูปแบบของ RIPv1 Message
RIPv1 เป็น classful และเป็นชนิด distance vector สำหรับ IPv4 ที่ใช้ค่า hop count เป็นค่า matric เพื่อใช้สำหรับเลือกเส้นทางเพียงอย่างเดียว หากจำนวน hop count ที่มีค่ามากกว่า 15 จะไม่สามารถเดินทางไปได้
RIPv1 ส่งข้อมูลโดยแบบ UDP หมายเลขพอร์ตคือ 520 และจะ broadcast ทุกๆ 30 วินาที