-
2021-06-30 11:20:18
【欢迎关注微信公众号:厦门微思网络】
微思网络(官网):https://www.xmws.cn/
思科交换机基本配置命令
switch>enable 进入特权模式 switch#config terminal 进入全局模式 switch(config)#hostname+xxx 设置主机名 switch(config)#enable password 明文密码 switch(config)#enable secret 密文密码 switch(config)#ip default-gateway 设置网关 switch#show mac-address-table 查看MAC地址 switch(config)#logging synchronous 阻止控制台信息覆盖命令行上的输入 switch(config)#no ip domain-lookup 关闭DNS查看功能 switch(config)#exec-timeout 0 0 阻止会话退出
使用telnet远程式管理
switch(config)#line vty 0 4 进入虚拟终端 switch(config-line)#password xx 设置登录口令 switch(config-line)#login 要求口令验证
控制台口令
switch(config)#line console 0 进入控制台口 switch(config-line)#password xx switch(config-line)# 设置登录口令login 允许登录
cisco发现协议(cdp)
switch(config)#show cdp 显示cisco设备全局配置信息 switch(config)#show cdp interface端口 查看cdp配置下端口信息 switch(config)#show cdp neighbors 显示直连cisco设备信息 switch(config)#show cdp neighbors detail 查看邻居详细信息
思科交换机恢复出厂配置
witch#erase startup-config switch#delete flash: vlan.dat
配置接口标识(区分路由器的各个接口)
switch(config)#interface fastethernet0/1 switch(config)#description this is a fast ethernet port used to connecting the company's intranet!
vtp配置
switch(config)#vtp domain 设置VTP域名 switch(config)#vtp password xx 设置VTP密码 switch(config)#vtp mode server/client/transparent 设置VTP服务模式 switch(config)#vtp version 设置VTP版本 switch(config)#vtp pruning 设置VTP修解 vlan基本配置 switch#vlan database 进入vlan配置模式 switch(vlan)#vlan 号码 name 名称 创建vlan及vlan名 switch(vlan)#vlan 号码 mtu 数值 修改MTU大小 switch(vlan)#exit 更新vlan数据并退出 switch#show vlan 查看vlan switch#copy running-config startup-config 保存配置 vlan中添加删除端口 switch#conf t switch(config)#interface fastethernet0/1 进入要分配的端口 switch(config-if)#switchport mode access 定义二层端口 switch(config-if)#switchport access vlan号码 把端口发给一个vlan switch(config-if)#switchport mode trunk 设置为干线 switch(config-if)#switchport trunk encapsulation dotlq 设置vlan中继协议 switch(config-if)#no switchport mode 或 (switchport mode access) 禁用干线 switch(config-if)#switchport trunk allowed vlan add 1,2 从trunk中添加vlans switch(config-if)#switchport trunk allowed vlan remove1,2 从trunk中删除vlan switch(config-if)#switchport trunk pruning vlan remove1,2
配置接口为动态协商模式
switch(config)#interface 接口号 switch(config)#switchport mode dynamic desirable/auto
生成树stp
switch(config)#spanning-tree vlan 启用stp生成树(基于vlan) switch(config)#spanning-tree vlan root primary 指定交换机(基于vlan) switch(config)#spanning-tree vlan root secondary 指定备用根交换机(基于vlan) switch(config)#spanning-tree vlan priority<0-65535> 指定交换机优先继(基于vlan) switch(config)#no spanning-tree vlan priority 将交换机的优先级恢复默认值(基于vlan) switch(config-if)#spanning-tree vlan cost<0-200000000> 指定端口成本(起用trunk的端口模式下) switch(config-if)#spanning-tree vlan port-prioty<0-255> 指定交换机端口优先级(基于vlan) switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机 switch(config)#spanning-tree uplinkfast 配置上行速端口
注:在配置上行速端口前要先将基于vlan上的网桥优先级,网桥成本恢复默认值。起用了该命令后在进行优先级更改。
注:vlan为可选参数,当没有该参数时将修改所有vlan网桥的优先级\及所有的vlan端口成本
switch#show spanning-tree summery 检测vlan生成树配置 switch#show spanning-tree vlan detail 浏览详细生成树配置信息 switch#show spanning-tree interface detail 浏览详细生成树端口配置信息
以太网通道配置
switch(config)#interface range fastemet0/1-2 将fastemet0/1和0/2口捆绑 switch(config-if)#change-group 1 mode on 配置以太通道模式 switch(config-if)#port-channel load-batance{dst-mac|src-mac}在链路间实现负载均衡 switch#show etherchannel 1 summary 查看通道信息 switch#show etherchannel load-balance 查看通道信息
交换机显示命令
switch#show vtp status 查看vtp配置信息 switch#show running-config 查看当前配置信息 switch#show vlan 查看vlan配置信息 switch#show interface 查看端口信息 switch#show int f0/0 查看指定端口信息 switch#dir flash: 查看闪存 switch#show version 查看当前版本信息 switch#show cdp cisco 设备发现协议(可以查看聆接设备) switch#show cdp traffic 查看接收和发送的cdp包统计信息 switch#show interface f0/1 switchport 查看有关switchport的配置 switch#show cdp neighbors 查看与该设备相邻的cisco设备
CISCO交换机巡检命令
1、
show interface stats
;查看交换机所有接口当前接口流量2、
show running-config
;查看当前设备配置3、
show version
;查看IOS版本信息及设备正常运行时间4、
show clock
;查看设备时钟信息5、
show vtp status
;查看交换机vtp配置模式6、
show vtp password
;查看交换机vtp配置口令7、
show env all
;查看设备温度,电源和风扇运转参数及是否报警8、
show inventory
;调取设备内部板卡出厂模块型号及序列号9、
show spanning-tree root
;查看交换机生成树根位置10、
show cdp neighbors
;查看邻接cisco设备基本信息11、
show cdp neighbors detail
;查看邻接cisco设备详细信息12、
show interface status
;查看交换机接口状态是否存在errordisable接口disable接口13、show interface summary` ;查看交换机所有接口当前接口流量
14、
show interface | i errors|FastEthernet|GigabitEthernet
;查看接口是否存在大量input或output errors包错误15、
show processes cpu
;查看设备cpu负载16、
show processes mem
;查看设备mem负载17、
show access-list
;查看访问控制列表配置及匹配数据包数量18、
show logging
;查看本机内部日志记录情况19、
show ip route
;查看路由表20、
show firewall
;检查防火墙的工作模式21、
show conn count
;检查防火墙并发数22、
show xlate count
;检查防火墙nat工作状态更多相关内容 -
思科交换机配置命令大全.pdf
2020-08-21 11:38:04思科交换机配置命令大全switch> 用户模式 1:进入特权模式enable switch> enable switch# 2:进入全局配置模式configure terminal switch> enable switch#c onfigure terminal switch(conf)# 3:交换机命名hostname... -
思科交换机配置命令大全.docx
2021-08-09 08:52:10思科交换机配置命令大全 -
思科交换机查看配置及日常维护命令
2014-09-12 08:47:20思科交换机查看配置及日常维护命令,方便日常维护查询 -
思科交换机配置命令大全,交换机配置案例详解
2021-12-18 12:19:34一、思科交换机基本配置命令 1:进入特权模式 enable switch> enable switch# 2:进入全局配置模式 configure terminal switch> enable switch#c onfigure terminal switch(conf)# 3:交换机命名 ...一、思科交换机基本配置命令
1:进入特权模式 enable
switch> enable
switch#
2:进入全局配置模式 configure terminal
switch> enable
switch#c onfigure terminal
switch(conf)#
3:交换机命名 hostname aptech2950 以 aptech2950 为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch-2950
aptech2950(conf)#
4:配置使能口令 enable password cisco 以 cisco 为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# enable password cisco
5:配置使能密码 enable secret ciscolab 以 cicsolab 为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# enable secret ciscolab
6:创建多个vlan
1、创建多个VLAN
Switch>enable (进入特权模式)
Switch#vlan data (进入vlan配置模式)
Switch(vlan)#vlan 10 name IT (划分vlan10,名称为IT)
Switch(vlan)#vlan 20 name HR (划分vlan20,名称为HR)
Switch(vlan)#vlan 30 name FIN (划分vlan30,名称为FIN)
Switch(vlan)#vlan 40 name LOG (划分vlan40,名称为LOG)
Switch(vlan)#exit
7:设置 vlan 1
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# interface vlan 1
aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口 ip 和子网掩码
aptech2950(conf-if)#no shut 是配置处于运行中
aptech2950(conf-if)#exit
aptech2950(conf)#ip default-gateway 192.168.254 设置网关地址
8:进入交换机某一端口 interface fastehernet 0/17 以 17 端口为例
switch> enable
switch#c onfigure terminal
switch(conf)#hostname aptch2950
aptech2950(conf)# interface fastehernet 0/17
aptech2950(conf-if)#
9:查看命令 show
switch> enable
switch# show version 察看系统中的所有版本信息
show interface vlan 1 查看交换机有关 ip 协议的配置信息
show running-configure 查看交换机当前起作用的配置信息
show interface fastethernet 0/1 察看交换机 1 接口具体配置和统计信息
show mac-address-table 查看 mac 地址表
show mac-address-table aging-time 查看 mac 地址表自动老化时间
10:交换机恢复出厂默认恢复命令
switch> enable
switch# erase startup-configure
switch# reload
11:双工模式设置
switch> enable
switch#c onfigure terminal
switch2950(conf)#hostname aptch-2950
aptech2950(conf)# interface fastehernet 0/17 以 17 端口为例
aptech2950(conf-if)#duplex full/half/auto 有 full , half, auto 三个可选
项
11:cdp 相关命令
switch> enable
switch# show cdp 查看设备的 cdp 全局配置信息
show cdp interface fastethernet 0/17 查看 17 端口的 cdp 配置信息
show cdp traffic 查看有关 cdp 包的统计信息
show cdp nerghbors 列出与设备相连的 cisco 设备
12:交换机 telnet 远程登录设置:
switch>en
switch#c onfigure terminal
switch(conf)#hostname aptech-2950
aptech2950(conf)#enable password cisco 以 cisco 为特权模式密码
aptech2950(conf)#interface fastethernet 0/1 以 17 端口为 telnet 远程登录端口
aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0
aptech2950(conf-if)#no shut
aptech2950(conf-if)#exit
aptech2950(conf)line vty 0 4 设置 0-4 个用户可以 telnet 远程登陆
aptech2950(conf-line)#login
aptech2950(conf-line)#password edge 以 edge 为远程登录的用户密码
主机设置:
ip 192.168.1.2 主机的 ip 必须和交换机端口的地址在同一网络
段
netmask 255.255.255.0
gate-way 192.168.1.1 网关地址是交换机端口地址
运行:
telnet 192.168.1.1
进入 telnet 远程登录界面
password : edge
aptech2950>en
password: cisco
aptech#
二、利用三层交换机,实现不同vlan间互相通信
上面我们了解了思科交换机的基本配置命令,下面我们来看下配置案例。
案例如下:
pc1与pc2由于阻绝在了两个不同的交换机里,且在 不同的vlan中 ,是无法通信的,那怎么办呢?
S3550-24(三层交换机)1台、S2126交换机1台、pc1在vlan10里,pc2在vlan20里,如下图所示。
VLAN间通信实验拓扑结构图
配置如下:
1、在交换机SwitchA上创建VLAN 20,并将F0/15口划分到VLAN 20中。
SwitchA>enable
SwitchA#configure terminal
SwitchA(config)#vlan20 //创建VLAN 20
SwitchA(config-vlan)#name vlan20 //将VLAN 20 命名为vlan20
SwitchA(config)#interface f0/15 //进入F0/15接口配置模式
SwitchA(config-if)#switchport access vlan 20 //将F0/15端口划入VLAN 20
SwitchA #showvlan id 20 //验证已创建了VLAN 20并已将F0/15端口划入VLAN 20中。
2、在交换机SwitchA上与SwitchB相连的端口(此处为F0/24端口)定义为tag vlan 模式。
SwitchA>enable
SwitchA#configure terminal
SwitchA (config)#interface f0/24 //进入接口配置模式
SwitchA (config-if)#switchport mode trunk //将F0/24口设置为tag vlan模式
SwitchA (config)#show interfaces f0/24 switch //验证F0/24口已被设置为tag vlan模式
3、在交换机SwitchB上创建VLAN 10,并将F0/5端口划入VLAN 10中。
SwitchA>enable
SwitchA#configure terminal
SwitchB(config)#vlan 10 //创建VLAN 10
SwitchB (config-vlan)#name vlan10 //将VLAN 10 命名为vlan
SwitchB (config)#interface f0/5 //进入F0/5接口配置模式
SwitchB (config-if)#switchport access vlan10 !将F0/5端口划入VLAN 10
SwitchB #show vlan id 10 //验证已创建了VLAN 10并已将F0/5端口划入VLAN 10中
4、在交换机SwitchB上与SwitchA相连的端口(此处为F0/24端口)定义为tag vlan 模式。
SwitchA>enable
SwitchA#configure terminal
SwitchB (config)#interface f0/24 //进入接口配置模式
SwitchB (config-if)#switchport mode trunk //将F0/24口设置为tag vlan模式
SwitchB (c onfig)#show interfaces f0/24 switch //验证F0/24口已被设置为tag vlan模式。
5、设置三层交换机VLAN 间通讯, 开启三层交换机的路由功能
SwitchA>enable
SwitchA#configure terminal
SwitchA(config)#ip routing //开启三层交换机的路由功能
SwitchA(config) #interface vlan 10 //创建虚拟接口vlan10
SwitchA(config-if) #ip address 192.168.10.254 255.255.255.0 //配置vlan10的虚拟接口ip地址
SwitchA(config) #interface vlan 20 //创建虚拟接口vlan20
配置vlan20的虚拟接口ip地址
SwitchA(config-if) #ip address 192.168.20.254 255.255.255.0 //配置vlan20的虚拟接口ip地址
5、配置默认网关
将PC1的默认网关设置为192.168.10.254,将PC2的默认网关设置为192.168.20.254
如此,pc1与pc2便可以相互通。
-
Cisco思科光纤交换机配置说明及常用命令
2020-10-01 13:12:46Cisco思科光纤交换机怎么配置呢?相信很多网友还是不太了解,下面就为大家收集的Cisco思科光纤交换机配置说明教程,一起来看看了解下 -
思科交换机配置命令
2018-06-13 13:41:36思科交换机配置命令(全面经典)!!!!!!!1!!!!! -
思科交换机配置命令(详细命令总结归纳)
2021-09-30 11:48:39二、交换机配置 1、基本命令 2、常用命令 3、交换机恢复出厂配置 4、telnet 远程登录设置 5、交换机VLAN设置 (1)添加,删除 vlan (2)命名vlan (3)将端口加入vlan 6、交换机设置VLAN IP地址 7、Trunk...目录
前言
交换机的配置过程复杂,而且根据品牌及产品的不同配置方法也各不相同,下面主要介绍一下思科交换机的配置方法(包含二层交换机与三层交换机)
一、交换机介绍
交换机分为网管型交换机和非网管型交换机(俗称傻瓜式交换机)
非网管交换机插上网线即可使用,它可以识别数据包中的MAC地址信息, 然后根据MAC地址进行转发, 并将这些MAC地址与对应的端口记录在自己内部的一个地址表中
网管型交换机就是可以根据自己的配置进行网络管理的交换机,网管型交换机常用Console端口对交换机进行配置
二、交换机配置
1、基本命令switch> 用户模式 switch>enable 进入特权模式 switch# 特权模式 switch#config terminal 进入配置模式 switch(config)# 配置模式 switch(config)#enable password abc123 设置特权模式密码为abc123 switch(config)#enable secret abc123 设置特权模式密码为加密的密码abc123 switch(config)#hostname sw1 设置主机名为sw1 sw1(config)# 主机名变为sw1 sw1(config)#end 退回到特权模式 sw1# 特权模式 sw1#exit 退回到上一个模式 sw1> 用户模式
2、常用命令
switch(config)#enable password 密码 配置交换机进入特权模式密码 switch(config)#no enable secret 取消特权模式加密密码 switch#show version 查看系统中的所有版本信息 switch#show ip int b 查看各接口状态 switch#show vlan 10 查看交换机有关vlan10配置信息 switch#show vlan int b 查看交换机所有vlan信息 switch#show running-configure 查看交换机当前起作用的配置信息 switch#show interface fastethernet0/1 查看交换机接口1具体配置和统计信息 switch#show mac-address-table 查看mac地址转发表 switch#write
保存配置信息(写入配置信息) switch#show vtp 查看vtp配置信息 switch#show run 查看当前配置信息 switch#show vlan brief 查看vlan配置信息 switch#show interface brief 查看端口信息 switch#show int f0/0 查看指定端口信息 switch#copy running-config startup-config 保存交换机配置 switch(config-if)#speed 100 设置速率 switch(config-if)#duplex full 设置该端口为全双工,full全双工 half半双工 auto为自动 switch#show ip route 查看是否有路由表,是否开启路由功能 在配置模式中无法使用show命令,如果要使用的话show前必须加do和空格
例:do show ip int b
3、交换机恢复出厂配置
switch> enable switch# erase startup-configure switch# write erase switch# reload 4、telnet 远程登录设置
switch>en switch#configure terminal swich(conf)#enable password abc123 abc123特权模式密码(明文加密) swich(conf)#enable secret abc123 密文加密 swich(conf)#interface vlan 1 以vlan 1端口作为远程登录的接口,其他端口亦可 swich(conf-if)#ip address 192.168.1.1 255.255.255.0 swich(conf-if)#no shut swich(conf-if)#exit swich(conf)line vty 0 4 设置0-4个用户可以telnet 远程登陆 swich(conf-line)#password 123456 swich(conf-line)#login
5、交换机VLAN设置
(1)添加,删除 vlanswitch#vlan database 进入vlan设置 switch(vlan)#vlan 2 建立vlan2 switch(vlan)#no vlan 2 删除vlan 2 (2)命名vlan
switch(config)# valn 2 switch(config-vlan)# name 名字
(3)将端口加入vlanswitch(config)# interface range fastethernet 0/1 - 5 进入同种类型多端口配置 switch(config)#interface range fastethernet 0/1 - 5,gigabitethernet 0/1 - 2 进入不同类型多端口配置 switch(config-if)#switchport access vlan 2 当前端口加入vlan 2 6、交换机设置VLAN IP地址
switch(config)#interface vlan 1 进入vlan 1 switch(config-if)#ip address ip地址 设置IP地址 switch(config-if)#exit switch(config)#ip default-gateway 网关地址 设置交换机默认网关,telnet交换机时可以使用vlan ip地址连接 7、Trunk的配置
switch(config-if)#switchport trunk encap dot1q 设置vlan中继执行的协议 switch(config-if)#switchport mode trunk 将接口设置为中继 switch(config-if)#switchport trunk allowed vlan 1,2 设置允许通过的vlan switch(config-if)#switchport trunk allowed vlan remove vlan号 禁止trunk中某个VLAN的传输
8、以太网通道配置(二层口)switch1(config)#int range f0/1 -2 进入接口f0/1和f0/2 switch1(config-if-range)#channel-group 1 mode on 绑定 switch#show etherchannel summary 查看绑定的接口 9、以太网通道配ip地址(三层口)
switch1(config)#int port-channel 1 switch1(config-if)#ip add ip地址 子网掩码
10、VTP的配置sw1(config)#vtp domain 域名 设置域名 sw1(config)#vtp mode server或client或transparent 设置交换机VTP模式 sw1(config)#vtp password 密码 设置服务器密码,需要同步vtp的交换机需要设相同的密码 VTP修剪
sw1(config)#vtp pruning 启动VTP修剪 sw1(config)#vtp version 2 配置VTP版本,默认1 sw1(config)#switchport trunk pruning vlan remove vlan号 从可修剪列表中去除某VLAN 例:switchport trunk pruning vlan remove 2-4,6,8 sw1#show interface pruning 查看哪些接口以及哪几个vlan被修剪了 sw1#show vtp status 查看vtp配置信息 11、三层交换机配置
(1)配置虚拟接口IP地址switch(config)# interface vlan vlan号 switch(config-if)# ip address ip地址 子网掩码 switch(config-if)# no shutdown
(2)配置物理接口IP地址switch(config)#ip routing 启用路由功能 switch(config)# interface f0/1 switch(config-if)#no switchport 将物理二层接口转换为物理三层接口 switch(config-if)#ip address ip地址 子网掩码 switch(config-if)# no shutdown
(3)配置DHCP中继switch(config)#service dhcp 开启DHCP服务 switch(config-if)#ip helper-address dhcp服务器ip地址
12、STP生成树配置启用stp生成树
switch(config)#spanning-tree vlan vlan号
设置网桥优先级,值小的优先级高
switch(config)#spanning-tree vlan vlan号 priority 32768{默认32768,范围0~65535}
指定根网桥
switch(config)#spanning-tree vlan vlan号 root primary (primary优先级为24576,secondary优先级为28672)
指定端口成本
switch(config-if)#spanning-tree vlan vlan号 cost 成本
指定交换机端口优先级
switch(config-if)#spanning-tree vlan vlan号 port-prioty 优先级 {优先级0~255,默认128}
配置速端口
switch(config-if)#spanning-tree portfast
查看生成树配置信息
switch#show spanning-tree
查看详细生成树配置信息
switch#show spanning-tree vlan detail
查看详细生成树端口配置信息
switch#show spanning-tree interface f0/1 detail
查看某个VLAN生成树配置信息
switch#show spanning-tree vlan vlan号 brief
13、HSRP(热备份)配置
sw1(config)#int vlan 10 sw1(config-if)#ip add 192.168.10.1 255.255.255.0 sw1(config-if)#standby hsrp组号{组号默认0,范围0~255} ip 网段网关地址 配置为hsrp成员 sw1(config-if)#standby hsrp组号 priority 200{默认100,范围0~255} 配置端口优先级 sw1(config-if)#standby hsrp组号 preempt 配置抢占权 sw1(config-if)#standby hsrp组号 track 端口类型 端口号 优先级 配置端口跟踪和减去的优先级 例:sw1(config-if)#standby 10 track fastethernet 1/1 100 sw1#show standby brief 查看hsrp的状态 sw1#show standby 端口类型 端口号 hsrp组号 brief 查看指定端口hsrp的状态 结语
在对交换机进行配置时,如果某个关键词记得不是很清楚,只记得此关键词的开头一个或几个字符,可在输入关键词的开头一个或几个字符后按下Tab键,系统自动会补全关键词,如果某个命令记得不是很清楚,输入命令开头关键词,接着输入问号,系统会列出以该词开头的有关命令 -
cisco交换机常用配置命令
2019-04-11 15:59:07前段时间我们发布了关于学校机房项目交换机的配置,理解这篇,交换机配置不再难,这篇是以思科交换机为配置基础,有部分朋友觉得有些难度,希望我们发些基础些的内容,本期我们就一起来看下思科的基础配置。...前段时间我们发布了关于学校机房项目交换机的配置,理解这篇,交换机配置不再难,这篇是以思科交换机为配置基础,有部分朋友觉得有些难度,希望我们发些基础些的内容,本期我们就一起来看下思科的基础配置。
思科交换机的基本配置
一、基本配置
switch>enable //进入特权模式
switch#config terminal //进入全局配置模式
switch(config)#hostname //设置交换机的主机名
switch(config)#enable secret xxx //设置进入特权MD5加密口令
switch(config)#enable password xxa //设置进入特权明文加密口令
switch(config)#line console 0 //进入控制台口
switch(config-line)#line vty 0 4 //设置进入虚拟终端的连接数目 0~4 5个
switch(config-line)#login //允许登录
switch(config-line)#password xx //设置登录到普通用户口令xx
switch#exit //返回命令
二、交换机vlan的配置
switch#vlan database //进入VLAN设置
switch(vlan)#vlan 2 //建VLAN 2
switch(vlan)#no vlan 2 //删vlan 2
Switch(config)# interface range fastethernet 0/1-5 //进入同种类型多端口配置
三、端口操作
switch(config)#int f0/1 //进入端口1
switch(config-if)#switchport access vlan 2 // 将端口1当前端口加入vlan 2
switch(config-if)#switchport mode trunk //将f0/1设置为中继干线
switch(config-if)#switchport trunk allowed vlan 1,2 //设置允许通过中继的vlan
switch(config-if)#switchport trunk encap dot1q //设置vlan 中继执行的协议
VLAN的端口聚合叫TRUNK,用来在不同的交换机之间进行连接,以保证在跨越多个交换机上建立的同一个VLAN的成员能够相互通讯。
本质上解决同一 vlan 下,不同主机直接互通 ,不需要把交换机的端口一个一个于另一个交换机上的端口对应链接 ,只需要连接一条,并把这条线所在的双方端口都设置成trunk口就可以了
其中 vlan 模式 有三种 trunk , hybrid ,access
Access类型的端口 一般用于连接计算机的端口(非特定 端口);
Trunk类型的端口可以允许多个VLAN通过,可以接收和发送多个VLAN的报文,一般用于交换机之间连接的端口;
dynamic 将端口模式设定为 动态接入模式 ,可trunk可 access
四、设置vtp
switch(config)#vtp domain //设置发vtp域名
switch(config)#vtp password //设置发vtp密码
switch(config)#vtp mode server //设置发vtp模式
switch(config)#vtp mode client //设置发vtp模式
这里要说下,什么是VTP协议。
VTP:是VLAN中继协议,也被称为虚拟局域网干道协议。它是思科私有协议。作用是十几台交换机在企业网中,配置VLAN工作量大,可以使用VTP协议,把一台交换机配置成VTP Server, 其余交换机配置成VTP Client,这样他们可以自动学习到server 上的VLAN 信息。VTP的用途 通常情况下,我们需要在整个园区网或者企业网中的一组的交换机中保持VLAN数据库的同步,以保证所有交换机都能从数据帧中读取相关的VLAN信息进行正确的数据转发,然而对于大型网络来说,可能有成百上千台交换机,而一台交换机上都可能存在几十乃至数百个VLAN,如果仅凭网络工程师手工配置的话是一个非常大的工作量,并且也不利于日后维护——每一次添加修改或删除VLAN都需要在所有的交换机上部署。在这种情况下,我们引入了VTP。
五、交换机设置IP地址:
switch(config)#interface vlan 1 //进入vlan 1
switch(config-if)#ip address //设置IP地址
switch(config)#ip default-gateway //设置默认网关
switch#dir flash: //查看闪存
六、交换机显示命令
switch#write //保存配置信息
switch#show vtp //查看vtp配置信息
switch#show run //查看当前配置信息
switch#show vlan //查看vlan配置信息
switch#show interface //查看端口信息
switch#show int f0/0 //查看指定端口信息
七、交换机配置保存
Switch#show running-config //查看交换机配置
Switch#copy running-config startup-config //保存交换机配置
备注,关于保存的方式:
1、在接口配置模式下使用 do wr 或者是 do copy running-config startup-config
2、在全局配置模式下使用不带do的命令(以上两个)wr或者copy running-config startup-config思科交换机的二层交换机的配置
二层交换机的配置(配置二层交换机可远程管理)
配置如下:
Switch>
Switch>en //进入特权模式
Switch#config //进入全局配置模式
Switch(config)#hostname 2ceng //更改主机名为2ceng
2ceng(config)#interface vlan 1 //进入VLAN 1
2ceng(config-if)#no shut //激活VLAN1
2ceng(config-if)#exit //退出到全局配置模式
2ceng(config)#interface vlan 2 //创建VLAN 2
2ceng(config-if)#no shut //激活VLAN2
2ceng(config-if)#exit //退出到全局配置模式
2ceng(config)#interface vlan 3 //创建VLAN 3
2ceng(config-if)#no shut //激活VLAN3
2ceng(config-if)# ip address 192.168.3.254255.255.255.0 //配置192.168.3.254为2ceng管理IP
2ceng(config-if)#exit //退出到全局配置模式
2ceng(config)#interface range fa0/1-12 //进入到端口1-12
2ceng(config-if-range)#switchport mode access //将1-12口设置为交换口
2ceng(config-if-range)#switch access vlan 1 //将1-12口划分到VLAN 1
2ceng(config-if-range)#exit //退出到全局配置模式
2ceng(config)#interface range fa0/13-23 //进入到端口13-23
2ceng(config-if-range)#switch access vlan 2 //将13-23口划分到VLAN2
2ceng(config-if-range)#exit //退出到全局配置模式
2ceng(config)#interface fastEthernet 0/24 //进入到24口
2ceng(config-if)#switch mode trunk //将24口设置为干线
2ceng(config-if)#exit //退出到全局配置模式
2ceng(config)#enable secret cisco //设置加密的特权密码cisco
2ceng(config)#line vty 0 4 // VTY是路由器的远程登陆的虚拟端口,0 4表示可以同时打开5个会话,line vty 04是进入VTY端口,对VTY端口进行配置,比如说配置密码
2ceng(config-line)#password telnet //设置远程登陆密码为telnet
2ceng(config-line)#login
2ceng(config-line)#exit
2ceng(config)#ip default-gateway 192.168.3.1
2ceng(config)#exit
2ceng#wr //保存配置
Building configuration...
[OK]
转载自 弱电君 弱电行业网
-
思科交换机、路由器配置命令.pdf
2021-10-02 15:36:51思科交换机、路由器配置命令.pdf -
思科交换机基本配置命令.doc
2021-10-11 12:30:19思科交换机基本配置命令.doc -
思科路由器交换机配置命令简写与完整对照表
2014-09-10 20:24:31在写路由过程中不用再记那烦索的命令了,希望对大家有用。 用户模式: 用户模式: Router> Router> 特权模式: 特权模式: Router>en Router>enable Router# Router# 全局配置模式 全局配置模式 Router#conf t Router... -
思科交换机配置命令大全
2021-06-30 19:10:32思科交换机配置命令(陆小马公众号) 简写命令 完整命令 1 用户模式: 用户模式: switch> switch> 2 ... -
思科2960交换机详细配置命令.docx
2021-06-21 09:35:06思科2960交换机配置命令 -
思科交换机配置命令大全 思科交换机配置手册
2020-12-31 10:07:33/用户模式hostname#/特权模式hostname(config)#/全局配置模式hostname(config-if)#/接口状态交换机口令设置:switch>enable/进入特权模式switch#configterminal/进入全局配置模式switch(config)#hostname/设置... -
思科交换机telnet配置
2021-08-16 16:05:01这是拓补图 通过配置S1和S2的vlan1地址实现telnet功能。 为了更好的验证telnet功能pc1、pc3为vlan10。...Switch(config)#hostname S1 //把交换机改名为S1 S1(config)#vlan 10 S1(config-vlan)#exit... -
思科交换机的配置模式基本配置命令
2021-01-28 22:55:47思科交换机的配置模式基本配置命令 打开思科交换CLI,首先进入的是用户模式,如果要进行配置操作需要进入特权模式。 Switch>enable Switch# 从特权模式进入全局配置模式 Switch#configure terminal Switch... -
思科交换机基本配置命令全集-mtu值怎么设置
2020-12-31 07:44:06基本配置命令Switch>enable 进入特权模式Switch #config terminal 进入全局配置模式Switch(config)#hostname 设置交换机的主机名Switch(config)#enable password 进入特权模式的密码(明文形式保存)Switch(config)... -
思科交换机配置常用命令.doc
2021-10-12 19:41:16思科交换机配置常用命令.doc -
@思科交换机snmp配置 开启snmp
2022-03-18 11:55:41文章目录思科交换机开启snmp1.登录交换机2.配置snmp3.案列4.远程测试walk 思科交换机开启snmp 1.登录交换机 网络管理和网络监控,都需要开启snmp功能,首先需要通过telnet交换机之后,通过命令的方式加以操作,可能... -
Cisco交换机Trunk配置命令是什么?
2020-12-28 20:22:40展开全部TRUNK(端口636f707962616964757a686964616f31333431356633汇聚)是端口汇聚的意思,就是通过配置软件的设置,将2个或多个物理端口组合在一起成为一条逻辑的路径从而增加在交换机和网络节点之间的带宽,将属于... -
交换机路由器命令自动配置小工具v1.0
2022-03-24 16:12:36交换机路由器命令自动配置小工具 支持华为、华三、思科的交换机、路由器命令自动配置 配置自动保存txt文件到当前config目录 目前仅支持SSH单线程 -
思科交换机配置基础 Cisco 2960-24
2022-03-14 12:42:42Cisco 2960-24配置命令及验证过程 -
思科交换机配置命令.docx
2021-09-27 08:24:23思科交换机配置命令.docx -
思科交换机配置命令.doc
2021-09-06 16:07:59思科交换机配置命令