总结:华为、H3C、锐捷三家交换机配置命令详解( 八 )


portant; word-wrap: break-word !important; font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; background-color: rgb(0, 0, 0); color: rgb(255, 255, 255); overflow-wrap: break-word !important;">4、聚合端口的创建
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">(config)# interface aggregateport 1 //创建聚合接口AG1(config-if)# switchport mode trunk //配置并保证AG1为 trunk 模式(config)#int f0/23-24(config-if-range)#port-group 1 //将端口(端口组)划入聚合端口AG1中
portant; word-wrap: break-word !important; font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; background-color: rgb(0, 0, 0); color: rgb(255, 255, 255); overflow-wrap: break-word !important;">5、生成树
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">配置多生成树协议:
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">switch(config)#spanning-tree//开启生成树协议
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">switch(config)#spanning-tree mst configuration //建立多生成树协议switch(config-mst)#name ruijie//命名为ruijieswitch(config-mst)#revision 1//设定校订本为1switch(config-mst)#instance 0 vlan 10,20 //建立实例0switch(config-mst)#instance 1 vlan 30,40 //建立实例1switch(config)#spanning-tree mst 0 priority 4096 //设置优先级为4096switch(config)#spanning-tree mst 1 priority 8192 //设置优先级为8192switch(config)#interface vlan 10switch(config-if)#vrrp 1 ip 192.168.10.1 //此为vlan 10的IP地址switch(config)#interface vlan 20switch(config-if)#vrrp 1 ip 192.168.20.1 //此为vlan 20的IP地址switch(config)#interface vlan 30switch(config-if)#vrrp 2 ip 192.168.30.1 //此为vlan 30的IP地址(另一三层交换机)switch(config)#interface vlan 40switch(config-if)#vrrp 2 ip 192.168.40.1 //此为vlan 40的IP地址(另一三层交换机)
portant; word-wrap: break-word !important; font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; background-color: rgb(0, 0, 0); color: rgb(255, 255, 255); overflow-wrap: break-word !important;">6、VLAN的基本配置
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">(config)#vlan 10//创建VLAN10(config-vlan)#name vlanname// 命名VLAN为vlanname(config-if)#switchport access vlan 10//将该端口划入VLAN10中某端口的接口配置模式下进行(config)#interface vlan 10//进入VLAN 10的虚拟端口配置模式(config-if)# ip address 192.168.1.1 255.255.255.0//为VLAN10的虚拟端口配置IP及掩码,二层交换机只能配置一个IP,此IP是作为治理IP使用,例如,使用Telnet的方式登录的IP地址(config-if)# no shutdown//启用该端口
portant; word-wrap: break-word !important; font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; background-color: rgb(0, 0, 0); color: rgb(255, 255, 255); overflow-wrap: break-word !important;">7、端口安全
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">(config)# interface fastethernet 0/1 //进入一个端口(config-if)# switchport port-security //开启该端口的安全功能
portant; word-wrap: break-word !important; font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; color: rgb(217, 33, 66); overflow-wrap: break-word !important;">a、配置最大连接数限制
portant; word-wrap: break-word !important; color: rgb(62, 62, 62); font-family: Optima-Regular, PingFangTC-light; font-size: 15px; letter-spacing: 0.544px; text-indent: 34px; widows: 1; overflow-wrap: break-word !important;">(config-if)# switchport port-secruity maxmum 1//配置端口的最大连接数为1,最大连接数为128(config-if)# switchport port-secruity violation shutdown //配置安全违例的处理方式为shutdown,可选为protect (当安全地址数满后,将未知名地址丢弃)、restrict(当违例时,发送一个Trap通知)、shutdown(当违例时将端口关闭,并发送Trap通知,可在全局模式下用errdisable recovery来恢复)