1. 程式人生 > >實驗 15 交換機基本配置

實驗 15 交換機基本配置

一.實驗目的:
1.掌握交換機基本配置的步驟和方法。
2.掌握檢視和測試交換機基本配置的步驟和方法。
二.實驗要點:
配置交換機的基本引數,檢查交換機的基本引數配置。
三.實驗裝置:
交換機 Cisco Catalyst 2950-24 一臺,帶有網絡卡的工作站 PC 一臺,控制檯電纜一條,直連線一條。
四、實驗環境
這裡寫圖片描述
圖15

實驗中使用2950-24和2950T-24都能實現效果
五. 實驗步驟
1.按圖 15 連線交換機和工作站 PC。
2.配置交換機主機名(SwitchA)、加密使能密碼(S1)、虛擬終埠令(S2)及超時時間(5分鐘)、禁止名稱解析服務。

Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z. switchA(config)#hostname SwitchA SwitchA(config)#enable password s1 SwitchA(config)#line vty 0 4 SwitchA(config-line)#password s2 SwitchA(config-line)#login SwitchA(config-line)#line con 0 SwitchA(config-line)#exec-time 5 0 SwitchA(config-line
)#no ip domain-lookup SwitchA(config)#

3.配置交換機管理 IP 地址(192.168.1.1)、子網掩碼(255.255.255.0)、預設閘道器(192.168.1.254)。

SwitchA(config)#int vlan 1
SwitchA(config-if)#ip ad 192.168.1.1 255.255.255.0
SwitchA(config-if)#no sh

SwitchA(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up

%LINEPROTO-5
-UPDOWN: Line protocol on Interface Vlan1, changed state to up SwitchA(config-if)#exit SwitchA(config)#ip default-gateway 192.168.1.254 SwitchA(config)#exit

4.配置交換機埠速度(100Mbps)、埠雙工方式(半雙工)。(這裡配置全雙工模式是無法實現埠能夠ping通的)

什麼是半雙工,什麼是全雙工?它們之間有什麼區別?
半雙工(half-duplex)是指傳輸過程中同時只能向一個方向傳輸。一方的資料傳輸結束之後,另外一方再回應。也就是說同時只有一個節點能夠傳輸,如果兩個節點同時傳輸資料的話,網路中就會出現擁堵。 相信你能夠理解,這種傳輸方式效率低,需要更多的時間,收發更多的資料。 老的網站都是用的半雙工的節點,主要是因為受到網路媒介(同軸電纜)和硬體裝置(hub)的限制。 全雙工(full-duplex)是指兩方能同時傳送和接受資料。在這種情況下就沒有擁堵的危險,資料的傳輸也就更快。

全雙工 速率100M ,可以同時接收發送幀。配置duplex full
半雙工 速率10M , 瞬時只能接收或者傳送幀。配置duplex half

SwitchA#
%SYS-5-CONFIG_I: Configured from console by console

SwitchA#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SwitchA(config)#int f0/1
SwitchA(config-if)#speed 10
SwitchA(config-if)#duplex half
SwitchA(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up

SwitchA(config-if)#exit

5.通過 Telnet 方式登入到交換機。
在 hostA 上 C:>telnet 192.168.1.1

PC>ping 192.168.1.1

Pinging 192.168.1.1 with 32 bytes of data:

Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=1ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255
Reply from 192.168.1.1: bytes=32 time=0ms TTL=255

Ping statistics for 192.168.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC>telnet 192.168.1.1
Trying 192.168.1.1 ...Open


User Access Verification

Password:       //這裡輸入s2
SwitchA>en
Password:       //這裡輸入s1
SwitchA#show running
SwitchA#show running-config 

6.檢查交換機執行配置檔案內容。
7.檢查交換機啟動配置檔案內容。
show running-config //檢查啟動配置檔案,要基本讀懂配置檔案中關於交換機的一些資訊

SwitchA#show running-config 
Building configuration...

Current configuration : 1140 bytes
!
version 12.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname SwitchA
!
enable password s1
!
no ip domain-lookup
!
spanning-tree mode pvst
!
interface FastEthernet0/1
 switchport mode access
 duplex half
 speed 100
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface Vlan1
 ip address 192.168.1.1 255.255.255.0
!
ip default-gateway 192.168.1.254
!
!
line con 0
 exec-timeout 5 0
!
line vty 0 4
 password s2
 login
line vty 5 15
 login
!
!
end

show version //顯示思科IOS資訊

SwitchA#show version
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 18-May-05 22:31 by jharirba
Image text-base: 0x80010000, data-base: 0x80562000

ROM: Bootstrap program is is C2950 boot loader
Switch uptime is 55 minutes, 14 seconds
System returned to ROM by power-on

Cisco WS-C2950-24 (RC32300) processor (revision C0) with 21039K bytes of memory.
Processor board ID FHK0610Z0WC
Last reset from system-reset
Running Standard Image
24 FastEthernet/IEEE 802.3 interface(s)

63488K bytes of flash-simulated non-volatile configuration memory.
Base ethernet MAC Address: 0001.6327.6705
Motherboard assembly number: 73-5781-09 
Power supply part number: 34-0965-01
Motherboard serial number: FOC061004SZ
Power supply serial number: DAB0609127D
Model revision number: C0
Motherboard revision number: A0
Model number: WS-C2950-24
System serial number: FHK0610Z0WC
Configuration register is 0xF

8.檢查 VLAN1 的引數及配置。

SwitchA#show vlan

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

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


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

9.檢查埠 FastEthernet 0/1 的狀態及引數。

SwitchA#show int f0/1
FastEthernet0/1 is up, line protocol is up (connected)
  Hardware is Lance, address is 0010.1164.c801 (bia 0010.1164.c801)
 BW 100000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Half-duplex, 100Mb/s
  input flow-control is off, output flow-control is off
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:08, output 00:00:05, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue :0/40 (size/max)
  5 minute input rate 0 bits/sec, 0 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     956 packets input, 193351 bytes, 0 no buffer
     Received 956 broadcasts, 0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
     0 watchdog, 0 multicast, 0 pause input
     0 input packets with dribble condition detected
     2357 packets output, 263570 bytes, 0 underruns
     0 output errors, 0 collisions, 10 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier
     0 output buffer failures, 0 output buffers swapped out
SwitchA#

10.檢查交換機 MAC 地址表的內容。

SwitchA#show mac-address-table
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----

   1    0090.2be9.84d2    DYNAMIC     Fa0/1

六. 實驗總結
1 .交換機基本配置與路由器基本配置有什麼異同?哪些命令相同,哪些命令不同?
熟悉路由器和交換機基本配置的異同之處。
2 .一般來說對於同網段的交換機管理時對交換機配置一個管理性 IP 地址就可以了,當要從一個
交換機跨網段管理另一個交換機時需要給交換機配置預設閘道器。