一.实验目的:
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 地址就可以了,当要从一个
交换机跨网段管理另一个交换机时需要给交换机配置默认网关。