高级交换命令汇总

用来显示debug的详细时间
service timestamps debug datetime msec
加log的时间戳
service timestamps log datetime msec

show debugging
show logging
clear logging

创建vlan
vlan 30
name wg30

show vlan
show vlan brief


共4096个vlan
0,4095保留
1 常规
2---1001常用
1002---1005 其他用途
1025---4094 常用 透明模式用,一般用于语音

show version
show cdp neighbors
clear cdp table

access口接pc机,svi口虚拟口vlan的口,三层接口当路由器口用

将接口划分到vlan
switchport mode access
no switchport ; 将接口改为三层接口
switchport ;将接口改为二层接口

switchport access vlan 30

进入多个接口
interface range f0/2 - 6
interface range f0/7 , f0/11 , f0/14
interface range f0/15 , f0/17 - 20

查看trunk
show interface trunk

n-802.1q  ;n--自动协商

配置trunk
switchport mode trunk
switchport trunk enc  dot1q    ;封装dot1q   
switchport trunk enc  isl  ;封装isl
switchport trunk enc negotitle ;自动协商

分配trunk所承载的valn
在trunk口下
switchport trunk allowed vlan 4,5,6,7
switchport trunk allowed vlan add 8
switchport trunk allowed vlan add 9

trunk状态
on-----trunk
off----access
negotitle---非协商和on连用
desivble---主动协商
auto---接受协商
switchport mode access
switchport mode trunk
switchport mode dynamic desivble
switchport mode dynamic auto

show interface f0/23 sw
show interface f0/23 trunk

vtp mode server
vtp mode tran
vtp mode client
vtp domain cisco
vtp password cisco

show vtp s
show vtp count
show vtp password

vtp ver 1 2 ;1 2 版本切换
vtp pruning ;启用vtp修剪

show flash ;查看flash
delete flash:/vlan.dat ;删除vlan信息

int vlan 10    ;多层交换中的vlan互访
ip add 10.10.10.10 255.255.255.0
int vlan 20
ip add 20.20.20.20 255.255.255.0
ip routing
sh ip route    

stp
过程:
one root bridge per network
one root port per nonroot bridge
one designated port per segment
nondesignated ports are blocked

lowest root BID
lowest path cost to root bridge
lowest sender BID
lowest port ID (sender)

cisco设备默认pvst

show spanning-tree
show span vlan10

span vlan 10   ;启用vlan10的生成树协议
no span vlan 10  ;禁用vlan10生成树协议

sh span inter f0/23  ;查看f0/23下的vlan stp
sh span int f0/23 de  ;查看f0/23下的优先级,ID等
sh span vlan 10 root    ;查看vlan10的根

配置根桥
span vlan 10 prio 4096 的倍数  ;修改BID的优先级
span vlan 10 port 16 的倍数 ;修改接口的优先级,接口下
span vlan 10 cost 3  ;修改cost值,接口下

sh span brige   ;查看桥ID
sh span root   ;查看根ID
sh span de
sh span vlan 10 sum  ;查看stp特性

int range f0/1 - 24  
span portfast   ;将接口改为portfast

show span uplinkfast  ;uplinkfast不能单独使用,会该vlan优先级,直链失效的交换机配置,backbonfast,非直链线路失效

rootguard,根守护,后来的交换机不能代替根
span guard root  ;接口下打,根的所有接口
span uplinkfast  ;全局模式下,所有交换机上配置,核心上配置
span backbonefast ;全局模式下,所有交换机上配置

EC--捆绑
2,4,6,8
PAGP---CISCO私有
LACP---公有
chanel-group 1 mode on ;启用捆绑,在所有需要的接口下,2,4,6,8
int port-chanel 1
no swichthport ;需在单个接口下打开,例 int f0/1 ,no sw
sw access trunk
  
chanel-group 1 mode active ;LACP
chanel-group 1 mode auto ;PAGP
chanel-group 1 mode desirable ;PAGP
chanel-group 1 mode on  ;Ethernet
chanel-group 1 mode passive ;LACP

sh ip int br
sh int port-chanel 1

