网络搭建与应用赛项交换机常用命令

针对每个物理接口限制收发数据占用的带宽

bandwidth control+带宽 both端口模式下 

针对每个物理接口限制报文最大收发率

flow control  打开流控功能

rate-violation all 1000

交换机端口的报文最大收包速率则关闭此端口,X分钟后再恢复此端口

rate-violation control shutdown /block recovery X(接口模式下)

block     Block the violation port阻止违规端口

shutdown  Shutdown the violation port关闭违规端口

设置裸光纤通道最大传输单元为x

mtu 1600全局模式下

采用源、目的IP进行实现流量负载分担

load-balance dst-src-ip /dst-src-mac /dst-src-mac-ip

dst-src-ip 目标和源ip地址     

dst-src-mac   目标和源MAC地址

dst-src-mac-ip  目标和源MAC地址、IP地址

接口发生UP/DOWN事件时禁止发送trap消息至上述集团网管服务器

no switchport updown notification enable接口模式下

VPN隔离

ip vrf +名称

int vlan +vlanid

ip vrf forwarding +名称

配置地址

链路聚合

port-group 1

int port-channel 1

switchport mode trunk

int +端口

port-group 1 mode on /active /passive

active活动传输首选项,不考虑合作伙伴

on在添加到端口组时,无论任何条件

passive被动传输首选项,除非伙伴是主动的

SNMP

 v3 版本是一种安全的协议,支持认证和加密过程snmp:简单网络管理协议)

snmp-server enable(启用)

snmp-server engineid+引擎id

snmp-server user DCN2021用户名 DCN authPriv 3des Dcn20212021 auth sha Dcn20212021

配置组的读、写视图分别为:2022_R、D2022_W

snmp-server community ro 2022_R

snmp-server community re 2022_W

ro进行只读访问

re进行读写访问

需要使用本地的环回地址发送Trap消息至集团网管服务器10.60.15.120、2001:10:60:15::120,采用最高安全级别

snmp-server securityip 10.60.15.120指定安全ip 为网关服务器的ip地址

snmp-server securityip 2001:10:60:15::120

snmp-server host 10.60.15.120 v3 authnopriv 2022

snmp-server host 2001:10:60:15::120 v3 authnopriv 2022

snmp-server trap-source 10.60.255.2  指定traps的源ip地址为换回接口        

snmp-server enable traps 启用发送traps

要求禁止配置访问控制列表,实现集团核心交换机SW-3法务业务对应的物理端口间二层流量无法互通

isolate-port group test 创建一个隔离组

isolate-port group test switchport interface ethernet 1/0/3 把法务端口进行隔离

端口安全

每个端口只允许的最大安全MAC 地址数为1,当超过设定MAC地址数量的最大值,不学习新的MAC、丢弃数据包发snmp trap、同时在syslog日志中记录,端口的老化定时器到期后,在老化周期中没有流量的部分表项老化,有流量的部分依旧保留

int +端口

switchport port-security 启用端口安全功能

switchport port-security maximum 1设置学习端口安全数量

switchport port-security violation  restrict  /recovery /shutdown

restrict限制模式,不学习新的mac,丢弃数据包,发snmp trap,同时在syslog日志中记录

recovery触发端口违背动作后,恢复mac学习功能

shutdown关闭模式,默认模式。端口关闭,发snmp trap同事在syslog日志中记录

switchport port-security aging type inactivity 保留流量

配置相关特性实现报文上送设备CPU的前端整体上对攻击报文进行拦截,开启日志记录功能,采样周期10s一次,恢复周期为2分钟,从而保障CPU稳定运行

cpu-protect interval 10   采样率

cpu-protect recovery-time 120  周期更新时间

LLDP

配置所有使能此功能的端口发送更新报文的时间间隔为一分钟、更新报文所携带的老化时间为五分钟,配置租用运营商三条裸光缆通道相关端口使能Trap功能,Trap报文发送间隔为1分钟

Lldp enable    启用LLDP

Lldp tx-interval 60    设置更新间隔

Lldp msgTxHold 5      设置更新老化间隔

lldp trap enable  启用lldp trap   进入端口启用 (每个端口都开启)

Lldp notification interval 60    发送trap间隔为1分钟

集团接入交换机与核心交换机之间的互连接口发送AP&交换机管理VLAN的报文时不携带标签,发送其它VLAN的报文时携带标签,要求禁止采用trunk链路类型

Swichport mode hybrid

switchport hybrid allowed vlan+vlanid tog/untog

tag:用在和端口关联的vlan,携带标签

untag:用在vlan上,不携带标签

设置路径开销值的取值范围为1-65535,BPDU支持在域中传输的最大跳数为7跳;同时不希望每次拓扑改变都清除设备MAC/ARP表,全局限制拓扑改变进行刷新的次数

spanning-tree cost-format {dot1d | dot1t}修改路径开销值的表示方式

spanning-tree max-hop <hop-count>设置 BPDU 支持在 MSTP 域中传输的最大跳数。

spanning-tree tcflush {enable| disable| protect}

disable 表示不因拓扑改变而刷新,protect 表示每 10 秒最多进行一次刷新,以避免拓扑改变攻击造成的过多刷新

Vrrp

Vlan10<创建VLAN10>

Int vlan10<进入VLAN10>

Ip add192.168.10.20255.255.255.0<配置VLANIP>

no shutdown<激活VLAN10>

router vrrp 1<创建VRRP进程号>

virtral ip192.168.10.254<配置虚拟网关>

Priority 150<配置交换机优先级>

Preempt-mode true<配置为抢占模式>

Intvlan 10<置启用的VLAN>

enable<启用VRRP协议>

因集团销售人员较多、同时也为了节约成本,在集团接入交换机下挂两个8口HUB交换机实现销售业务接入集团信息技术部已经为销售业务VLAN分配IP主机位为1-14

am enable

am port

am ip-pool+地址+分配ip数量

集团接入交换机与核心交换机之间的互连采用光纤接口且跨楼层,当发现单向链路后,要求自动地关闭互连端口;发送握手报文时间间隔为5s, 以便对链路连接错误做出更快的响应,如果某端口被关闭,经过30分钟,该端口自动重启

ULDP

uldp enable

uldp recovery-time+时间/s

uldp hello-interval+时间/s

enable     启用uldp     

hello-interval  握手报文间隔
recovery-time  恢复计时器

MSTP

spanning-tree mst configuration 进入mst模式

instance 1 vlan +vlanid

instance 2 vlan +vlanid

spanning-tree mst 1 priority 8192

spanning-tree mst 2priority 4096

端口隔离

isolate-port group 设置隔离组

isolate-port group+组名称 switchport interface+端口

isolate-port apply +(l2/l3/all)隔离流量 l2是指二层流量l3是指三层流量 all指所有流量

show isolate-port group 显示隔离组的配置

Vlan 的应用

vlan+vlan-id 创建vlan,取值范围2-4096 vlan 1默认生成

switchport trunk allowed vlan+vlan-id 配置允许哪些vlan通过

switchport mode (trunk / access / hybrid)

Trunk 允许多个vlan通过(只允许缺省路由发送时不打标签)

Access  为端口只能属于一个 VLAN

Hybrid 允许多个vlan通过(报文发送时不打标签)

switchport interface+端口号(必须进入vlan中实现)

switchport access vlan +vlan-id  将端口加入指定vlan

镜像

monitor session+(1-7)source interface+端口号+rx/tx/both

rx 为镜像源端口接收的流量

tx 为镜像从源端口发出的流量

both 为镜像源端口入和出的流量

monitor session+(1-7)destination interface+端口号

  • 5
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

为啥没名字

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值