学习交换机基本配置

上传人:dus****log 文档编号:147107721 上传时间:2022-09-01 格式:DOC 页数:6 大小:37KB
返回 下载 相关 举报
学习交换机基本配置_第1页
第1页 / 共6页
学习交换机基本配置_第2页
第2页 / 共6页
学习交换机基本配置_第3页
第3页 / 共6页
点击查看更多>>
资源描述
一、交换机的基本配置1. 配置enable口令、密码和主机名Switch (用户执行模式提示符)Switchenable (进入特权模式)Switch# (特权模式提示符)Switch#config terminal (进入配置模式)Switch(config)#enable password cisco (设置enable password为cisco)Switch(config)#enable secret cisco1 (设置enable secret为sisco1)Switch(config)#hostname C2950 (设置主机名为C2950)C2950(config)#end (退回到特权模式)C2950#2. 配置交换机IP地址、默认网关、域名和域名服务器C2950(config)# (设置交换机IP)C2950(config)# (设置默认网关)C2950(config)#ip domain-name (设置域名)C2950(config)# (设置域名服务器)C2950(config)#end3. 配置交换机的端口属性C2950(config )#interface fastethernet0/1 (进入接口0/1的配置模式)C2950(config-if)#speed ? (查看speed命令的子命令)C2950(config-if)#speed 100 (设置该端口速率为100Mbps) C2950(config-if)#duplex ? (查看duplex命令的子命令)C2950(config-if)#duplex full (设置该端口为全双工)C2950(config-if)#description TO_PC1 (设置该端口描述为TO_PC1)C2950(config-if)#Z (返回到特权模式,同end)C2950#show interface fastethernet0/1 (查看端口0/1的配置结果)C2950#show interface fastethernet0/1 status (查看端口0/1的状态)4. 配置和查看MAC地址表C2950(config)#mac-address-table ? (查看mac-address-table的子命令)C2950(config)#mac-address-table aging-time 100 (设置超时时间为100s)C2950(config)#mac-address-table permanent 0000.0c01.bbcc f0/3 (加入永久地址)C2950(config)#mac-address-table restricted static 0000.0c02.bbcc f0/3 f0/7 (加入静态地址)C2950(config)#endC2950#show mac-address-table (查看整个MAC地址表) C2950#clear mac-address-table restricted static (清除限制性地址) 二、配置和管理VLAN1. VLAN基础知识VLAN技术:把物理上直接相连的网络从逻辑上划分为多个子网。每一个VLAN对应着一个广播域,处于不同VLAN上的主机不能直接进行通信,不同VLAN之间的通信要引入第三层交换技术才可以解决。VLAN中继(VLAN Trunk)也称为VLAN主干,是指在交换机与交换机或交换机与路由器之间连接的情况下,在互相连接的端口上配置中继模式,使得属于不同VLAN的数据帧都可以通过这条中继链路进行传输。VLAN中继协议(即VTP协议)可以帮助交换机配置VLAN。VTP有三种工作模式:服务器模式、客户模式、透明模式。交换机的初始状态是工作在透明模式。通常虚拟局域网(VLAN)的实现形式有三种:静态端口分配、动态虚拟网、多虚拟网端口配置。2. 配置VTP协议1)配置2950A交换机为服务器模式Switchenable (进入特权模式)Switch#config terminal (进入配置子模式)Switch(config)#hostname 2950A (修改主机名为2950A)2950A(config)#end2950A#2950A#vlan dataBase (进入VLAN配置子模式)2950A(vlan)#vtp ? (查看和VTP配合使用的命令)2950A(vlan)#vtp server (设置本交换机为Server模式)Setting device to VTP SERVER mode.2950A(vlan)#vtp domain vtpserver (设置域名)Changing VTP domain name from NULL to vtpserver.2950A(vlan)#vtp pruning (启动修剪功能)Pruning switched ON2950A(vlan)#exit (退出VLAN配置模式)APPLY completed.Exiting2950A#show vtp status (查看VTP设置信息)2)配置2950B交换机为客户端模式Switch(config)#config terminal (进入配置子模式)Switch(config)#hostname 2950B (修改主机名为2950B)2950B(config)#end2950B#vlan database2950B(vlan)#vtp clientSetting device to VTP CLIENT mode.2950B(vlan)#exit3. 配置VLAN Trunk端口跨交换机的同一VLAN内的数据经过Trunk线路进行交换,默认情况下trunk允许所有的VLAN通过。可以使用switchport trunk allowed vlan remove vlan-list来去掉某一VLAN。可以在交换机2950A和2950B上做如下相同的配置操作。Switch#config terminalSwich(config)#interface f0/24 (进入端口24配置模式)Switch(config-if)#switchport mode trunk (设置当前端口为Trunk模式)Switch(config-if)#switchport trunk allowed vlan all(设置允许从该端口交换数据的VLAN)Switch(config-if)#exitSwitch(config)#exitSwitch#4. 创建VLANVLAN信息可以在服务器模式或透明模式交换机上创建。2950A#vlan dataBase2950A(vlan)#vlan 2 (创建一个VLAN2)VLAN 2 added: Name:VLAN0002 (系统自动命名)2950A(vlan)#vlan 3 name vlan3 (创建一个VLAN3,并命名为vlan3)VLAN 3 added: Name:vlan32950A(vlan)#exit5. 将端口加入到某个VLAN中Switch#config terminalEnter configuration commands,one per line.End with CNTL/Z.Switch(config)#interface f0/9 (进入端口9的配置模式)Switch(config-if)#switchport mode access (设置端口为静态VLAN访问模式)Switch(config-if)#switchport access vlan2 (把端口9分配给相信的VLAN2)Switch(config-if)#exitSwitch(config)#interface f0/10Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan3Switch(config-if)#exitSwitch(config)#exitSwitch#show vlan (查看VLAN配置信息)(结果省略)Switch#三、生成树协议配置生成树协议(STP)的目的是在实现交换机之间冗余连接的同时,避免网络环路的出现,实现网络的高可靠性。当交换机之间有多个VLAN时Trunk线路负载会过重,这时需要设置多个Trunk端口,但这样会形成网络环路,而STP协议便可以解决这一问题。1. 使用STP端口权值实现负载均衡假如用端口f0/23做Trunk1,用端口f0/24做Trunk2,则配置如下。(配置VTP)Switch1#vlan dataBase (进入VLAN配置子模式)Switch1(vlan)#vtp server (设置本交换机为Server模式)Switch1(vlan)#vtp domain vtpserver (设置域名)Switch1(vlan)#exitSwitch1#show vtp status (验证VTP设置信息)(配置Trunk)Switch1#config terminalSwitch1(config)#interface f0/23 (进入端口23配置模式)Switch1(config-if)#switchport mode trunk (设置当前端口为Trunk模式)Switch1(config-if)#exitSwitch1(config)#interface f0/24 (进入端口24配置模式)Switch1(config-if)#switchport mode trunk (设置当前端口为Trunk模式)Switch1(config-if)#endSwitch1#(配置STP权值)Switch1#config terminalSwitch1(config)# interface f0/23 (进入端口23配置模式,Trunk1)Switch1(config-if)#spanning-tree vlan 1 port-priority 10(将VLAN 1的端口权值设为10)Switch1(config-if)#spanning-tree vlan 2 port-priority 10(将VLAN 2的端口权值设为10)Switch1(config-if)#exitSwitch1(config)#interface f0/24 (进入端口24配置模式,Trunk2)Switch1(config-if)#spanning-tree vlan 3 port-priority 10(将VLAN 3的端口权值设为10)Switch1(config-if)#spanning-tree vlan 4 port-priority 10(将VLAN 4的端口权值设为10)Switch1(config-if)#spanning-tree vlan 5 port-priority 10(将VLAN 5的端口权值设为10)Switch1(config-if)#endSwitch1#copy running-config startup-config (保存配置文件)2. 配置STP路径值的负载均衡Switch1#config terminalSwitch1(config)#interface f0/23 (进入端口23配置模式,Trunk1)Switch1(config-if)#spanning-tree vlan 3 cost 30 (设置VLAN 3生成树路径值为30)Switch1(config-if)#spanning-tree vlan 4 cost 30 (设置VLAN 4生成树路径值为30)Switch1(config-if)#spanning-tree vlan 5 cost 30 (设置VLAN 5生成树路径值为30)Switch1(config-if)#exitSwitch1(config)#interface f0/24 (进入端口24配置模式,配置Trunk2)Switch1(config-if)#spanning-tree vlan 1 cost 30 (设置VLAN 1生成树路径值为30)Switch1(config-if)#spanning-tree vlan 2 cost 30 (设置VLAN 2生成树路径值为30)Switch1(config-if)#endSwitch1#
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 工作计划


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!