1. 程式人生 > >01: 專案實戰一:part01

01: 專案實戰一:part01

Top

NSD PROJECT1 DAY01

  1. 案例1:交換機基本命令模式
  2. 案例2:交換機基本命令
  3. 案例3:交換機基本配置

1 案例1:交換機基本命令模式

1.1 問題

本例要求熟練掌握交換機每個模式的配置命令

對於思科交換機來說,主要有2種配置途徑:其一,使用交換機自帶的Console線纜連線到計算機的COM口,然後利用計算機的超級終端軟體直接配置,首次配置通常使用這種方式;其二,通過telnet方式遠端訪問、配置交換機,這種方式要求此交換機已配置有IP地址且已接入計算機網路,後續課程會學習此訪問方式。

1)通過超級終端訪問交換機

2)交換機工作模式的進入與退出

真實裝置環境,如圖-1所示。

圖-1

1.2 方案

本例中的配置練習可採用思科模擬器 —— Cisco Packet Tracer 6.2來實現。

1)安裝Packet Tracer 6.2

雙擊安裝包執行預設安裝,然後將中文語言檔案Chinese.ptl解壓到安裝目錄下的多語言資料夾,比如C:\Program Files (x86)\Cisco Packet Tracer 6.0\languages。

雙擊桌面的Cisco Packet Tracer快捷方式以啟動程式,開啟選單“Options”-->“Preferences”-->切換到“Interface”選項卡-->選擇下方的Chinese.ptl-->單擊右下角“Change Language”按鈕,彈出提示時單擊“OK”,如圖-2所示。

圖-2

關閉當前Packet Tracer程式,然後再重新啟動此程式,可發現已經變成中文語言介面了(當前漢化的還不完整),如圖-3所示。

圖-3

2)建立實驗網路拓撲

在Packet Tracer程式主視窗中,新增一臺Cisco 2960交換機、一臺普通PC機,並新增Console連線、直通網線連線,如圖-4所示,確認完畢後將當前拓撲結構儲存為c2960-pc.pkt檔案。

圖-4

其中,連線細節如下:

  • 交換機的Console口 <--> PC機的RS 232串列埠。
  • 交換機的FastEthernet0/24介面 <--> PC機的FastEthernet0網絡卡。

1.3 步驟

實現此案例需要按照如下步驟進行。

步驟一:通過超級終端訪問交換機。

1)配置並開啟超級終端

在此前建立的Packet Tracer實驗拓撲環境中,單擊PC機以開啟此裝置,確認電源已啟動(機箱示意圖上的指示燈為黃綠色),切換到“桌面選項卡”,如圖-5所示,找到其中的“終端”並單擊開啟。

圖-5

在彈出的終端配置視窗中,如圖-6所示,單擊“確定”以接受預設值。

圖-6

接下來就可以看到“終端”視窗了,其中顯示了通過Console線連線的交換機初始化資訊,回車後可進入交換機的“Switch>”配置系統,如圖-7所示。

圖-7

提示:在Packet Tracer環境中,可直接單擊交換機圖示,然後切換到“命令列”選項卡,也可以進入IOS配置環境。

步驟二:交換機工作模式的進入與退出

1) 交換機工作模式的進入如下:

 
  1. Switch>enable //切換為特權模式
  2. Switch# configure terminal     //進入全域性配置模式
  3. Enter configuration commands, one per line. End with CNTL/Z.
  4. Switch(config)#interface fastEthernet 0/1 //進入介面模式
  5. Switch(config-if)#

2)交換機工作模式的退出下:

 
  1. Switch(config-if)#exit //介面模式退到全域性配置模式
  2. Switch(config)#exit //全域性配置模式退到特權模式
  3. Switch#exit //特權模式退到使用者模式
  4. Switch>

注:exit 返回上一模式

end 從介面或者全域性配置模式回到特權模式,快捷鍵Ctrl+z同等效果

思科裝置命令列不區分大小寫,與Linux命令列不同

命令輸入錯誤卡住時同時按鍵盤ctrl+shift+6這三個鍵即可

2 案例2:交換機基本命令

2.1 問題

修改及檢視交換機配置

1)修改交換機主機名

2)檢視交換機配置資訊

2.2 方案

在Packet Tracer程式主視窗中,新增一臺Cisco 2960交換機,進入交換機,輸入相關命令進行配置和檢視交換機

2.3 步驟

實現此案例需要按照如下步驟進行。

步驟一:修改交換機主機名

進入全域性配置模式後,使用hostname指令可以為交換機設定主機名。例如,以下操作可以將主機名設定為s1:

 
  1. Switch(config)# hostname s1                     //配置主機名
  2. s1(config)#    

