用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

柯侧耳倾听者    -  云代码空间

—— 翱翔在Java世界的海洋之上

交换机的基本配置

2017-12-21|1276阅||

摘要: 交换机的基本配置 一、实验目的与要求 掌握交换机命令行各种操作模式的区别,能够使用各种帮助信息以及用命令对交换机进行基本的配置。 要求搭建好实验拓扑,完成全部实验操作,撰写实验报告。 二、实验原理 交换机的管理方式基本分为两种:带内管理和带外管理。

 交换机的基本配置

一、实验目的与要求

掌握交换机命令行各种操作模式的区别,能够使用各种帮助信息以及用命令对交换机进行基本的配置。

要求搭建好实验拓扑,完成全部实验操作,撰写实验报告。

二、实验原理

交换机的管理方式基本分为两种:带内管理和带外管理。通过交换机的Console口管理交换机属于带外管理,不占用交换机的网络接口,其特点是需要使用配置线缆,近距离配置。第一次配置交换机时必须利用Console端口进行配置。

交换机的命令行操作模式,主要包括:用户模式、特权模式、全局配置模式、端口模式等几种。

1)用户模式进入交换机后得到的第一个操作模式,该模式下可以简单查看交换机的软、硬件版本信息,并进行简单的测试。用户模式提示符为switch>

2)特权模式由用户模式进入的下一级模式,该模式下可以对交换机的配置文件进行管理,查看交换机的配置信息,进行网络的测试和调试等。特权模式提示符为switch#

3)全局配置模式属于特权模式的下一级模式,该模式下可以配置交换机的全局性参数(如主机名、登录信息等)。在该模式下可以进入下一级的配置模式,对交换机具体的功能进行配置。全局模式提示符为switch(config)#

4)端口模式属于全局模式的下一级模式,该模式下可以对交换机的端口进行参数配置。端口模式提示符为switch(config-if)#

Packet Tracher介绍:(1)Packet Tracer 是Cisco 公司针对CCNA认证开发的一个用来设计、配置和故障排除网络的模拟软件。

2)Packer Tracer模拟器软件比Boson 功能强大,比Dynamips 操作简单,非常适合网络设备初学者使用。

交换机的基本操作命令包括: 

Exit命令是退回到上一级操作模式。

End命令是指用户从特权模式以下级别直接返回到特权模式。

交换机命令行支持获取帮助信息、命令的简写、命令的自动补齐、快捷键功能。

配置交换机的设备名称和配置交换机的描述信息必须在全局配置模式下执行。

Hostname配置交换机的设备名称。

当用户登录交换机时,你可能需要告诉用户一些必要的信息。你可以通过设置标题来达到这个目的。你可以创建两种类型的标题:每日通知和登录标题。

Banner motd配置交换机每日提示信息motd message of the day。

Banner login配置交换机登录提示信息,位于每日提示信息之后。

查看交换机的系统和配置信息命令要在特权模式下执行。

a) Show version查看交换机的版本信息,可以查看到交换机的硬件版本信息和软件版本信息,用于进行交换机操作系统升级时的依据。

b) Show mac-address-table查看交换机当前的MAC地址表信息。

c) Show running-config查看交换机当前生效的配置信息。

三、预习与准备

预习交换机的命令行界面和基本操作相关知识点。

准备好实验设备:三层交换机1台,PC机一台。

四、实验内容及步骤

1、背景描述:你是某公司新进的网管,公司要求你熟悉网络产品,公司采用全系列锐捷网络产品,首先要求你登录交换机,了解、掌握交换机的命令行操作技巧,以及如何使用一些基本命令进行配置。

2、需求分析:需要在交换机上熟悉各种不同的配置模式以及如何在配置模式间切换,使用命令进行基本的配置,并熟悉命令行界面的操作技巧。

3、实验拓扑

 

1.1 实验拓扑图

4、实验步骤

第一步:交换机各个操作模式直接的切换

Swtich>enable

 !使用enable命令从用户模式进入特权模式

Swtich#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

 !使用configure terminal命令从特权模式进入全局配置模式

Swtich(config)#interface fastEthernet 0/1

 !使用interface命令进入接口配置模式

Swtich(config-if)#

Swtich(config-if)#exit

 !使用exit命令退回上一级操作模式

Swtich(config)#interface fastEthernet 0/2

Swtich(config-if)#end

Swtich#

 !使用end命令直接退回特权模式

第二步:交换机命令行界面基本功能

Switch> ?

 !显示当前模式下所有可执行的命令 

disable Turn off privileged commands

enable Turn on privileged commands

exit Exit from the EXEC

help Description of the interactive help system

ping Send echo messages

rcommand Run command on remote switch

show Show running system information

telnet Open a telnet connection

traceroute Trace route to destination

Swtich>en <tab>

Swtich>enable

 !使用tab键补齐命令

Swtich#con?

configure connect

 !使用?显示当前模式下所有以“con”开头的命令

Swtich#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Swtich(config)#

 !使用命令的简写

