学习交换机基本配置_第1页
学习交换机基本配置_第2页
学习交换机基本配置_第3页
学习交换机基本配置_第4页
学习交换机基本配置_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、.一、交换机的基本配置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

2、 (退回到特权模式)C2950#2. 配置交换机IP地址、默认网关、域名和域名服务器C2950(config)#ip address 192.168.1.1 255.255.255.0 (设置交换机IP)C2950(config)#ip default-gateway 192.168.1.254 (设置默认网关)C2950(config)#ip domain-name (设置域名)C2950(config)#ip name-server 200.0.0.1 (设置域名服务器)C2950(config)#end3. 配置交换机的端口属性C2950(config )#interface faste

3、thernet0/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 fa

4、stethernet0/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)

5、#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之间的通信要引入第三层交换技术才可以

6、解决。VLAN中继(VLAN Trunk)也称为VLAN主干,是指在交换机与交换机或交换机与路由器之间连接的情况下,在互相连接的端口上配置中继模式,使得属于不同VLAN的数据帧都可以通过这条中继链路进行传输。VLAN中继协议(即VTP协议)可以帮助交换机配置VLAN。VTP有三种工作模式:服务器模式、客户模式、透明模式。交换机的初始状态是工作在透明模式。通常虚拟局域网(VLAN)的实现形式有三种:静态端口分配、动态虚拟网、多虚拟网端口配置。2. 配置VTP协议1)配置2950A交换机为服务器模式Switchenable (进入特权模式)Switch#config terminal (进入配置子

7、模式)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.2950

8、A(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 d

9、evice 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 trun

10、k (设置当前端口为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,并命名

11、为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分配给相信的VLAN

12、2)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线路负载

13、会过重,这时需要设置多个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#

14、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 termin

15、alSwitch1(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)#spann

16、ing-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 cos

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论