负载均衡方式:
port-chanel load-balance dst ;基于目的ip
port-chanel load-balance src    ;基于源ip

chanel-proto lacp  ;封装的协议,在接口下
chanel-proto pagp ;封装的协议,在接口下

HSRP OR VRRP 热备份
HSRP
standby 1 ip 192.168.1.1 ;设置虚拟ip,都是接口下命令,接口ip为 192.168.1.2和192.168.1.3
standby 1 priority 110  ;设置优先级,默认为100
standby 1 preempt  ;设置抢回,可选延迟
standby 1 track f0/21    ;设置监视接口,此为监视f0/21接口,如果接口出故障,优先级会适当降低

show standby
show standby br   ;state change 为切换次数

int vlan 100
ip add 100.100.100.100 255.255.255.0
standby 1 ip 100.100.100.1
standby 1 priority 110
standby 1 preempt

VRRP

vrrp 1 ip 192.168.1.1
vrrp 1 priority 110
vrrp 1 preemt   ;VRRP是公共标准,在cisco设备中只有6500支持

端口安全
sh log
switchport mode access     ;命令在接口下,接口必须为access模式
switchport port-sec     ;启用端口安全
switchport port-sec max 20    ;允许最大mac地址数
switchport port-sec mac-add [stichy]   ;添加mac地址,stichy为粘贴
switchport port-sec violation [prot] [res] [shut] ;违反所做动作 prot---丢弃,res---丢弃并记入log,shut---关闭端口
show port-security     ;验证端口安全

802.1x 认证:
aaa new-model    ;启用aaa,在全局模式下
aaa authen dot1x defau [list]  ;创建方式列表
dot1x system-auth-control  ;启用802.1x端口认证

dot1x port-control auto   ;在所需认证的端口下,启用认证

username cisco password cisco

 

SPAN 端口镜像----将某一端口的所有数据帧都复制一份到指定端口

monitor session 1 sour int f0/7  ;全局下,源端口
monitor session 1 dest int f0/5  ;目的端口
no monitor session 1   ;去除span

RSPAN---远程span

A:
inter vlan 20
remote-span
monitor session 1 soure int f0/16 both
monitor session 1 destin remot vlan 20

B:
int vlan 20
remote-span

C:
int vlan 20
remote-span
monitor session 1 source remote vlan 20
monitor session 1 dest inter f0/1  ;vlan 20 为专用vlan

sh remote-vlan    ;rspan的查看命令

VACL---基于vlan的acl

vlan access-map test2 10  ;全局模式下建立vacl,名字test2,序号为10
match ip/mac address [acl号]  ;匹配的ip或mac地址,或为acl
action forward/drop    ;匹配后的动作
      
vlan fiter test2 vlan-list 20  ;全局模式下应用vacl,test2为vacl名,20为vlan号


SSH

hostname r1
ip domain-name wg0604.com
crypto key generate rsa   ;全局模式下,建立SSH的三个前提

line vty 0 4
transport input ssh/telnet
login local    ;设立ssh,login local应用uername cisco   password cisco

sh ssh
sh ip ssh     ;ssh查看命令

ssh timeout 30    
ssh authen 5    ;无法应用,超时和最大认证次数,全局下


组播

PIM-DM

ip multicast-routing ; 全局下启用组播
ip pim dense-mode/sparse-mode/sparse-dense-mode ;PIM模式,在所应用的接口上

PIM-SM

ip multicast-routing  ;全局下启用组播
ip pim sparse-mode  ;应用的接口下启用SM
ip pim rp-address 环回口 ;全局下手工指定rp,指其loopback口地址

ip pim bsr-candidate int 环回口    ;指定cbsr,指其环回口
ip pim rp-candidate 地址 group 组播访问列表  ;指定crp,及其所管理的组播范围
ip pim send-rp-disc scope 阀值(泛洪边界,即TTL值) ;限定rp发送消息的边界
ip pim version 1/2      ;设定版本,默认为2
ip pim bsr-border      ;设定bsr边界


sh ip mroute
sh ip pim interface   ;组播查看命令 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值