交换机基本配置

来源:互联网 发布:three.js开发指南 编辑:程序博客网 时间:2024/05/29 19:51

实验环境


实验步骤

(1)配置主机名和IP地址

R1和R2的配置是为了测试。

Switch>en

Switch#conf t

Switch(config)#ho S1

 

Router>en

Router#conf t

Router(config)#ho R1

R1(config)#int f0/0

R1(config-if)#ip add 192.168.1.1 255.255.255.0

R1(config-if)#no sh

 

Router>en

Router#conf t

Router(config)#ho R2

R2(config)#int f0/0

R2(config-if)#ip add 192.168.1.2255.255.255.0

R2(config-if)#no sh

(2)配置基本安全措施

S1(config)#enable secret cisco

S1(config)#service password-encryption

S1(config)#line vty 0 15

S1(config-line)#password cisco

S1(config-line)#login

S1(config-line)#line console 0

S1(config-line)#password cisco

S1(config-line)#login

(3)接口基本配置

默认交换机接口开启。交换机接口可以配置双工模式及速率。

S1(config)#int f0/1

S1(config-if)#duplex ?

auto Enable AUTO duplex configuration   //自动检测双工的模式

full Force full duplex operation    //全双工

half Force half-duplex operation    //半双工

S1(config-if)#duplex full

S1(config-if)#speed ?   

//配置接口速度。10-10Mbps,100-100Mbps,1000-1000Mbps,auto-自动检测接口速度

10 Force 10 Mbps operation

100 Force 100 Mbps operation

auto Enable AUTO speed configuration

S1(config-if)#speed 100

S1(config-if)#mdix auto

//启用介质检测功能

S1(config-if)#description ?

//在接口上配置描述,相当于注释

LINE Up to 240 characters describing this interface

S1(config-if)#description line ?

<cr>

S1(config-if)#description line toR1

(4)配置管理地址

交换机也可以Telnet。这时候需要在交换机上配置IP地址。配置到vlan接口上。该地址称为管理地址。接在vlan 1上的计算机可以直接Telnet该地址。为了其他网段的计算机也可以Telnet,在交换机上配置了默认网关。

S1(config)#int vlan 1

S1(config-if)#ip add 192.168.1.100 255.255.255.0

S1(config-if)#no sh

S1(config-if)#ip default-gateway192.168.1.254

(5)配置SSH

采用SSH提高Telnet安全性。

S1(config)#ip domain-name ccnpcisco.com

//配置域名,生成密匙时需要

S1(config)#crypto key generate

S1(config)#line vty 0 15

S1(config-line)#login local

//SSH需要用户名和密码。配置用户名和密码放在本地交换机的配置文件中

S1(config-line)#username testsecret cisco

//配置用户名和密码

(6)管理接口的错误条件

交换机的接口遇到错误,比如环路问题,默认关闭接口。管理员需要在故障原因排除后shutdown和no shutdown将接口重新打开。可以配置接口自动关闭的条件和在故障后的自动恢复。

实验调试

S1#show ip int b    //查看接口信息

S1#show mac address-table    //监控MAC地址

S1#clear mac address-table    //清除MAC地址

S1#show int f0/1 switchport    //查看接口

R1#ssh -l test 192.168.1.100   

//从路由器Telnet交换机,需要安装支持SSH的软件,例如secureCRT


0 0
原创粉丝点击