思科交换机基础命令

基本配置
S> enable 进入特权模式
S# configure terminal 进入全局配置模式
S(config)# hostname name 改变交换机名称
S(config)# enable password level level_# password 设置用户口令(level_#=1)或特权口令(level_#=15)
S(config)# line console 0 进入控制台接口
S(config-line)# password console_password 接上一条命令,设置控制台口令
S(config)# line vty 0 15 进入虚拟终端
S(config-line)# password telnet_password 接上一条命令,设置Telnet口令
S(config-line)# login 允许Telnet登录
S(config)# enable password|secret privilege_password 配置特权口令(加密或不加密)
S(config)# interface ethernet|fastethernet|gigabitethernet slot_#/port_# 进入接口子配置模式
S(config-if)# [no] shutdown 关闭或启用该接口(默认启用)
S(config)# ip address IP_address sunbet_mask 指定IP地址
S(config)# ip default-gateway router's_IP_address 指定哪台路由器地址为默认网关
S# show running-config 查看当前的配置
S# copy running-config startup-config 将RAM中的当前配置保存到NVRAM中
S> show interface [type slot_#/port_#] 查看所有或指定接口的信息
S> show ip 显示交换机的IP配置(只在1900系列上可用)
S> show version 查看设备信息
S# show ip interface brief 验证IP配置
S(config-if)# speed 10|100|auto 设置接口速率
S(config-if)# duplex auto|full|half 设置接口双工模式
S> show mac-address-table 查看CAM表
S# clear mac-address-table 清除CAM表中的动态条目
1900(config)# mac-address-table permanent MAC_address type [slot_#/]port_# 在CAM表中创建静态条目
2950(config)# mac-address-table static MAC_address vlan VLAN_# interface type [slot_#/] port_# 在CAM表中创建静态条目
1900(config)# mac-address-table restricted static MAC_address source_port list_of_allowed_interface 设置静态端口安全措施
1900(config-if)# port secure 启用粘性学习
1900(config-if)# port secure max-mac-count value 设置粘性学习特性能够学到的地址数量(默认132,取值范围是1-132)
1900(config)# address-violation suspend|ignore|disable 改变安全选项
1900> show mac-address-table security 验证端口安全措施
2950(config)# switchport mode access 定义接口为主机端口而不是中继端口
2950(config)# switchport port-security 启用端口安全措施
2950(config)# switchport port-security maximum value 指定可与此接口相关的设备的最大数量
2950(config)# switchport port-security violation protect|restrict|shutdown 指定出现安全违规时应该发生的事
2950(config)# switchport port-security mac-address MAC_address 指定允许与此接口相关的确切的MAC地址
2950(config)# switchport port-security mac-address sticky 启用粘性学习特性
2950(config)# show port interface type [slot_#/] port_# 验证接口配置
2950(config-if) description name 设置接口描述信息
2950# show buffers 查看系统缓存的大小
1900# copy nvram tftp:// IP_address_of_TFTP_server/ file_name 将配置文件备份到TFTP服务器上
1900# copy tftp:// IP_address_of_TFTP_server/ file_name nvram 从TFTP服务器上恢复配置到NVRAM
1900# delete nvram 删除配置文件
2950# erase startup-config 删除配置文件
3550# show tcam qos TCAM_ID statistics 查看TCAM剩余容量
4000> enable 进入特权模式
4000>(enable) set password 设置用户模式密码
4000>(enable) set enablepass 设置授权密码
4000>(enable) set interface sc0 IP_address mask 配置IP地址
4000>(enable) set port enable|disable slot_#/port_# 启用/禁用接口
4000>(enable) show port [slot_#/port_#] 显示接口信息
4000>(enable) set port name slot_#/port_# name 设置交换机接口描述信息
4000>(enable) set port speed slot_#/port_# 4|10|16|100|auto 设置交换机接口速率
4000>(enable) set port duplex slot_#/port_# full|half 设置交换机接口双工模式
4000>(enable) clear config all 删除NVRAM中的配置信息
4000>(enable) erase all 删除FLASH中的内容
4000>(enable) show flash 显示FLASH中的内容
4000>(enable) show cam [count] dynamic|static|permanent|system [vlan_#] 显示CAM表
VLAN 1900(config)# vtp domain VTP_domain_name 定义交换机域名
1900(config)# vtp server|client|transparent 定义交换机VTP模式(默认服务器)
1900(config)# vtp password VTP_password 配置VTP口令
1900(config)# vtp pruning enable|disable 启用/禁用修剪(默认启用)
1900(config)# vtp trap enable 启用SNMP陷阱(默认启用)
1900# show vtp 验证VTP配置
2950# vtp database 访问VLAN和VTP配置(以下均是在IOS12.1前用,12.1后全是在全局配置模式下)
2950(vlan)# vtp domain VTP_domain_name 定义交换机域名
2950(vlan)# vtp server|client|transparent 定义交换机VTP模式(默认服务器)
2950(vlan)# vtp password VTP_password 配置VTP口令
2950(vlan)# vtp pruning 启用/禁用修剪(默认启用)
2950(config)# snmp-server enable traps vtp 启用SNMP陷阱(默认启用)
2950# show vtp status 检查VTP配置
2950# show vtp counters 显示与VTP消息发送与接收相关的VTP统计信息
1900(config-if)# trunk on|off|desirable|auto 指定中继类型
1900# show trunk A|B 验证接口中继(A是fa0/26,B是fa0/27)
2950(config-if)# switchport mode trunk|dynamic desirable|dynamic auto|nonegotiate 指定中继类型(默认自动协商)
2950(config-if)# switchport trunk native|allowed|pruning vlan VLAN_# 配置中继
2950(config-if)# switchport trunk pruning vlan remove VLAN_# 清除不希望消减的VLAN
2950# show interfaces [type 0/port_#] switchport|trunk 验证接口中继
1900(config)# vlan VLAN_# [name VLAN_name] 创建VLAN
1900(config-if)# vlan-membership static VLAN_# 将该接口静态地分配给一个VLAN
1900# show vlan 验证VLAN
1900# show vlan-membership 查看VLAN成员关系
1900# show spantree [VLAN_#] 查看VLAN的STP信息
2950# vlan database 进入VLAN数据库(ISO12.1前用)
2950(vlan)# vlan VLAN_# [name VLAN_name] 创建VLAN
2950(config)# vlan VLAN_# 进入VLAN数据库(ISO12.1后用)
2950(config-vlan)# name VLAN_name 创建VLAN
2950(config-if)# switchport mode access 指定连接是接入链路连接
2950(config-if)# switchport access vlan VLAN_# 指定VLAN是接入链路连接
4000>(enable) set vlan VLAN_# name VLAN_name 配置VLAN
4000>(enable) set vlan VLAN_# slot_#/port_#-port_# 为VLAN分配端口
4000>(enable) set trunk slot_#/port_# [on|off|desirable|auto|nonegotiate] [VLAN_#] [isl|dot1q|dot10|lane|negotiate] 配置中继
4000>(enable) clear trunk slot_#/port_# VLAN_# 删除VLAN
4000>(enable) show trunk slot_#/port_# 验证中继端口
4000>(enable) set vtp v2 enable 配置VTPv2
4000>(enable) set vtp [domain name] [mode client|server|transparent] [passwd password] [pruning enable|disable] [v2 enable|disable] 设置VTP
4000>(enable) show vtp domain 验证VTP域的信息
4000>(enable) show vtp statistics 显示发出或收到的VTP通告信息的摘要内容
4000>(enable) set vtp pruneeligible VLAN_# 设置VTP消减
4000>(enable) clear vtp pruneeligible VLAN_# 清除不希望消减的VLAN
STP 4000>(enable) set spantree enable|disable VLAN_# 启用/禁用STP(默认启用)
2950(config)# [no] spanning-tree vlan VLAN_# 启用/禁用STP(默认启用)
4000>(enable) show spantree [VLAN_#] 验证STP状态
2950# show spanning-tree 验证STP状态
4000>(enable) set spantree root [secondary] VLAN_# [dia network_diameter] [hello hello_time] 设置主根节点桥、备份节点桥、最大桥数量(2-7)、持续时间(1-10,默认2)
4000>(enable) set spantree portcost slot_#/port_# cost_# 设置端口开销
2950(config-if)# spanning-tree cost cost_# 设置端口开销
4000>(enable) set spantree portpri slot_#/port_# priority_# 设置端口优先级
4000>(enable) set spantree portvlanpri slot_#/port_# priority_# [VLAN_#] 改变VLAN的优先级设置
2950(config-if)# spanning-tree vlan VLAN_# port-priority priority_# 设置端口优先级
4000>(enable) set spantree fwddelay delay_# [VLAN_#] 设置从侦听状态到学习状态再到转发状态的时间间隔(默认15秒,取值范围是4-30秒)
4000>(enable) set spantree hello interval_time [VLAN_#] 设置根节点交换机发送BPDU的时间间隔(默认2秒,取值范围是1-10秒)
4000>(enable) set spantree maxage agingtime [VLAN_#] 设置交换机持有BPDU的时间(默认20秒,取值范围是6-40秒)
2950(config)# spanning-tree vlan VLAN_# forward-time forward_time 设置从侦听状态到学习状态再到转发状态的时间间隔(默认15秒,取值范围是4-30秒)
2950(config)# spanning-tree vlan VLAN_# hello-time hello_time 设置根节点交换机发送BPDU的时间间隔(默认2秒,取值范围是1-10秒)
2950(config)# spanning-tree vlan VLAN_# max-age maxage 设置交换机持有BPDU的时间(默认20秒,取值范围是6-40秒)
4000>(enable) set port channel slot_#/port_# on 建立以太通道集合
4000>(enable) show port capabilities slot_#/port_# 查看端口的配置
4000>(enable) show port channel 验证以太通道集合的配置
2950(config-if)# channel-group group_number mode auto|desirable|on 建立以太通道集合
2950# show etherchannel group_number|brief|detail|load-balance|port|port-channel|summary 验证以太通道集合的配置
4000>(enable) set spantree portfast slot_#/port_# enable 配置PortFast
2950(config-if)# spanning-tree portfast 配置PortFast
4000>(enable) set spantree uplinkfast enable|disable [rate station_update_rate] [all-protocols off|on] 启用/禁用UplinkFast
4000>(enable) show spantree uplinkfast 验证UplinkFast配置
2950(config)# spanning-tree uplinkfast [max_update_rate] 启用/禁用UplinkFast
2950# show spanning-tree uplinkfast 验证UplinkFast配置
4000>(enable) set spantree backbonefast enable|disable 启用/禁用BackboneFast
4000>(enable) show spantree backbonefast 验证BackboneFast配置
2950(config)# spanning-tree backbonefast 启用BackboneFast
虚拟网间路由
2600(config)# interface type slot_#/port_#.subint_number 配置子接口
2600(config-subif)# encapsulation dot1q|isl|sde|tr-isl VLAN_# 配置封装类型
4000>(enable) show module 查看交换机的硬件配置
4000>(enable) session module_# 访问L3SM
L3SM(config-if)# mac-address mac_address 分配MAC地址
MLS 2600(config)# mls rp ip 启动MLS
2600(config-if)# mls rp vtp-domain domain_name 分配路由器接口到VTP域中
2600(config-if)# mls rp vlan-id VLAN_# 向接口分配VLAN
2600(config-if)# mls rp management-interface 指定该接口为管理接口
2600# show mls rp 提供全局MLS信息
2600# show mls rp interface type slot_#/port_# 提供指定接口的MLS信息
2600# show mls rp vtp-domain domain_name 提供VTP域的MLS信息
6500>(enable) set mls enable 在MLS-SE上启动MLS
6500>(enable) set mls include rp_ip_address 告诉交换机哪一个IP地址是正确的
6500>(enable) show mls include 显示外部路由处理器的IP地址列表
6500>(enable) set mls flow [destination|destination-source|full] 告诉MLS交换机要缓存候选数据包的哪些信息
6500>(enable) show mls entry 显示第三层缓存表
6500>(enable) set mls agingtime aging_time 改变缓存的衰老时间(默认256秒,取值范围是8-2032秒中的8的倍数值)
6500>(enable) set mls agingtime fast fast_aging_time pkt_threshold 改变快速衰老周期和数据包门限值
6500>(enable) show mls ip 验证MLS-SE的配置
6500>(enable) clear mls entry [destination IP_address] [source IP_address] [flow protocol] [source_port] [destination_port] [all] 删除所有或指定MLS缓存记录
3550(config)# ip routing 启动IP路由
3550(config)# ip cef 启动CEF
3550(config-if)# no switchport 将第二层接口转换为第三层接口
3550(config-if)# ip route-cache cef 在接口上启动CEF
3550# show ip cef 验证CEF
组播
3640(config)# ip multicast-routing 启动路由器上的组播服务
3640(config-if)# ip pim dense-mode 将接口设置为PIM密集模式
3640(config-if)# ip pim sparse-mode 将接口设置为PIM稀疏模式
3640(config-if)# ip pim sparsed-dense-mode 将接口设置为PIM稀疏-密集模式
3640(config)# ip pim rp-address IP_address group_ACL_# [override] 手工配置RP
3640(config)# ip pim send-rp-announce type slot_#/port_# scope ttl_value group-list ACL_# 通告RP组的分配
3640(config)# ip pim send-rp-discovery scope ttl_value 配置RP映射代理
3640(config-if)# ip multicast ttl-threshold ttl_value 设置TTL门限值
3640(config-if)# ip igmp join-group group_address 加入组播组
3640# show ip mroute 查看组播信息
3640# ping 验证RP之间或其他组播路由器之间的连接
3640# mtrace source_IP_address [destination_IP_address] [group] 组播traceroute
3640(config-if)# ip cgmp 配置CGMP路由器
4000>(enable) set cgmp enable 启动CGMP
4000>(enable) show cgmp statistics 查看CGMP统计信息
4000>(enable) show multicast group cgmp 查看交换机了解到的组播组信息
4000>(enable) set cgmp leave enable 检查由客户端产生的IGMPv2的离开信息
4000>(enable) set igmp enable 启动IGMP
4000>(enable) ip igmp snooping 启动IGMP探听
4000>(enable) set igmp fastleave enable 启动快速离开过程
4000>(enable) show igmp statistics 显示交换机上IGMP探听的状态信息
QoS 2950(config)# wrr-queue cos-map queue_ID cos_value 建立队列
2950(config)# wrr-queue bandwidth bandwidth_value 设置队列门限
2950(config)# class-maps name 定义对信息传输分类时的匹配标准
2950(config-cmap)# match access-group ACL_# 识别被分类的信息传输
2950(config)# policy-map name 确定为接入信息传输所设置的分类标准
2950(config-pmap)# class name
2950(config-pmap-c)# set ip dscp number
2950(config-if)# service-policy input name 对该接口应用策略
3550(config)# mls qos 启动QoS
3550(config-if)# auto qos voip 在接口上启动自动服务质量
3550(config)# priority-list priority_queue_# protocol protocol high|medium|normal|low [list ACL_#] 为优先级队列定义信息流
3550(config)# priority-list priority_queue_# queue-limit limit_# 定义特定优先级队列的最大队列空间
3550(config-if)# priority-group priority_queue_# 向特定输出接口分配优先级队列
3550(config)# queue-list queue_list_# interface type slot_#/port_# queue_number 为一个特定的定制队列定义信息流
3550(config)# queue-list queue_list_# queue queue_number byte-count size_in_bytes [limit number_of_queue] 为特定的定制队列定义队列的最大空间
3550(config-if)# custom-queue-list custom_queue_number 为特定的输出接口分配优先级队列
4840(config)# ip slb serverfarm serverfarm_name 配置SLB冗余
4840(config-slb-sfarm)# real IP_address [port_#] 指定虚拟IP地址
4840(config-slb-sfarm)# inservice 启动服务器
4840(config)# virtual IP_address [network_mask] tcp|udp [port_number|wsp|wsp-wtp|wsp-wtls|wsp-wtp-wtls] [service service_name] 建立虚拟服务器IP地址






1. switch配置命令
(1)模式转换命令
用户模式----特权模式,使用命令"enable"
特权模式----全局配置模式,使用命令"config t"
全局配置模式----接口模式,使用命令"interface+接口类型+接口号"
全局配置模式----线控模式,使用命令"line+接口类型+接口号"
注:
用户模式:查看初始化的信息.
特权模式:查看所有信息、调试、保存配置信息
全局模式:配置所有信息、针对整个路由器或交换机的所有接口
接口模式:针对某一个接口的配置
线控模式:对路由器进行控制的接口配置
(2)配置命令
show running config 显示所有的配置
show versin 显示版本号和寄存器值
shut down 关闭接口
no shutdown 打开接口
ip add +ip地址 配置IP地址
secondary+IP地址 为接口配置第二个IP地址
show interface+接口类型+接口号 查看接口管理性
show controllers interface 查看接口是否有DCE电缆
show history 查看历史记录
show terminal 查看终端记录大小
hostname+主机名 配置路由器或交换机的标识
config memory 修改保存在NVRAM中的启动配置
exec timeout 0 0 设置控制台会话超时为0
service password-encryptin 手工加密所有密码
enable password +密码 配置 明文密码
ena sec +密码 配置密文密码
line vty 0 4/15 进入telnet接口
password +密码 配置telnet密码
line aux 0 进入 AUX接口
password +密码 配置密码
line con 0 进入CON接口
password +密码 配置密码
bandwidth+数字 配置带宽
no ip address 删除已配置的IP地址
show startup config 查看NVRAM中的配置信息
copy run-config atartup config 保存信息到NVRAM
write 保存信息到NVRAM
erase startup-config 清除NVRAM中的配置信息
show ip interface brief 查看接口的谪要信息
banner motd # +信息 + # 配置路由器或交换机的描素信息
description+信息 配置接口听描素信息
vlan database 进入VLAN数据库模式
vlan +vlan号+ 名称 创建VLAN
switchport access vlan +vlan号 为VLAN为配接口
interface vlan +vlan号 进入VLAN接口模式
ip add +ip地址 为VLAN配置管理IP地址
vtp+service/tracsparent/client 配置SW的VTP工作模式
vtp +domain+域名 配置SW的VTP域名
vtp +password +密码 配置SW的密码
switchport mode trunk 启用中继
no vlan +vlan号 删除VLAN
show spamming-tree vlan +vlan号 查看VLA怕生成树议
2. 路由器配置命令
ip route+非直连网段+子网掩码+下一跳地址 配置静态/ 默认路由
show ip route 查看路由表
show protocols 显示出所有的被动路由协议和接口上哪些协议被设置
show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用
的定时器
等信息
router rip 激活 RIP协议
network +直连网段 发布直连网段
interface lookback 0 激活逻辑接口
passive-interface +接口类型+接口号 配置接口为被动模式
debug ip +协议 动态查看路由更新信息
undebug all 关闭所有DEBUG信息
router eigrp +as号 激活EIGRP路由协议
network +网段+子网掩码 发布直连网段
show ip eigrp neighbors 查看邻居表
show ip eigrp topology 查看拓扑表
show ip eigrp traffic 查看发送包数量
router ospf +process-ID 激活 OSPF协议
network+直连网段+area+区域号 发布直连网段
show ip ospf 显示OSPF的进程号和ROUTER-ID
encapsulation+ 封装格式 更改 封装格式
no ip admain-lookup 关闭路由器的域名查找
ip routing 在 三层交换机 上启用路由功能
show user 查看SW的在线用户
clear line +线路号 清除线路
3. 三层交换机 配置命令
配置一组二层端口
configure terminal 进入配置状态
nterface range {port-range} 进入组配置状态
配置三层端口
configure terminal 进入配置状态
interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port-
channel port-channel-number} 进入端口配置状态
no switchport 把物理端口变成三层口
ip address ip_address subnet_mask 配置IP地址和掩码
no shutdown 激活端口
例:
Switch(config)# interface gigabitethernet0/2
Switch(config-if)# no switchport
Switch(config-if)# ip address 192.20.135.21 255.255.255.0
Switch(config-if)# no shutdown
配置VLAN
configure terminal 进入配置状态
vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改
name vlan-name 可选)输入一个VLAN名,如果没有配置VLAN名,缺省的名字是VLAN号前面用0填满
的4位数,如VLAN0004是VLAN4的缺省名字
mtu mtu-size (可选) 改变MTU大小
Switch# configure terminal
Switch(config)# vlan 20
Switch(config-vlan)# name test20
Switch(config-vlan)# end
Switch# vlan database
Switch(vlan)# vlan 20 name test20
Switch(vlan)# exit
将端口分配给一个VLAN
configure terminal 进入配置状态
interface interface-id 进入要分配的端口
switchport mode access 定义二层口
switchport access vlan vlan-id 把端口分配给某一VLAN
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 2
Switch(config-if)# end
Switch#
配置VLAN trunk
configure terminal 进入配置状态
interface interface-Id 进入端口配置状态
switchport trunk encapsulation {isl | dot1q | negotiate}配置trunk封装ISL 或 802.1Q 或
自动协商
switchport mode {dynamic {auto | desirable} | trunk} 配置二层trunk模式。
dynamic auto—自动协商是否成为trunk
dynamic desirable—把端口设置为trunk如果对方端口是trunk, desirable, 配置Native VLAN
(802.1q)
或自动模式,trunk—设置端口为强制的trunk方式,而不理会对方端口是否为trunk
switchport access vlan vlan-id 可选) 指定一个缺省VLAN, 如果此端口不再是trunk
switchport trunk native vlan vlan-id 指定802.1Q native VLAN号
例:
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)# interface fastethernet0/4
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# end
定义TRUNK允许的VLAN
configure terminal子 进入配置状态
interface interface-id 进入端口配置
switchport mode trunk 配置二层口为trunk
switchport trunk allowed vlan {add | all | except | remove} vlan-list可选) 配置trunk允
许的VLAN.使用add, all, except, remove关健字
no switchport trunk allowed vlan 允许所有VLAN通过
Switch(config)# interface fastethernet0/1
Switch(config-if)# switchport trunk allowed vlan remove 2
Switch(config-if)# end
配置Native VLAN(802.1q)
configure terminal 进入配置状态
interface interface-id 进入配置成802.1qtrunk的端口
switchport trunk native vlan vlan-Id 配置native VLAN号
no switchport trunk native vlan 端口配置命令回到缺省的状态
配置基于端口权值的负载均衡
configure terminal 进入Switch 1配置状态
vtp domain domain-name 配置VTP域
vtp mode server 将Switch 1配置成VTP server.
show vtp status 验证VTP的配置
show vlan 验证VLAN
configure terminal 进入配置状态
interface fastethernet 0/1 进入F0/1端口
switchport trunk encapsulation {isl | dot1q | negotiate}配置trunk封装
switchport mode trunk 配置成trunk
show interfaces fastethernet0/1 switchport 验证VLAN配置
按以上步骤对想要负载均衡的接口进行配置
在另一个交换机上进行此配置
show vlan 当trunk已经起来,在switch2上验证已经学到相的vlan配置
configure terminal 在Switch 1上进入配置状态
interface fastethernet0/1 进入要配置的端口
spanning-tree vlan 8 port-priority 10 将端口权值10赋与VLAN 8.
spanning-tree vlan 9 port-priority 10 将端口权值10赋与VLAN 9.
spanning-tree vlan 10 port-priority 10 将端口权值10赋与VLAN 10.
interface fastethernet0/2 进入F0/2
spanning-tree vlan 3 port-priority 10 将端口权值10赋与VLAN 3.
spanning-tree vlan 4 port-priority 10 将端口权值10赋与VLAN 4
spanning-tree vlan 5 port-priority 10 将端口权值10赋与VLAN 5
spanning-tree vlan 6 port-priority 10 将端口权值10赋与VLAN 10
end 退出
show running-config 验证配置
copy running-config startup-config 保存配置
配置STP路径值的负载均衡
Trunk1走VLAN8-10,Trunk2走VLAN2-4
configure terminal 进入 Switch 1配置状态
interface fastethernet 0/1 进入F0/1
switchport trunk encapsulation {isl | dot1q | negotiate}配置封装
switchport mode trunk 配置Trunk,缺省是ISL封装
exit 退回
在F0/2口上重复2-4步骤
exit 退回
show running-config 验证配置
show vlan验证switch1 已经学到Vlan
configure terminal 进入配置状态
interface fastethernet 0/1 进入F0/1
spanning-tree vlan 2 cost 30 设置Vlan2生成树路径值为30
spanning-tree vlan 3 cost 30 设置Vlan3生成树路径值为30
spanning-tree vlan 4 cost 30 设置Vlan4生成树路径值为30
end 退出
在switch1的F0/2上重复9-11步骤设置VLAN8,9,10生成树路径值为30
end 退出
show running-config 验证配置
copy running-config startup-config 保存配置
补充:CISCO命令集——路由选择协议及排障
Router(config)# ip route <目录网络或子网号> [子网掩码] <下一路由器IP地址 | 从本地出口
的地址> [管理距离0~255,默认为1]
(注:静态地址配置)
*ip default-network命令
Router(config)# ip default-network <目标网络号>
(注:配合路由协使用,用其中的一个动态路由号作 默认路由 配置)
Router(config)# ip route 0.0.0.0 0.0.0.0 <下一路由器IP地址 | 从本地出口的地址>
(注:只有一个公网地址时,在出口路由器上的配置)
*内部路由选择协议
*使用router和network命令
Router(config)# router <路由协议rip | igrp | eigrp | ospf | is-is 等> [自主系统号]
Router(config-router)# network <直接相连的要用此路由协议的网络号>
Router(config-router)# network <直接相连的要用此路由协议的网络号>
*路由信息协议RIP
Router(config)# router rip
Router(config-router)# network <直接相连的要用 rip协议 的有类别网络号>
Router# show ip protocols
Router# show ip route
Router# debug ip rip
*内部网关路由协议IGRP
Router(config)# router igrp <自主系统号>
Router(config-router)# network <直接相连的要用igrp协议的有类别网络号>
Router# show ip interface
Router# show ip protocols
Router# show ip route
Router# debug ip rip
*排除网络故障
排除网络故障的一个总体模型
Router# ping <有故障的主机 | 有故障的IP地址>
Router# show ip route
Router# show interface <有故障的接口>
Router# show run
*IP的故故障排除
检查可用的路由
Router# show ip route <有故障的IP地址>
27.4.4 跟踪路由(Tracing the Route)
SUN-A> traceroute <有故障的主机 | 有故障的IP地址>
C:\windows\> winipcfg
C:\windows\> ipconfig
C:\windows\> ipconfig / all
C:\windows\> tracert <有故障的主机 | 有故障的IP地址>
使用扩展的ping来跟踪连接性
Router# ping
*其它可能的故障
一个地址解析(ARP)的故障
Router# show arp
Router# show interface <有故障的接口>
C:\windows\> arp -a
SUN-A> arp –a
验证终端系统的路由表
C:\windows\> netstat –rn
C:\windows\> route –f add 0.0.0.0 mask 0.0.0.0 <需要添加入的网关地址>
C:\windows\> route [–f ] [[print | add | delete | change] [destination] [mask
netmask] [gateway]]
C:\windows\> route add mask <网络掩码> <网关ip地址>
C:\windows\> route delete mask <网络掩码> <网关ip地址>
C:\windows\> nbtstat <相应的参数>
SUN-A> netstat -rn路由器

猜你喜欢

转载自blog.csdn.net/qq_41400351/article/details/80761824