CCNA學習筆記 一 基礎方面

 上學時學過一學期NA的課程,但是後來就再沒用過,基本忘沒了,工作中會用到,複習一下。 

用這個軟件:PacketTracer53

一、幾種配置模式:

  switch> 用戶命令模式

  switch#特權命令模式

  switch(config)#全局配置模式

  switch(config-if)#端口配置模式

enanble可以從用戶模式進入特權模式

  1. Switch>enable 
  2. Switch# 

disable退出全局模式

  1. Switch#disable 
  2. Switch> 

conf t可以從特權模式進入全局配置模式

  1. Switch#configure terminal  
  2. Enter configuration commands, one per line.  End with CNTL/Z. 
  3. Switch(config)# 

hostname可以修改名字,全局配置模式下才行

  1. Switch(config)#hostname xiaoqi  
  2. xiaoqi(config)#  

 

interface f0/1從全局配置模式進入端口配置模式

  1. xiaoqi(config)#interface fastEthernet 0/1 
  2. xiaoqi(config-if)# 

二、檢查、查看命令

sh ver 查看IOS版本

  1. xiaoqi#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. .......

sh flash查看內存使用狀況

  1. xiaoqi#show flash:  
  2. Directory of flash:/ 
  3.  
  4.     1  -rw-     3058048          <no date>  c2950-i6q4l2-mz.121-22.EA4.bin 
  5.  
  6. 64016384 bytes total (60958336 bytes free) 

sh mac-address-table查看MAC地址表

  1. xiaoqi#show mac-address-table  
  2.           Mac Address Table 
  3. ------------------------------------------- 
  4.  
  5. Vlan    Mac Address       Type        Ports 
  6. ----    -----------       --------    ----- 

sh interface f0/1 查看某個端口信息

  1. xiaoqi#show interfaces f0/1 
  2. FastEthernet0/1 is down, line protocol is down (disabled) 
  3.   Hardware is Lance, address is 0010.11d2.7a01 (bia 0010.11d2.7a01) 
  4.  BW 100000 Kbit, DLY 1000 usec, 
  5.      reliability 255/255, txload 1/255, rxload 1/255 
  6.   Encapsulation ARPA, loopback not set 
  7.   Keepalive set (10 sec) 
  8.   Half-duplex, 100Mb/s 

sh ? 所有可以查看的信息

  1. xiaoqi#show ? 
  2.   access-lists       List access lists 
  3.   arp                Arp table 
  4.   boot               show boot attributes 
  5.   cdp                CDP information 
  6.   clock              Display the system clock 
  7.   dtp                DTP information 
  8.   etherchannel       EtherChannel information 
  9.   flash:             display information about flash: file system 
  10.   history            Display the session command history 
  11.   hosts              IP domain-name, lookup style, nameservers, and host table 
  12.   interfaces         Interface status and configuration 
  13.   ip                 IP information 
  14.   logging            Show the contents of logging buffers 
  15.   mac-address-table  MAC forwarding table 
  16.   mls                Show MultiLayer Switching information 
  17.   port-security      Show secure port information 
  18.   privilege          Show current privilege level 
  19.   processes          Active process statistics 
  20.   running-config     Current operating configuration 
  21.   sessions           Information about Telnet connections 
  22.   snmp               snmp statistics 
  23.   spanning-tree      Spanning tree topology 
  24.   startup-config     Contents of startup configuration 
  25.   storm-control      Show storm control configuration 
  26.   tcp                Status of TCP connections 
  27.   tech-support       Show system information for Tech-Support 
  28.   terminal           Display terminal configuration parameters 
  29.   users              Display information about terminal lines 
  30.   version            System hardware and software status 
  31.   vlan               VTP VLAN status 
  32.   vtp                VTP information 

三、密碼設置

進入全局配置模式後enable password ***可以設置從用戶模式進入特權模式的密碼。

  1. xiaoqi>enable  //先進入特權模式
  2. xiaoqi#conf t   //再進入全局配置模式
  3. Enter configuration commands, one per line.  End with CNTL/Z. 
  4. xiaoqi(config)#enable password xiaoqi  //將密碼設爲xiaoqi

  1. xiaoqi(config)#line console 0  //進入console配置模式
  2. xiaoqi(config-line)#password xiaoqi  //設置連接console口所需密碼
  3. xiaoqi(config-line)#login  //生效
  4. xiaoqi(config-line)#line vty 0 4  //設置遠程連接
  5. xiaoqi(config-line)#password xiaoqi  //設置遠程連接密碼
  6. xiaoqi(config-line)#login   //生效

service password-encryption設置密碼已加密的形式存放

  1. xiaoqi(config)#service password-encryption  //在全局配置模式下 

四、配置IP地址及默認網關

  1. xiaoqi(config)#interface vlan 1  //進入vlan1
  2. xiaoqi(config-if)#ip address 192.168.0.253 255.255.255.0  //設置vlan1的ip
  3. xiaoqi(config-if)#ip default-gateway 192.168.0.254  //設置vlan1的網關

五、管理mac地址表

  1. xiaoqi>show mac-address-table  
  1. xiaoqi#show mac-address-table  

 顯示MAC地址表兩種模式都能看

  1. xiaoqi#clear mac-address-table  

清空mac地址表,只能在特權模式下清空,全局模式不行

  1. xiaoqi(config)#mac-address-table static 00d0.baa9.975c vlan 1 interface fa0/1 //設置mac地址(在全局模式) 

  1. xiaoqi#sh mac-address-table  
  2.           Mac Address Table 
  3. ------------------------------------------- 
  4.  
  5. Vlan    Mac Address       Type        Ports 
  6. ----    -----------       --------    ----- 
  7.  
  8.    1    00d0.baa9.975c    STATIC      Fa0/1 
  1. Switch(config-if)#mac-address 12.12.12 //改變端口的MAC

六、配置端口安全

  1. xiaoqi#conf terminal  
  2. Enter configuration commands, one per line.  End with CNTL/Z. 
  3. xiaoqi(config)#interface fa0/2 
  4. xiaoqi(config-if)#switchport mode access 

 switchport mode access,端口的默認模式,可以連電腦,另一種模式是trunk,用於交換機級聯傳輸vlan信息。

  1. Switch(config-if)#switch port-security maximum 4  //允許該端口下MAC條目最大數量爲4

  1. Switch(config-if)#switch port-security mac-address 0019.5535.b828 
  2. //允許0019.5535.b828設備介入本端口

  1. Switch(config-if)#switchport port-security violation shutdown  //?

 七、其他

     exit 退回到上級模式

     end 直接回到特權模式

     enable secert *** 配置進入特權模式的密碼,密碼加密

     no ip domain-lookup 路由器不適用dns服務器解析主機的ip地址

     logging synchonous 對路由器上的提示信息進行同步,防止信息干擾我們輸入命令

     no ip routing 關閉路由器的路由功能

     show line 顯示個線路的狀態

     line 33 48 進入33-38線路模式

     transport input all 允許所有協議進入線路

     int loopback0 進入loopback0接口

     alias exec crl clear line 33 爲命令起一個別名

     privilege exec level 0 clear line 把命令clear line的登記該爲0,在用戶模式下也可以執行

     banner motd 設置用戶登陸路由器的提示信息

     sh running-config 顯示當前配置

     保存配置信息

  1. Switch#copy running-config startup-config  
  2. Destination filename [startup-config]?  
  3. Building configuration... 
  4. [OK] 

    sh history 顯示歷史命令

 

 






 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章