步驟二:檢視交換機配置資訊

檢視交換機當前的執行配置:

 
  1. 檢視交換機當前的執行配置:
  2. s1# show running-config                 //檢視當前的執行配置
  3. Building configuration...
  4.  
  5. Current configuration : 1052 bytes
  6. !
  7. version 12.2
  8. no service timestamps log datetime msec
  9. no service timestamps debug datetime msec
  10. no service password-encryption
  11. !
  12. hostname sw1                         //已配置主機名
  13. !
  14. !
  15. !
  16. !
  17. spanning-tree mode pvst
  18. !
  19. interface FastEthernet0/1
  20. !
  21. interface FastEthernet0/2
  22. !
  23. interface FastEthernet0/3
  24. !
  25. interface FastEthernet0/4
  26. !
  27. interface FastEthernet0/5
  28. !
  29. interface FastEthernet0/6
  30. !
  31. interface FastEthernet0/7
  32. !
  33. interface FastEthernet0/8
  34. !
  35. interface FastEthernet0/9
  36. !
  37. interface FastEthernet0/10
  38. !
  39. interface FastEthernet0/11
  40. !
  41. interface FastEthernet0/12
  42. !
  43. interface FastEthernet0/13
  44. !
  45. interface FastEthernet0/14
  46. !
  47. interface FastEthernet0/15
  48. !
  49. interface FastEthernet0/16
  50. !
  51. interface FastEthernet0/17
  52. !
  53. interface FastEthernet0/18
  54. !
  55. interface FastEthernet0/19
  56. !
  57. interface FastEthernet0/20
  58. !
  59. interface FastEthernet0/21
  60. !
  61. interface FastEthernet0/22
  62. !
  63. interface FastEthernet0/23
  64. !
  65. interface FastEthernet0/24
  66. !
  67. interface GigabitEthernet1/1
  68. !
  69. interface GigabitEthernet1/2
  70. !
  71. interface Vlan1
  72. no ip address
  73. shutdown
  74. !
  75. !
  76. line con 0
  77. !
  78. line vty 0 4
  79. login
  80. line vty 5 15
  81. login
  82. !
  83. !
  84. end
  85. sw1#

步驟三:檢視IOS名稱以及版本資訊

檢視ios名稱及版本資訊

 
  1. s1#show version
  2. Cisco Internetwork Operating System Software
  3. IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1)
  4. Copyright (c) 1986-2005 by cisco Systems, Inc.
  5. Compiled Wed 18-May-05 22:31 by jharirba
  6. Image text-base: 0x80010000, data-base: 0x80562000
  7.  
  8. ROM: Bootstrap program is is C2950 boot loader
  9. Switch uptime is 1 minutes, 39 seconds
  10. System returned to ROM by power-on
  11.  
  12. Cisco WS-C2950-24 (RC32300) processor (revision C0) with 21039K bytes of memory.
  13. Processor board ID FHK0610Z0WC
  14. Last reset from system-reset
  15. Running Standard Image
  16. 24 FastEthernet/IEEE 802.3 interface(s)
  17.  
  18. 63488K bytes of flash-simulated non-volatile configuration memory.
  19. Base ethernet MAC Address: 00E0.B026.B88C
  20. Motherboard assembly number: 73-5781-09
  21. Power supply part number: 34-0965-01
  22. Motherboard serial number: FOC061004SZ
  23. Power supply serial number: DAB0609127D
  24. Model revision number: C0
  25. Motherboard revision number: A0
  26. Model number: WS-C2950-24
  27. System serial number: FHK0610Z0WC
  28. Configuration register is 0xF

3 案例3:交換機基本配置

3.1 問題

配置交換機實現以下目的

3.2 方案

實現此案例需要按照如下步驟進行。

3.3 步驟

步驟一:交換機密碼配置

1)為交換機配置特權密碼Taren1

開啟交換機命令列配置介面

 
  1. Switch>en
  2. Switch#conf t
  3. Switch(config)#enable password Taren1

步驟二:儲存配置並重啟裝置檢測密碼可用情況

 
  1. Switch(config)#exit
  2. Switch#write
  3. Switch#reload
  4. ……….
  5. ………
  6. Switch>enable
  7. Password:                            //此時需要輸入密碼才能進入特權模式

步驟三:清空裝置配置

 
  1. Switch#erase startup-config
  2. Erasing the nvram filesystem will remove all configuration files! Continue? [confirm] //此時系統詢問是否確定刪除,按回車即可
  3. [OK]
  4. Erase of nvram: complete

步驟四:重啟裝置檢測配置狀況

 
  1. Switch#reload
  2. Proceed with reload? [confirm] //此時系統詢問是否確定重啟,按回車即可