交换机配置
一、电缆连接及终端配置:
PC机的串口1(COM1)----------Console端口
Console端口默认参数:端口速率(9600b/s);数据位(8);奇偶检验(无);停止位(1);流控(无)。
二、交换机的基本配置:
1、配置enable口令和主机名
switch>enable //进入特权模式
switch# //特权模式提示符
switch#config terminal //进入全局配置模式
switch(config)#enable password xxa //设置特权非密口令
switch(config)#enable secret xxx //设置特权加密口令
switch(config)#hostname switch //设置交换机的主机名
switch (config)#end //返回到特权模式
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
switch(config-line)#login ;允许登录
switch(config-line)#password xx ;设置登录口令xx
switch#exit ;返回命令
2、配置交换机IP地址、默认网关、域名、域名服务器
switch (config)#ip address 192.168.1.1 255.255.255.0 //设置交换机IP地址
switch (config)#ip default-gateway 192.168.1.254 //设置默认网关
switch (config)#ip domain-name cisco.com //设置域名
switch (config)#ip name-server 200.0.0.1 //设置域名服务器
3、配置交换机的端口属性
switch (config) # interface fastethernet0/1 //进入接口0/1的配置模式
switch (config-if)# speed ? //查看speed命令的子命令
switch (config-if)# speed 100 //设置该端口速率为100Mb/s
switch (config-if)# dulplex full/half/auto //设置该端口为全双工
switch (config-if)# description TO_PC1 //设置该端口描述为TO_PC1
switch (config-if)#^Z //返回特权模式,同end
switch # show interface fastethernet0/1 //查看端口0/1的配置结果
switch # show interface fastethernet0/1 status //查看端口0/1的状态
3、配置和查看MAC地址表:
switch (config)# mac-address-table? //查看MAC地址表的子命令
switch (config)# mac-address-table aging-time 100 //设置超时是时间为100s
switch (config)# mac-address-table permanent 0000.0c01.cc f0/3 //加入永久地址
switch (config)# mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 //加入静态地址
switch #show mac-address-table 查看整个MAC地址表
switch #clear mac-address-table restricted static 清除限定性地址
三、配置和管理VLAN
1、配置VTP(VLAN Trunking[中继] Protocol)协议
switch # vlan database //进入VLAN配置子模式
switch(vlan) # vtp? //查看和VTP配合任用的命令
switch (vlan)# vtp server/client //设置本交换机为server/client模式(选择一种,如果是client模式可用设置域名和启动修剪功能)
switch (vlan)# vtp domain vtpserver //设置域名
switch (vlan)# vtp pruning //启动修剪功能
switch (vlan)# exit //退出VLAN配置模式
switch# show vtp status //查看VTP设置信息
2、配置VLAN Trunk端口
Switch(config)#interface f0/24 //进入端口24配置模式
Switch(config-if)#switchport mode trunk //设置当前端口为Trunk模式
Switch(config-if)#switchport trunk allowed vlan all //设置允许从该端口交换数据的VLAN
Switch (config)# exit //退出配置模式
2950(config-if)#switchport trunk encapsulation {dot1q | isl | negotiate }(设置TRUNK封装)
3、创建VLAN
switch # vlan database //进入VLAN配置子模式
switch(vlan) # vlan 2 //创建VLAN2,系统将自动命名
switch(vlan) # vlan 3 name vlan3 //创建VLAN3,并命名为vlan3
4、将端口加入到某个VLAN中
Switch(config)#interface f0/9 //进入端口9的配置模式
Switch(config-if)# switchport //mode access //设置端口为静态VLAN访问模式
Switch(config-if)# switchport //access vlan2 //将端口9分配该VLAN2
Switch(config-if)# exit
Switch (config)# exit
Switch# show vlan //查看VLAN配置信息
四、生成树协议STP配置
1、使用STP端口权值实现负载均衡
Switch(config)#interface f0/23
Switch(config-if)# spanning-tree vlan 1 port-priority 10 //将VLAN 1的端口权值设为10
Switch(config-if)# spanning-tree vlan 2 port-priority 10
Switch(config-if)# exit
Switch(config)#interface f0/24
Switch(config-if)# spanning-tree vlan 3 port-priority 10 //将VLAN 3的端口权值设为10
Switch(config-if)# spanning-tree vlan 4 port-priority 10
Switch(config-if)# spanning-tree vlan 5 port-priority 10
Switch(config-if)# end
Switch # copy running-config startup-config //保存配置文件
[Switch (config-if)# spanning-tree vlan 1 2 port-priority 10]
2、配置STP路径值的负载均衡
Switch(config)#interface f0/23
Switch(config-if)# spanning-tree vlan 3 cost 30 //设置VLAN 3生成树路径值为30
Switch(config-if)# spanning-tree vlan 4 cost 30
Switch(config-if)# spanning-tree vlan 5 cost 30
Switch(config-if)# exit
Switch(config)#interface f0/24
Switch(config-if)# spanning-tree vlan 1 cost 30 //设置VLAN 1生成树路径值为30
Switch(config-if)# spanning-tree vlan 2 cost 30
Switch(config-if)# end
[Switch_1(config-if)# spanning-tree vlan 3 4 5 cost 30]
五、其它
1.在基于IOS的交换机上设置远程访问:
switch(config)# interface vlan 1
switch(config-if)# ip address ip-address netmask
switch(config-if)# ip default-gateway ip-address
2.在基于IOS的交换机上启用和浏览CDP信息:
switch(config-if)# cdp enable
switch(config-if)# no cdp enable
为了查看Cisco邻接设备的CDP通告信息:
switch# show cdp interface [type modle/port]
switch# show cdp neighbors [type module/port] [detail]
3.在基于IOS的交换机上设置端口速度:
switch(config-if)# speed{10|100|auto}
4.在基于IOS的交换机上设置以太网的链路模式:
switch(config-if)# duplex {auto|full|half}
PAGE
1
本文档为【交换机配置】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。