Swtich(config)#interface ? 

 !显示interface命令后可执行的参数 

Aggregateport Aggregate port interface

Dialer Dialer interface

FastEthernet Fast IEEE 802.3

GigabitEthernet Gbyte Ethernet interface

Loopback Loopback interface

Multilink Multilink-group interface

Null Null interface

Tunnel Tunnel interface

Virtual-ppp Virtual PPP interface

Virtual-template Virtual Template interface

Vlan Vlan interface

range Interface range command

Switch(config)#interface

Swtich(config)#interface fastEthernet 0/1

Switch(config-if)# ^Z

Switch#

 !使用快捷键“Ctrl+Z”可以直接退回到特权模式

Switch#ping 1.1.1.1

sending 5, 100-byte ICMP Echos to 1.1.1.1,

timeout is 2000 milliseconds.

. ^C

Switch#

 !在交换机特权模式下执行ping 1.1.1.1命令,发现不能ping通目标地址,交换机默认情况下需要发送5个数据包,如不想等到5个数据包均不能ping通目标地址的反馈出现,可在数据包未发出5个之前通过执行快捷键“Ctrl+C”终止当前操作。

第三步:配置交换机的名称和每日提示信息

Switch(config)#hostname SW-1

 !使用hostname命令更改交换机的名称

SW-1(config)#banner motd $

 !使用banner命令设置交换机的每日提示信息,参数motd指定以哪个字符为信息的结束符

Enter TEXT message. End with the character '$'.

Welcome to SW-1, if you are admin, you can config it.

If you are not admin, please EXIT!

$

SW-1(config)#

SW-1(config)#exit

SW-1#Nov 25 22:04:01 %SYS-5-CONFIG_I: Configured from console by console

SW-1#exit

SW-1 CON0 is now available

Press RETURN to get started

Welcome to SW-1, if you are admin, you can config it.

If you are not admin, please EXIT!

SW-1>

第四步:配置接口状态

锐捷全系列交换机Fastethernet接口默认情况下是10M/100Mbit/s自适应端口,双工模式也为自适应(端口速率、双工模式可配置)。默认情况下,所有交换机端口均开启。

如果网络中存在一些型号比较旧的主机,还在使用10Mbit/s半双工的网卡,此时为了能够实现主机之间的正常访问,应当在交换机上进行相应的配置,把连接这些主机的交换机端口速率设为10Mbit/s,传输模式设为半双工。

SW-1(config)#interface fastEthernet 0/1

 !进入端口F0/1的配置模式

SW-1(config-if)#speed 10

 !配置端口速率为10M

SW-1(config-if)#duplex half

 !配置端口的双工模式为半双工

SW-1(config-if)#no shutdown

 !开启端口,使端口转发数据。交换机端口默认已经开启。 

SW-1(config-if)#description "This is a Accessport."

 !配置端口的描述信息,可作为提示。

SW-1(config-if)#end

SW-1#Nov 25 22:06:37 %SYS-5-CONFIG_I: Configured from console by console

SW-1#

SW-1#show interface fastEthernet 0/1

Index(dec):1 (hex):1

FastEthernet 0/1 is UP , line protocol is UP

Hardware is marvell FastEthernet

Description: "This is a Accessport."

Interface address is: no ip address

MTU 1500 bytes, BW 10000 Kbit

Encapsulation protocol is Bridge, loopback not set

Keepalive interval is 10 sec , set

Carrier delay is 2 sec

RXload is 1 ,Txload is 1

Queueing strategy: WFQ

Switchport attributes:

interface's description:""This is a Accessport.""

medium-type is copper

lastchange time:329 Day:22 Hour: 5 Minute: 2 Second

Priority is 0

admin duplex mode is Force Half Duplex, oper duplex is Half

admin speed is 10M, oper speed is 10M

flow control admin status is OFF,flow control oper status is OFF

broadcast Storm Control is OFF,multicast Storm Control is OFF,unicast Storm Control is OFF

5 minutes input rate 0 bits/sec, 0 packets/sec

5 minutes output rate 0 bits/sec, 0 packets/sec

0 packets input, 0 bytes, 0 no buffer, 0 dropped

Received 0 broadcasts, 0 runts, 0 giants

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort

0 packets output, 0 bytes, 0 underruns , 0 dropped

0 output errors, 0 collisions, 0 interface resets

SW-1#

如果需要将交换机端口的配置恢复默认值,可以使用default命令。

SW-1(config)#interface fastEthernet 0/1

SW-1(config-if)#default bandwidth

 !恢复端口默认的带宽设置 

SW-1(config-if)#default description

 !取消端口的描述信息

SW-1(config-if)#default duplex

 !恢复端口默认的双工设置 

SW-1(config-if)#end

SW-1#Nov 25 22:11:13 %SYS-5-CONFIG_I: Configured from console by console

SW-1#

SW-1#show interface fastEthernet 0/1

Index(dec):1 (hex):1

FastEthernet 0/1 is UP , line protocol is UP

Hardware is marvell FastEthernet

