C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 2634|回复: 0

[话题讨论] HUAWEI交换机配置 [复制链接]

军衔等级:

亚星游戏官网-yaxin222  下士

注册:2015-10-30
发表于 2021-6-30 20:57:48 |显示全部楼层
1:配置登录用户,口令等 
<Quidway>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //用户直行模式提示符,用户视图&nbsp;
<Quidway>system-view&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //进入配置视图&nbsp;
[Quidway]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //配置视图(配置密码后必须输入密码才可进入配置视图)&nbsp;
[Quidway] sy sname xxx //设置主机名成为xxx这里使用
[Quidway] aaa&nbsp; //进入aaa认证模式定义用户账户&nbsp;
[Quidway-aaa] local-user wds password cipher wds&nbsp;
[Quidway-aaa] local-user wds level 15&nbsp;
[Quidway-aaa] local-user wds service-type telnet terminal ssh //有时候这个命令是最先可以运&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //行的,上边两个命令像password,level都是定义完vty 的&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // authentication-mode aaa后才出现
[Quidway-aaa] quit&nbsp;
[Quidway] user-interface vty 0 4 //当时很奇怪这个命令就是找不到,最后尝试了几次才能运行&nbsp;
[Quidway-ui-vty0-4]&nbsp; authentication-mode aaa&nbsp;
[Quidway-ui-vty0-4] quit
2:HUAWEIS9303 VLan设置
创建vlan:
<Quidway>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //用户直行模式提示符,用户视图&nbsp;
<Quidway>system-view&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //进入配置视图&nbsp;
[Quidway] vlan 10&nbsp; //创建vlan 10,并进入vlan10配置视图,如果vlan10存在就直接进入vlan10配置视
图&nbsp;
[Quidway-vlan10] quit&nbsp;&nbsp;&nbsp; //回到配置视图&nbsp;
[Quidway] vlan 100&nbsp;&nbsp;&nbsp; //创建vlan 100,并进入vlan100配置视图,如果vlan10存在就直接进入vlan100
配置视图&nbsp;
[Quidway-vlan100] quit&nbsp;&nbsp;&nbsp; //回到配置视图
将端口加入到vlan中:
[Quidway] interface GigabitEthernet2/0/1 (10G光口)&nbsp;
[Quidway- GigabitEthernet2/0/1] port link-type access&nbsp;&nbsp; //定义端口传输模式&nbsp;
[Quidway- GigabitEthernet2/0/1] port default vlan 100&nbsp;&nbsp; //将端口加入vlan100&nbsp;
[Quidway- GigabitEthernet2/0/1] quit
[Quidway] interface GigabitEthernet1/0/0 //进入1号插槽上的第一个千兆网口配置视图中。0代表1号
口&nbsp;
[Quidway- GigabitEthernet1/0/0] port link-type access&nbsp;&nbsp; //定义端口传输模式&nbsp;
[Quidway- GigabitEthernet2/0/1] port default vlan 10&nbsp;&nbsp;&nbsp; //将这个端口加入到vlan10中&nbsp;
[Quidway- GigabitEthernet2/0/1] quit&nbsp;
.&nbsp;
.&nbsp;
.&nbsp;
.
将多个端口加入到VLAN中
<Quidway>system-view&nbsp;
[Quidway]vlan 10&nbsp;
[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29&nbsp; //将0到29号口加入到vlan10中&nbsp;
[Quidway-vlan10]quit
HUAWEI下的这个命令自己现在不知道,找了下答案也没有结果。
3:设置VTP cisco专有的vlan终极协议也成为局域网干道协议,作用是十几台交换机在企业网中,配置
VLAN工作量大,可以使用VTP协议,把一台交换机配置成VTP Server, 其余交换机配置成VTP Client,这样
他们可以自动学习到server 上的VLAN 信息
『配置环境参数』&nbsp;
(1)交换机SwitchA、SwitchB和SwitchC都通过GE接口互连&nbsp;
(2)SwitchB和SwitchC交换机是核心交换机,要求主备。&nbsp;
『组网需求』&nbsp;&nbsp;
要求整个网络运行STP协议&nbsp;
数据配置步骤&nbsp;
(1)【SwitchA交换机配置】&nbsp;
&nbsp; 启动生成树协议: [SwitchA]stp enable&nbsp;
(1)【SwitchB交换机配置】&nbsp;
&nbsp;&nbsp; 启动生成树协议:[SwitchB]stp enable&nbsp;
(3)配置本桥为根桥&nbsp;
&nbsp;&nbsp; [SwitchB]stp root primary&nbsp;&nbsp;
(4)【SwitchC交换机配置】&nbsp;
&nbsp;&nbsp; a 启动生成树协议[SwitchC]stp enable&nbsp;
&nbsp;&nbsp; b 配置本桥为备份根桥[SwitchC]stp root secondary&nbsp;
(5)【SwitchD交换机配置】&nbsp;
&nbsp;&nbsp; a 启动生成树协议[SwitchD]stp enable&nbsp;
【补充说明】&nbsp;
(1)缺省情况下交换机的优先级都是32768,如果想人为指定某一台交换机为根交换机,也可以通过修改优
先级来实现;&nbsp;
(2)缺省情况下打开生成树后,所有端口都会开启生成树协议,请把接PC的端口改为边缘端口模式;&nbsp;
(3)如果要控制某条链路的状态可以通过设置端口的cost值来实现。&nbsp;
测试验证&nbsp;
(1)使用display stp查看交换机STP运行状态&nbsp;
(2)查看端口STP状态display stp interface Ethernet XX是否正确
4:交换机配置IP地址
[Quidway] interface Vlanif100&nbsp; // 进入vlan100接口视图与vlan 100命令进入的地方不同&nbsp;
[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252&nbsp; // 定义vlan100管理IP三层&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 交换网关路由&nbsp;
[Quidway-Vlanif100] quit&nbsp;
[Quidway] interface Vlanif10&nbsp; // 进入vlan10接口视图与vlan 10命令进入的地方不同&nbsp;
[Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 // 定义vlan10管理IP三层&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 交换网关路由&nbsp;
[Quidway-Vlanif10] quit
配置默认网关:&nbsp;
[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默认网关。
5: 交换机保存设置和重置命令
<Quidway>save&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //保存配置信息&nbsp;
<Quidway>reset saved-configuration&nbsp; /重置交换机的配置&nbsp;
<Quidway>reboot&nbsp; //重新启动交换机
6:交换机常用的显示命令
用户视图模式下:
<Quidway>display&nbsp; current-configuration&nbsp; //显示现在交换机正在运行的配置明细&nbsp;
<Quidway>display device&nbsp;&nbsp;&nbsp; //显示S9303各设备状态&nbsp;
<Quidway>display interface ?&nbsp; //显示个端口状态,用?可以查看后边跟的选项&nbsp;
<Quidway>display version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //查看交换机固件版本信息&nbsp;
<Quidway>display vlan ?&nbsp; // 查看vlan的配置信息
7:基于端口的mac地址绑定
系统视图下&nbsp;
am user-bind mac-addr mac地址 ip-addr ip地址 interface 接口类型 接口序号&nbsp;
以太网端口视图下&nbsp;
interface 接口类型 接口序号&nbsp;
am user-bind mac-addr mac地址 ip-addr ip地址
8:配置交换机的snmp功能
[Quidway] snmp-agent community read&nbsp; xx&nbsp;&nbsp;&nbsp;&nbsp; //xx是组织名称,read是以只读模式查看&nbsp;
[Quidway] undo snmp-agent community&nbsp;&nbsp; xx&nbsp;&nbsp; //删除xx组织&nbsp;
[Quidway] display snmp-agent community&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //显示组织名
9:交换机禁ping配置
[Quidway]acl number 3000&nbsp;
[Quidway-acl-adv-3000]rule 1 deny icmp-type echo any&nbsp; //禁止所有网络ping&nbsp;
[Quidway-acl-adv-3000]rule 3 deny icmp source 1.1.1.1 0.0.0.15 destination 2.2.2.2 0&nbsp;&nbsp; 禁止
1.1.1.1到2.2.2.2的icmp包&nbsp;
[Quidway-acl-adv-3000]quit&nbsp;
[Quidway]interface giga1/0/20&nbsp;
[Quidway-GigabitEthernet1/0/20]packet-filter inbound ip-group 3000 rule 1 //将规则在接口下用&nbsp;
[Quidway-GigabitEthernet1/0/20]packet-filter inbound ip-group 3000 rule 3&nbsp; //将规则在接口下
用&nbsp;
[Quidway-GigabitEthernet1/0/20]quit&nbsp;
[Quidway]interface Vlanif 100&nbsp;
[Quidway-Vlanif100]packet-filter inbound ip-group 3000 rule 1 //将规则在接口下用&nbsp;
[Quidway-Vlanif100]quit&nbsp;
[Quidway]interface Vlanif 10&nbsp;
[Quidway-Vlanif10]packet-filter inbound ip-group 3000 rule 1 //将规则在接口下用&nbsp;
[Quidway-Vlanif10]quit
10:恢复交换机出厂设置
<Quidway>reset saved-configuration&nbsp; /重置交换机的配置&nbsp;
11: 实际工作中的一个配置实例&nbsp;
vlan 10&nbsp;
quit&nbsp;
vlan 100&nbsp;
quit&nbsp;
interface XGigabitEthernet2/0/1 (10G光口)&nbsp;
port link-type access&nbsp;&nbsp;
port default vlan 100&nbsp;
quit&nbsp;
interface Vlanif100&nbsp;
ip address 119.187.200.90 255.255.255.252&nbsp;
quit&nbsp;
ip route-static 0.0.0.0 0.0.0.0 119.187.200.89&nbsp;
aaa local-user wds password cipher wds&nbsp;
local-user wds privilege level 15&nbsp;
local-user wds service-type telnet terminal ssh&nbsp;
quit&nbsp;
user-interface vty 0 4&nbsp;&nbsp;
authentication-mode aaa quit&nbsp;
12:端口汇聚实例&nbsp;
(1)交换机SwitchA和SwitchB通过以太网口实现互连。&nbsp;
(2)SwitchA用于互连的端口为e0/1和e0/2,SwitchB用于互连的端口为e0/1和e0/2。&nbsp;
『组网需求』&nbsp;
增加SwitchA的SwitchB的互连链路的带宽,并且能够实现链路备份,使用端口汇聚数据配置步骤&nbsp;
【SwitchA交换机配置】&nbsp;
(1)进入端口E0/1&nbsp;
&nbsp; [SwitchA]interface Ethernet 0/1&nbsp;
(2)汇聚端口必须工作在全双工模式&nbsp;
&nbsp; [SwitchA-Ethernet0/1]duplex full&nbsp;
(3)汇聚的端口速率要求相同,但不能是自适应&nbsp;
&nbsp; [SwitchA-Ethernet0/1]speed 100&nbsp;
(4)进入端口E0/2&nbsp;
&nbsp; [SwitchA]interface Ethernet 0/2&nbsp;
(5)汇聚端口必须工作在全双工模式&nbsp;
&nbsp; [SwitchA-Ethernet0/2]duplex full&nbsp;
(6)汇聚的端口速率要求相同,但不能是自适应&nbsp;
&nbsp; [SwitchA-Ethernet0/2]speed 100&nbsp;
(7)根据源和目的MAC进行端口选择汇聚&nbsp;
&nbsp; [SwitchA]link-aggregation Ethernet 0/1 to Ethernet 0/2 both&nbsp;&nbsp;
【SwitchB交换机配置】&nbsp;
[SwitchB]interface Ethernet 0/1&nbsp;
[SwitchB-Ethernet0/1]duplex full&nbsp;
[SwitchB-Ethernet0/1]speed 100&nbsp;
[SwitchB]interface Ethernet 0/2&nbsp;
[SwitchB-Ethernet0/2]duplex full&nbsp;
[SwitchB-Ethernet0/2]speed 100&nbsp;
[SwitchB]link-aggregation Ethernet 0/1 to Ethernet 0/2 both&nbsp;
【注意】&nbsp;
(1)同一个汇聚组中成员端口的链路类型与主端口的链路类型保持一致,即如果主端口为Trunk端口,&nbsp;
则成员端口也为Trunk端口;如主端口的链路类型改为Access端口,则成员端口的链路类型也变为Access
端口。&nbsp;
(2)不同的产品对端口汇聚时的起始端口号要求各有不同,请对照《操作手册》进行配置。&nbsp;
13:端口镜像配置实例&nbsp;
『环境配置参数』&nbsp;
(1)PC1接在交换机E0/1端口,IP地址1.1.1.1/24&nbsp;
(2)PC2接在交换机E0/2端口,IP地址2.2.2.2/24&nbsp;
(3)E0/24为交换机上行端口&nbsp;
(4)Server接在交换机E0/8端口,该端口作为镜像端口&nbsp;
『组网需求』&nbsp;
(1)通过交换机端口镜像的功能使用server对两台pc的业务报文进行监控。根据Quidway交换机不同型号,
镜像有不同方式进行配置:&nbsp;
基于端口的镜像 ——基于端口的镜像是把被镜像端口的进出数据报文完全拷贝一份到镜像端口,这样来
进行流量观测或者故障定位。&nbsp;
基于流的镜像 ——基于流镜像的交换机针对某些流进行镜像,每个连接都有两个方向的数据流,对于交
换机来说这两个数据流是要分开镜像的。&nbsp;
S2008/S2016/S2026/S2403H/S3026等交换机支撑的都是基于端口的镜像,8016交换机支撑基于端口的镜像&nbsp;
3500/3026E/3026F/3050支撑基于流的镜像,5516/6506/6503/6506R支撑对入端口流量进行镜像数据配置
步骤 以Quidway S3026C为例,通过基于二层流的镜像进行配置:&nbsp;
(1)定义一个ACL&nbsp;
&nbsp;&nbsp; [SwitchA]acl num 200&nbsp;&nbsp;
(2)定义一个规则从E0/1发送至其它所有端口的数据包&nbsp;
&nbsp;&nbsp; [SwitchA]rule 0 permit ingress interface Ethernet0/1 egress&nbsp;
interface Ethernet0/2&nbsp;
(3)定义一个规则从其它所有端口到E0/1端口的数据包&nbsp;
&nbsp;&nbsp; [SwitchA]rule 1 permit ingress interface Ethernet0/2 egress&nbsp;
interface Ethernet0/1&nbsp;
(4)将符合上述ACL的数据包镜像到E0/8&nbsp;
&nbsp;&nbsp; [SwitchA]mirrored-to link-group 200 interface e0/8&nbsp;
14:显示配置命令&nbsp;
显示系统版本信息:display version&nbsp;
显示诊断信息:display diagnostic-information&nbsp;&nbsp;
显示系统当前配置:display current-configuration&nbsp;&nbsp;
显示系统保存配置: display saved-configuration&nbsp;
显示接口信息:display interface&nbsp;
显示路由信息:display ip routing-table&nbsp;
显示VLAN信息:display vlan&nbsp;
显示生成树信息:display stp&nbsp;
显示MAC地址表:display mac-address&nbsp;
显示ARP表信息:display arp&nbsp;
显示系统CPU使用率:display cpu&nbsp;
显示系统内存使用率:display memory&nbsp;
显示系统日志:display log&nbsp;&nbsp;
显示系统时钟:display clock&nbsp;
验证配置正确后,使用保存配置命令:save&nbsp;
删除某条命令,一般使用命令: undo&nbsp;
15:trunk干道配置&nbsp;
『配置环境参数』&nbsp;
(1)SwitchA 端口E0/1属于vlan10,E0/2属于vlan20,E0/3与SwitchB端&nbsp;
口E0/3互连&nbsp;
(2)SwitchB 端口E0/1属于vlan10,E0/2属于vlan20,E0/3与SwitchA端&nbsp;
口E0/3互连&nbsp;
『组网需求』&nbsp;
(1)要求SwitchA的vlan10的PC与SwitchB的vlan10的PC互通&nbsp;
(2)要求SwitchA的vlan20的PC与SwitchB的vlan20的PC互通&nbsp;
数据配置步骤&nbsp;
【SwitchA相关配置】&nbsp;
(1)创建(进入)vlan10&nbsp;
&nbsp; [SwitchA] vlan 10&nbsp;
(2)将E0/1加入到vlan10&nbsp;
&nbsp; [SwitchA-vlan10]port Ethernet 0/1&nbsp;
(3)创建(进入)vlan20&nbsp;
&nbsp; [SwitchA]vlan 20&nbsp;
(4)将E0/2加入到vlan20&nbsp;
&nbsp; [SwitchA-vlan20]port Ethernet 0/2&nbsp;
(5)实际当中一般将上行端口设置成trunk属性,允许vlan透传&nbsp;
&nbsp; [SwitchA-Ethernet0/3]port link-type trunk&nbsp;
(6)允许所有的vlan从E0/3端口透传通过,也可以指定具体的vlan值&nbsp;
&nbsp; [SwitchA-Ethernet0/3]port trunk permit vlan all&nbsp;
【SwitchB相关配置】&nbsp;
(1)创建(进入)vlan10&nbsp;
&nbsp; [SwitchB] vlan 10&nbsp;
(2)将E0/1加入到vlan10&nbsp;
&nbsp; [SwitchB-vlan10]port Ethernet 0/1&nbsp;
(3)创建(进入)vlan20&nbsp;
&nbsp; [SwitchB]vlan 20&nbsp;
(4)将E0/2加入到vlan20&nbsp;
&nbsp; [SwitchB-vlan20]port Ethernet 0/2&nbsp;
(5)实际当中一般将上行端口设置成trunk属性,允许vlan透传&nbsp;
&nbsp; [SwitchB-Ethernet0/3]port link-type trunk&nbsp;
(7)允许所有的vlan从E0/3端口透传通过,也可以指定具体的vlan值&nbsp;
&nbsp; [SwitchB-Ethernet0/3]port trunk permit vlan all&nbsp;
【补充说明】&nbsp;
(1)如果一个端口是trunk端口,则该端口可以属于多个vlan;&nbsp;
(2)缺省情况下trunk端口的PVID为1,可以在端口模式下通过命令port trunk pvid vlan vlanid 来修改
端口的PVID;&nbsp;
(3)如果从trunk转发出去的数据报文的vlan id和端口的PVID一致,则该报文的VLAN信息会被剥去,这点
在配置trunk端口时需要注意。&nbsp;
(4)一台交换机上如果已经设置了某个端口为hybrid端口,则不可以再把另外的端口设置为trunk端口。&nbsp;
(5)一般情况下最好指定端口允许通过哪些具体的VLAN,不要设置允许所有的VLAN通过。&nbsp;
测试验证&nbsp;
(1)SwitchA vlan10内的PC可以与SwitchB vlan10内的PC互通&nbsp;
(2)SwitchA vlan20内的PC可以与SwitchB vlan20内的PC互通&nbsp;
(3)SwitchA vlan10内的PC不能与SwitchB vlan20内的PC互通&nbsp;
(4)SwitchA vlan20内的PC不能与SwitchB vlan10内的PC互通

举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-24 17:38 , Processed in 0.301851 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图