Interface address is: no ip address

MTU 1500 bytes, BW 100000 Kbit

Encapsulation protocol is Bridge, loopback not set

Keepalive interval is 10 sec , set

Carrier delay is 2 sec

RXload is 1 ,Txload is 1

Queueing strategy: WFQ

Switchport attributes:

interface's description:""

medium-type is copper

lastchange time:329 Day:22 Hour:11 Minute:13 Second

Priority is 0

admin duplex mode is AUTO, oper duplex is Full

admin speed is AUTO, oper speed is 100M

flow control admin status is OFF,flow control oper status is ON

broadcast Storm Control is OFF,multicast Storm Control is OFF,unicast Storm Control is OFF

5 minutes input rate 0 bits/sec, 0 packets/sec

5 minutes output rate 0 bits/sec, 0 packets/sec

0 packets input, 0 bytes, 0 no buffer, 0 dropped

Received 0 broadcasts, 0 runts, 0 giants

0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort

0 packets output, 0 bytes, 0 underruns , 0 dropped

0 output errors, 0 collisions, 0 interface resets

SW-1#

第五步:查看交换机的系统和配置信息

SW-1#show version

 !查看交换机的系统信息 

System description : Ruijie Dual Stack Multi-Layer Switch(S3760-24) By Ruijie Network

 !交换机的描述信息(型号等) 

System start time : 2008-11-25 21:58:44

System hardware version : 1.0

 !设备的硬件版本信息

System software version : RGNOS 10.2.00(2), Release(27932)

 !操作系统版本信息

System boot version : 10.2.27014

System CTRL version : 10.2.24136

System serial number : 0000000000000

SW-1#

SW-1#show running-config

 !查看交换机的配置信息 

Building configuration...

Current configuration : 1279 bytes

!

version RGNOS 10.2.00(2), Release(27932)(Thu Dec 13 10:31:41 CST 2007 -ngcf32)

hostname SW-1

!

vlan 1

!

no service password-encryption

!

interface FastEthernet 0/1

!

interface FastEthernet 0/2

!

interface FastEthernet 0/3

!

interface FastEthernet 0/4

!

interface FastEthernet 0/5

!

interface FastEthernet 0/6

!

interface FastEthernet 0/7

!

interface FastEthernet 0/8

!

interface FastEthernet 0/9

!

interface FastEthernet 0/10

!

interface FastEthernet 0/11

!

interface FastEthernet 0/12

!

interface FastEthernet 0/13

!

interface FastEthernet 0/14

!

interface FastEthernet 0/15

!

interface FastEthernet 0/16

!

interface FastEthernet 0/17

!

interface FastEthernet 0/18

!

interface FastEthernet 0/19

!

interface FastEthernet 0/20

!

interface FastEthernet 0/21

!

interface FastEthernet 0/22

!

interface FastEthernet 0/23

!

interface FastEthernet 0/24

!

interface GigabitEthernet 0/25

!

interface GigabitEthernet 0/26

!

interface GigabitEthernet 0/27

!

interface GigabitEthernet 0/28

!

!

line con 0

line vty 0 4

login

!

!

banner motd ^C

Welcome to SW-1, if you are admin, you can config it.

If you are not admin, please EXIT!

^C

!

end

第六步:保存配置

下面的3条命令都可以保存配置

SW-1#copy running-config startup-config

SW-1#write memory

SW-1#write

【注意事项】

1、命令行操作进行自动补齐或命令简写时,要求所简写的字母必须能够惟一区别该命令。如switch#conf可以代表configure,但switch#co无法代表configure,因为co开头的命令有两个copy和configure,设备无法区别。

2、注意区别每个操作模式下可执行的命令种类。交换机不可以跨模式执行命令。

3、配置设备名称的有效字符是22个字节。

4、配置每日提示信息时,注意终止符不能在描述文本中出现。如果键入结束的终止符后仍然输入字符,则这些字符将被系统丢弃。

5、交换机端口在默认情况下是开启的,AdminStatus是UP状态,如果该端口没有实际连接其他设备,OperStatus是down状态。

6、show running-config查看的是当前生效的配置信息,该信息存储在RAM(随机存储器里),当交换机掉电,重新启动时会重新生成新的配置信息。

5、选做实验内容

现公司新进一台交换机,请你完成以下操作:

1)将交换机的名字配置为switchA

2)将控制台密码设置为123,远程登录密码设置为456,特权密码设置为789,并要求在特权密码在配置文件中对密码是加密的;

3)将上面的配置保存在startup-config文件中。

4)查看在用户模式下、特权模式下,可以执行的命令分别有哪些;

5)查看现在生成的配置

 

 

顶 0踩 0收藏
文章评论
    发表评论

    个人资料

    • 昵称: 柯侧耳倾听者
    • 等级: 初级设计师
    • 积分: 2220
    • 代码: 64 个
    • 文章: 64 篇
    • 随想: 5 条
    • 访问: 43 次
    • 关注

    标签

    最新提问

      站长推荐