华为交换机配置 一时失言乱红尘 2022-05-22 11:46 739阅读 0赞 在部署云环境中,需要配置交换机,现在总结自己学习到交换机的知识。 # 0 关于Trunk、Hybrid、Access、Tag、Untag、Pvid的关系 # ## 一、相关定义 ## 1、Trunk口 Trunk口上可以同时传送多个VLAN的包,一般用于交换机之间的链接。 2、Hybrid口 Hybrid口上可以同时传送多个VLAN的包,一般用于交换机之间的链接或交换机于服务器的链 接。 3、Access口 Access口只能属于1个VLAN,一般用于连接计算机的端口。 4、Tag和Untag tag是指vlan的标签,即vlan的id,用于指名数据包属于那个vlan,untag指数据包不属于任何vlan,没有vlan标记。 5、pvid PVID为Port-base Vlan ID,也就是端口的[虚拟局域网][Link 1]ID号, 即端口vlan id号,是非标记端口的vlan id 设定,当非标记数据包进入交换机,交换机将检查vlan设定并决定是否进行转发。一个ip包进入交换机端口的时候,如果没有带tag头,且该端口上配置了pvid,那么,该数据包就会被打上相应的tag头!如果进入的ip包已经带有tag头(vlan数据)的话,那么交换机一般不会再增加tag头,即使是端口上配置了pvid号;当非标记数据包进入交换机。PVID和VID(标记)之间的关系就好比 扫描器和商品标记的关系,不同的是PVID不仅用来解析ViD也用来生成VID。 ## 二、端口的Tag和Untag ## 若某一端口在vlan设定中被指定为非标记端口untagged port, 所有从此端口转发出的数据包上都没有标记 (untagged)。若有标记的数据包进入交换机,则其经过非标记端口时,标记将被去除。因为目前众多设备并不支持标记数据包,其也无法识别标记数据包,因此,需要将与其连接的端口设定为非标记。 若某一端口在vlan设定中被指定为标记端口tagged port, 所有从此端口转发出的数据包上都将有标记 (tagged)。若有非标记的数据包进入交换机,则其经过标记端口时,标记将被加上。此时,其将使用在ingress 端口上的pvid设定作为增加的标记中的vlan id号。 untag port和tag port是针对VID来说的,和PVID没有什么关系。比如有一个交换机的端口设置成untag port,但是从这个端口进入交换机的网络包如果没有vlan tag的话,就会被打上该端口的PVID,不要以为它是untag port就不会被打上vlan tag。 ## 三、端口的封装类型:ISL、802.1Q ## ISL Trunk上所有的包都是tag的(Cisco专用); 802.1q 设计的时候为了兼容与不支持VLAN的交换机混合部署,特地设计成可以不tag:但是只有一个VLAN允许不tag,这样N个VLAN,(N-1)个都tag了,不tag的包一定是来自那个特殊VLAN的,所以不会乱套。(当然也可以所有VLAN都tag) ## 四、各端口收发数据的区别 ## <table style="border-spacing:0px;width:852px;margin:0px;padding:0px;"> <tbody> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><span style="font-weight:700;">端口类型</span></td> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><span style="font-weight:700;">收发</span></td> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><span style="font-weight:700;">描述</span></td> </tr> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><span style="font-family:'Liberation Sans';">Access</span></td> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">收报文</td> <td align="left" style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><p style="margin-bottom:5px;border:0px;list-style:none;">判断是否有VLAN信息:如果没有则打上端口的PVID,并进行交换转发,如果有则直接</p><p style="margin-bottom:5px;border:0px;list-style:none;">丢弃(缺省)</p></td> </tr> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">发报文</td> <td align="left" style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">将报文的VLAN信息剥离,直接发送出去</td> </tr> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><span style="font-family:'Liberation Sans';">Trunk</span></td> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">收报文</td> <td align="left" style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><p style="margin-bottom:5px;border:0px;list-style:none;">收到一个报文,判断是否有VLAN信息:如果没有则打上端口的PVID,并进行交换转发,</p><p style="margin-bottom:5px;border:0px;list-style:none;">如果有判断该trunk端口是否允许该 VLAN的数据进入:如果可以则转发,否则丢弃</p></td> </tr> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">发报文</td> <td align="left" style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><p style="margin-bottom:5px;border:0px;list-style:none;">比较端口的PVID和将要发送报文的VLAN信息,如果两者相等则剥离VLAN信息,再发送,</p><p style="margin-bottom:5px;border:0px;list-style:none;">如果不相等则直接发送</p></td> </tr> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><span style="font-family:'Liberation Sans';">Hybrid</span></td> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">收报文</td> <td align="left" style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><p style="margin-bottom:5px;border:0px;list-style:none;">收到一个报文判断是否有VLAN信息:如果没有则打上端口的PVID,并进行交换转发,</p><p style="margin-bottom:5px;border:0px;list-style:none;">如果有则判断该hybrid端口是否允许该VLAN的数据进入:如果可以则转发,否则丢弃</p></td> </tr> <tr> <td style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;">发报文</td> <td align="left" style="padding:0px;margin:0px;border-color:rgb(0,0,0);line-height:18px;font-family:Verdana, '宋体', sans-serif;"><p style="margin-bottom:5px;border:0px;list-style:none;">判断该VLAN在本端口的属性(disp interface 即可看到该端口对哪些VLAN是untag,</p><p style="margin-bottom:5px;border:0px;list-style:none;"> 哪些VLAN是tag)如果是untag则剥离VLAN信息,再发送,如果是tag则直接发送</p></td> </tr> </tbody> </table> Access端口负责接入 [终端设备][Link 2],它收到一个帧的时候,如果这个帧没有标记它就用自己的pvid给他打上标记,它在发出一个帧时如果VID=PVID就去掉标记以保证传送给终端设备的帧没有被变动过,pvid是在划分vlan时候每个端口都有的属性,默认情况下思科交换机中每个端口初始pvid是1,表示他是vlan1的成员。如果你给他划分了其他VLAN那么PVID相应会发生更改。 ACCESS端口的特点是 只允许符合PVID的流量通过。 Trunk的意思是,它是一条 [中继链路][Link 3],允许各种VLAN通过。它的规则和Access差不多,当收到一个没有tag的标记的时候就用自己的pvid给他标记,当发送一个帧时候如果vid=pvid则去掉pvid,与Access不同的是,Trunk有一个属于自己的本征VLAN,用来发送一些cdp,bpdu等 [交换机][Link 4]间联系的数据或者管理流量,从交换机自身产生的帧在发出去的时候是不会带标记的,因为VID=pvid所以标记被去掉,而对端接收到没有标记的帧时候就会用自身 [本征VLAN][VLAN]的信息给他加上标记,然后查看交换表如果发现目的地址是自己则去掉标记,如果发现目的mac地址不是自己则继续转发给其他Trunk同时去掉标记(因为一个交换机只有一个本征VLAN,所以pvid=vid,将会去掉标记)。 Hybrid是Access与Trunk的混合模式,它允许VID=pvid。Hybrid与Trunk一样,在该端口上可以传送多个vlan的包,一般用于 [交换机][Link 4]与交换机之间,或者交换机与服务器之间的链接。如果收到的 [数据包][Link 5]不带vlan,则加上pvid进行转发;如果收到的数据包带vlan,则判断该端口是否允许该vlan进入,如果可以则进行转发,否则丢弃。 以下案例可以帮助大家深入理解华为交换机的hybrid端口模式 \[Switch-Ethernet0/1\]int e0/1 \[Switch-Ethernet0/1\]port link-type hybrid \[Switch-Ethernet0/1\]port hybrid pvid vlan 10 \[Switch-Ethernet0/1\]port hybrid vlan 10 20 untagged \[Switch-Ethernet0/1\] int e0/2 \[Switch-Ethernet0/2\]port link-type hybrid \[Switch-Ethernet0/2\]port hybrid pvid vlan 20 \[Switch-Ethernet0/2\]port hybrid vlan 10 20 untagged 此时inter e0/1和inter e0/2下的所接的PC是可以互通的,但互通时数据所走的往返vlan是不同的。 以下以inter e0/1下的所接的pc1访问inter e0/2下的所接的pc2为例进行说明 pc1所发出的数据,由inter0/1所在的pvid vlan10封装vlan10的标记后送入交换机,交换机发现inter e0/2允许vlan 10的数据通过,于是数据被转发到inter e0/2上,由于inter e0/2上vlan 10是untagged的,于是交换机此时去除数据包上vlan10的标记,以普通包的形式发给pc2,此时pc1->p2走的是vlan10 再来分析pc2给pc1回包的过程,pc2所发出的数据,由inter0/2所在的pvid vlan20封装vlan20的标记后送入交换机,交换机发现inter e0/1允许vlan 20的数据通过,于是数据被转发到inter e0/1上,由于inter e0/1上vlan 20是untagged的,于是交换机此时去除数据包上vlan20的标记,以普通包的形式发给pc1,此时pc2->pc1走的是vlan20 # 1 华为交换机型号 # 左侧: ![70][] 右侧: ![70 1][] # 2 配置 # 实例操作: [https://blog.csdn.net/yongchaocsdn/article/details/70246157][https_blog.csdn.net_yongchaocsdn_article_details_70246157] 华为官方配置指南: [http://support.huawei.com/enterprise/zh/doc/EDOC1000178156][http_support.huawei.com_enterprise_zh_doc_EDOC1000178156] # 3 命令操作 # ## 进入命令行视图 ## 此节点介绍了进入和退出命令行视图的方法。 设备提供丰富的功能,相应的也提供了多样的配置和查询命令。为便于用户使用这些命令,华为交换机按功能分类将命令分别注册在不同的命令行视图下。配置某一功能时,需首先进入对应的命令行视图,然后执行相应的命令进行配置。 设备提供的命令视图有很多,下面提到的视图是最常用的视图。其他视图的进入方式在具体的命令中都有说明,请参见《S1720&S2700&S5700&S6720 V200R011C10 命令参考》。 ### 常用的命令行视图 ### <table> <thead> <tr> <th>常用视图名称</th> <th>进入视图</th> <th>视图功能</th> </tr> </thead> <tbody> <tr> <td>用户视图</td> <td><p>用户从终端成功登录至设备即进入用户视图,在屏幕上显示:</p><pre><code><<span>HUAWEI</span>></code></pre></td> <td><p>在用户视图下,用户可以完成查看运行状态和统计信息等功能。</p></td> </tr> <tr> <td>系统视图</td> <td><p>在用户视图下,输入命令<strong>system-view</strong>后回车,进入系统视图。</p><pre><code><<span>HUAWEI</span>> <strong>system-view</strong> Enter system view, return user view with Ctrl+Z. [<span></span><span>HUAWEI</span>]</code></pre></td> <td><p>在系统视图下,用户可以配置系统参数以及通过该视图进入其他的功能配置视图。</p></td> </tr> <tr> <td>接口视图</td> <td><p>使用<strong>interface</strong>命令并指定接口类型及接口编号可以进入相应的接口视图。</p><pre><code>[<span></span><span>HUAWEI</span>] <strong>interface gigabitethernet</strong> <em>X/Y/Z</em> [<span></span><span>HUAWEI</span>-GigabitEthernet<em>X/Y/Z</em>] </code></pre><p><em>X/Y/Z</em>为需要配置的接口的编号,分别对应“堆叠ID/子卡号/接口序号”。</p><p>上述举例中GigabitEthernet接口仅为示意。</p></td> <td><p>配置接口参数的视图称为接口视图。在该视图下可以配置接口相关的物理属性、链路层特性及IP地址等重要参数。</p></td> </tr> </tbody> </table> 命令行提示符“HUAWEI”是缺省的主机名(sysname)。通过提示符可以判断当前所处的视图,例如:“<>”表示用户视图,“\[\]”表示除用户视图以外的其它视图。 用户可以在任意视图中,执行!或\#加字符串,此时的用户输入将全部(包括!和\#在内)作为系统的注释行内容,不会产生对应的配置信息。 ![imgDownload_uuid_dc3f33a1be08475db419ad8621484e52.gif][] 说明: * 有些在系统视图下执行的命令,在其它视图下也可以执行,但实现的功能与命令视图密切相关。例如**lldp enable**命令在系统视图表示使能全局的LLDP功能,在接口视图下,表示使能某一接口的LLDP功能。 * 在系统视图下,可以执行命令**diagnose**进入诊断视图。诊断命令行主要用于设备的故障诊断,在此视图下执行某些命令可能导致设备异常或业务中断。如果您需要使用此类命令行,请联系技术支持人员,在技术支持人员指导下谨慎使用。 * 用户可以在任意视图中,执行!或\#加字符串,此时的用户输入将全部(包括!和\#在内)作为系统的注释行内容,可以正常下发,不报错,不会产生对应的配置信息。 ### 退出命令行视图 ### 执行**quit**命令,即可从当前视图退出至上一层视图。 例如,执行 **quit**命令从AAA视图退回到系统视图,再执行 **quit**命令退回到用户视图。 [HUAWEI-aaa] quit [HUAWEI] quit <HUAWEI> 如果需要从AAA视图直接退回到用户视图,则可以在键盘上键入组合键<Ctrl+Z>或者执行**return**命令。 \# 使用组合键<Ctrl+Z>直接退回到用户视图。 [HUAWEI-aaa] //键入<Ctrl+Z> <HUAWEI> \# 执行 **return**命令直接退回到用户视图。 [HUAWEI-aaa] return <HUAWEI> ### 命令行智能回退 ### 命令行具有智能回退功能,在当前视图下执行某条命令,如果命令行匹配失败,会自动退到上一级视图进行匹配,如果仍然失败则继续退到上一级视图匹配,直到退到系统视图为止。 下面分别举例,1为退入上一级视图即匹配对应视图,2为必须匹配到系统视图才能执行。 1. 在一个OSPF区域视图下不退到OSPF视图,直接进入另一个OSPF区域视图。 <HUAWEI> system-view [HUAWEI] ospf 100 [HUAWEI-ospf-100] area 1 [HUAWEI-ospf-100-area-0.0.0.1] area 2 [HUAWEI-ospf-100-area-0.0.0.2] 2. 在OSPF区域视图直接进入接口视图。 <HUAWEI> system-view [HUAWEI] ospf 100 [HUAWEI-ospf-100] area 1 [HUAWEI-ospf-100-area-0.0.0.1] interface gigabitEthernet 0/0/3 [HUAWEI-GigabitEthernet0/0/3] ## 3.1 display vlan ## <HUAWEI>display vlan The total number of VLANs is: 4094 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:40GE0/0/1(D) 40GE0/0/2(D) XGE0/0/47(D) XGE0/0/48(D) Eth-Trunk1(U) 32 common TG:Eth-Trunk1(U) 33 common TG:Eth-Trunk1(U) 34 common UT:XGE0/0/3(D) XGE0/0/4(D) XGE0/0/5(D) XGE0/0/6(D) XGE0/0/7(D) XGE0/0/8(D) XGE0/0/9(D) XGE0/0/10(D) XGE0/0/11(D) XGE0/0/12(D) XGE0/0/13(D) XGE0/0/14(D) XGE0/0/15(D) XGE0/0/16(D) XGE0/0/17(D) XGE0/0/18(D) XGE0/0/19(D) XGE0/0/20(D) XGE0/0/21(D) XGE0/0/22(D) XGE0/0/23(D) XGE0/0/24(D) XGE0/0/25(D) XGE0/0/26(D) XGE0/0/27(D) XGE0/0/28(D) XGE0/0/29(D) XGE0/0/30(D) XGE0/0/31(D) XGE0/0/32(D) XGE0/0/33(D) XGE0/0/34(D) XGE0/0/35(D) XGE0/0/36(D) XGE0/0/37(D) XGE0/0/38(D) XGE0/0/39(D) XGE0/0/40(D) XGE0/0/41(D) XGE0/0/42(D) XGE0/0/43(D) XGE0/0/44(D) XGE0/0/45(D) XGE0/0/46(D) TG:Eth-Trunk1(U) <HUAWEI>display vlan summary Static VLAN: Total 4094 static VLAN. 1 to 4094 Dynamic VLAN: Total 0 dynamic VLAN. Reserved VLAN: Total 0 reserved VLAN. <HUAWEI>display port vlan Port Link Type PVID Trunk VLAN List ------------------------------------------------------------------------------- Eth-Trunk1 trunk 1 1-4094 XGigabitEthernet0/0/1 - 0 - XGigabitEthernet0/0/2 - 0 - XGigabitEthernet0/0/3 access 34 - XGigabitEthernet0/0/4 access 34 - XGigabitEthernet0/0/5 access 34 - XGigabitEthernet0/0/6 access 34 - XGigabitEthernet0/0/7 access 34 - XGigabitEthernet0/0/8 access 34 - XGigabitEthernet0/0/9 access 34 - XGigabitEthernet0/0/10 access 34 - XGigabitEthernet0/0/11 access 34 - XGigabitEthernet0/0/12 access 34 - XGigabitEthernet0/0/13 access 34 - XGigabitEthernet0/0/14 access 34 - XGigabitEthernet0/0/15 access 34 - XGigabitEthernet0/0/16 access 34 - XGigabitEthernet0/0/17 access 34 - XGigabitEthernet0/0/18 access 34 - XGigabitEthernet0/0/19 access 34 - XGigabitEthernet0/0/20 access 34 - XGigabitEthernet0/0/21 access 34 - XGigabitEthernet0/0/22 access 34 - XGigabitEthernet0/0/23 access 34 - XGigabitEthernet0/0/24 access 34 - XGigabitEthernet0/0/25 access 34 - XGigabitEthernet0/0/26 access 34 - XGigabitEthernet0/0/27 access 34 - XGigabitEthernet0/0/28 access 34 - XGigabitEthernet0/0/29 access 34 - XGigabitEthernet0/0/30 access 34 - XGigabitEthernet0/0/31 access 34 - XGigabitEthernet0/0/32 access 34 - XGigabitEthernet0/0/33 access 34 - XGigabitEthernet0/0/34 access 34 - XGigabitEthernet0/0/35 access 34 - XGigabitEthernet0/0/36 access 34 - XGigabitEthernet0/0/37 access 34 - XGigabitEthernet0/0/38 access 34 - XGigabitEthernet0/0/39 access 34 - XGigabitEthernet0/0/40 access 34 - XGigabitEthernet0/0/41 access 34 - XGigabitEthernet0/0/42 access 34 - XGigabitEthernet0/0/43 access 34 - XGigabitEthernet0/0/44 access 34 - XGigabitEthernet0/0/45 access 34 - XGigabitEthernet0/0/46 access 34 - XGigabitEthernet0/0/47 desirable 1 1-4094 XGigabitEthernet0/0/48 desirable 1 1-4094 40GE0/0/1 desirable 1 1-4094 40GE0/0/2 desirable 1 1-4094 <HUAWEI> ## 3.2 显示设备上当前接口GE1/0/1的接口信息 ## \# 显示设备上当前接口GE1/0/1的接口信息。(以EC单板为例) <HUAWEI> system-view [HUAWEI] interface gigabitethernet 1/0/1 [HUAWEI-GigabitEthernet1/0/1] display this interface GigabitEthernet1/0/1 current state : UP Line protocol current state : UP Description: Switch Port,Link-type : access(negotiated), PVID : 1, TPID : 8100(Hex), The Maximum Frame Length is 9216 IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 0025-9ef4-abcd Last physical up time : 2012-07-21 16:14:35+08:00 Last physical down time : 2012-08-21 16:14:35+08:00 Current system time: 2012-08-24 00:41:35+08:00 Port Mode: COMMON FIBER, Transceiver: 1000_BASE_SX_SFP Speed : 1000, Loopback: NONE Duplex: FULL, Negotiation: ENABLE Mdi : -, Flow-control: DISABLE Last 300 seconds input rate 0 bits/sec, 0 packets/sec Last 300 seconds output rate 0 bits/sec, 0 packets/sec Input peak rate 0 bits/sec, Record time: 2007-12-26 07:23:14 Output peak rate 0 bits/sec, Record time: 2007-12-26 07:23:14 Input: 0 packets, 0 bytes Unicast: 0, Multicast: 0 Broadcast: 0, Jumbo: 0 Discard: 0, Pause: 0 Frames: 0 Total Error: 0 CRC: 0, Giants: 0 Jabbers: 0, Fragments: 0 Runts: 0, DropEvents: 0 Alignments: 0, Symbols: 0 Ignoreds: 0 Output: 0 packets, 0 bytes Unicast: 0, Multicast: 0 Broadcast: 0, Jumbo: 0 Discard: 0, Pause: 0 Total Error: 0 Collisions: 0, ExcessiveCollisions: 0 Late Collisions: 0, Deferreds: 0 Buffers Purged: 0 Input bandwidth utilization threshold : 80.00% Output bandwidth utilization threshold: 80.00% Input bandwidth utilization : 0% Output bandwidth utilization : 0% <table> <strong>表1 </strong>display this interface命令输出信息描述 <thead> <tr> <th><p>项目</p></th> <th><p>描述</p></th> </tr> </thead> <tbody> <tr> <td><p>current state</p></td> <td> <div> 显示接口的物理状态。 <ul> <li><p>UP:接口物理层处于正常启动的状态。</p></li> <li><p>DOWN:接口物理层出现故障。</p><p>(Protected port) DOWN表示接口加入端口保护组且被设置为保护端口。将接口加入端口保护组请参见命令<a rel="nofollow"><strong>port protect-group</strong></a>,将接口设置为保护端口请参见命令<a rel="nofollow"><strong>protect-group member</strong></a>。</p></li> <li><p>Administratively down:如果网络管理员在该接口执行<a rel="nofollow"><strong>shutdown</strong></a>命令,将显示状态为Administratively down。</p></li> <li>TRIGGER DOWN (BFD):BFD检测到故障,通过OAM联动,使接口物理状态变为Down。</li> <li>TRIGGER DOWN (3AH):3AH检测到故障,通过OAM联动,使接口物理状态变为Down。</li> <li>TRIGGER DOWN (1AG):1AG检测到故障,通过OAM联动,使接口物理状态变为Down。</li> <li>ERROR DOWN(auto-defend):指定攻击溯源的自动防御措施为将攻击报文进入的接口物理状态变为Down。 </li> <li>ERROR DOWN(efm-threshold-event):EFM协议检测误帧、误码或者误帧秒,通过OAM联动,使接口物理状态变为Down。 </li> <li>ERROR DOWN(efm-remote-failure):EFM协议检测到远端错误,通过OAM联动,使接口物理状态变为Down。</li> <li>ERROR DOWN(bpdu-protection):设备上启动了BPDU保护功能后,如果边缘端口收到RST BPDU,边缘端口的物理状态将变为Down。</li> <li>ERROR DOWN(error-statistics):检测到接口接收的错误报文超过阈值时,接口物理状态变为Down。</li> <li>ERROR DOWN(transceiver-power-low):检测到接口光功率低于设置的告警下限阈值时,接口物理状态变为Down。</li> <li>ERROR DOWN(port-security):检测到接口学习到的MAC地址数超过限制数时,接口物理状态变为Down。</li> <li>ERROR DOWN(mac-address-flapping):检测到接口学习到的MAC地址发生漂移,接口物理状态变为Down。</li> <li>ERROR DOWN(dhcp-packet-overspeed):DHCP报文超过速率限制,联动接口物理状态变为Down。</li> <li>ERROR DOWN(link-flap):链路振荡,联动的接口物理状态变为Down。</li> <li>ERROR DOWN(data-integrity-error):芯片内存标识符有数据完整性错误,接口物理状态变为Down。</li> <li>UP(E-TRUNK-DOWN):E-Trunk协商导致Eth-Trunk接口状态变为down。</li> </ul> <div> <span>说明: </span> <div> <p>由于接口状态上报会有时延,接口ERROR DOWN时会有一个短暂的中间状态:ERROR DOWN(接口ERROR DOWN原因),UP,之后接口进入ERROR DOWN状态。此中间状态不影响正常功能。</p> <p>接口的物理状态为ERROR DOWN(data-integrity-error)时,请执行以下步骤:</p> <ol> <li>检查设备上是否已经配置了<a rel="nofollow"><strong>error-down auto-recovery</strong></a> <strong>cause data-integrity-error interval</strong> <em>interval-value</em>命令。如果已经配置,执行第2步;否则,执行第3步。</li> <li>等待<em>interval-value</em>时间后,查看接口状态是否恢复为Up。如果没有恢复,执行第3步。</li> <li>在接口视图下执行<a rel="nofollow"><strong>undo shutdown</strong></a>命令开启接口,查看接口状态是否恢复。如果没有恢复,执行第4步。</li> <li>执行<a rel="nofollow"><strong>reboot</strong></a>命令重新启动单板。单板重新启动后,查看接口状态是否恢复,如果没有恢复,执行第5步。</li> <li>请更换单板。</li> </ol> </div> </div> </div></td> </tr> <tr> <td><p>Line protocol current state</p></td> <td> <div> 显示该接口的链路协议状态。 <ul> <li><p>UP:接口的链路协议处于正常的启动状态。</p></li> <li><p>UP(BFD status down):与该接口绑定的BFD会话状态变为down。</p></li> <li><p>UP(Main BFD status down):与主接口联动的BFD会话状态down,并且联动子接口状态。只能在子接口显示该状态。</p></li> <li><p>UP (spoofing):表示该接口的链路协议状态有spoofing特性,也就是该接口的链路协议状态永远是Up。</p></li> <li><p>DOWN:接口的链路协议层出现故障,或者没有在此接口配置IP地址。</p><p>以支持IP业务的接口为例,如果没有配置IP地址,则接口协议状态为Down。</p></li> <li>DOWN (CFM down):表示CFM检测到故障,或接收到具有联动关系的模块的故障信息,使接口的链路状态变为CFM DOWN。</li> <li>DOWN (EFM down):表示EFM检测到故障,或接收到具有联动关系的模块的故障信息,使接口的链路状态变为EFM DOWN。</li> <li>DOWN (DLDP down):表示DLDP检测到故障,或接收到具有联动关系的模块的故障信息,使接口的链路状态变为DLDP DOWN。</li> <li>DOWN (MACsec down):表示该设备接口的对端设备接口未开启MACsec功能,使接口的链路状态变为MACsec DOWN。</li> </ul> <div> <span>说明: </span> <div> <p>DOWN (MACsec down)仅加载MACsec插件后才会显示。</p> </div> </div> </div></td> </tr> <tr> <td><p>Description</p></td> <td><p>接口的描述信息。可以使用命令<a rel="nofollow"><strong>description</strong></a>配置。</p></td> </tr> <tr> <td><p>Switch Port</p></td> <td><p>显示接口是二层接口。可以使用命令<a rel="nofollow"><strong>undo portswitch</strong></a>切换到三层模式。</p><p>如果接口是三层模式,此处则显示为Route Port。</p></td> </tr> <tr> <td><p>PVID</p></td> <td><p>接口的缺省VLAN的编号。</p></td> </tr> <tr> <td><p>Link-type</p></td> <td> <div> 二层接口的链路类型,仅在二层模式下显示。有以下几种显示: <ul> <li>access(configured):手工配置为access类型。</li> <li>hybrid:手工配置为hybrid类型。</li> <li>trunk(configured):手工配置为trunk类型。</li> <li>dot1q-tunnel:手工配置为dot1q-tunnel类型。</li> <li>access(negotiated):动态协商为access类型。</li> <li>trunk(negotiated):动态协商为trunk类型。</li> </ul>可参见命令 <a rel="nofollow">port link-type</a>。 </div></td> </tr> <tr> <td><p>TPID</p></td> <td><p>显示接口支持的帧类型。</p><p>缺省情况下,TPID是0x8100,表示802.1Q帧。</p><p>此字段只有在接口类型是二层接口情况下显示。</p></td> </tr> <tr> <td><p>The Maximum Frame Length</p></td> <td><p>接口允许通过的最长帧。可以使用命令<a rel="nofollow"><strong>jumboframe enable</strong></a>修改。</p></td> </tr> <tr> <td><p>IP Sending Frames' Format</p></td> <td><p>IP协议发送帧格式,包括PKTFMT_ETHNT_2,Ethernet_802.3,Ethernet_SNAP。</p></td> </tr> <tr> <td><p>Hardware address</p></td> <td><p>接口的MAC地址。</p></td> </tr> <tr> <td><p>Port Mode</p></td> <td><p>普通接口的工作模式。</p> <ul> <li>COMMON COPPER:电口模式。</li> <li>COMMON FIBER:光口模式。</li> </ul><p>Combo接口的工作模式。可以使用命令<a rel="nofollow"><strong>combo-port</strong></a>配置。</p> <ul> <li>COMBO AUTO:自动选择接口模式。</li> <li>FORCE FIBER:强制选择光口模式。</li> <li>FORCE COPPER:强制选择电口模式。</li> </ul></td> </tr> <tr> <td><p>Transceiver</p></td> <td><p>光模块类型。</p> <ul> <li>对于电接口,该字段不显示。</li> <li>如果光接口上插上光模块或光电模块,则该字段将显示光模块或光电模块的具体型号。</li> <li>如果光接口上未插光模块或光电模块,则该字段不显示。</li> <li>如果光接口上插高速线缆时,该字段显示为线缆具体类型。</li> </ul></td> </tr> <tr> <td><p>Last physical up time</p></td> <td><p>接口上次物理Up的时刻,“-”表示接口的此物理状态没有发生过变化。</p><p>接口状态变为Up时,如果配置了时区且处于夏令时,时间显示格式为YYYY/MM/DD HH:MM:SS UTC±HH:MM DST。</p></td> </tr> <tr> <td><p>Last physical down time</p></td> <td><p>接口上次物理Down的时刻,“-”表示接口的此物理状态没有发生过变化。</p><p>接口状态变为Down时,如果配置了时区且处于夏令时,时间显示格式为YYYY/MM/DD HH:MM:SS UTC±HH:MM DST。</p></td> </tr> <tr> <td><p>Current system time</p></td> <td><p>当前系统时间。</p><p>如果配置了时区且处于夏令时,时间显示格式为YYYY/MM/DD HH:MM:SS UTC±HH:MM DST。</p></td> </tr> <tr> <td><p>Speed</p></td> <td><p>接口当前速度。</p> <ul> <li>自协商模式下,可以使用命令<a rel="nofollow"><strong>auto speed</strong></a>配置。</li> <li>非自协商模式下,可以使用命令<a rel="nofollow"><strong>speed</strong></a>配置。</li> </ul></td> </tr> <tr> <td><p>Loopback</p></td> <td><p>接口环回配置。可以使用命令<a rel="nofollow"><strong>loopback</strong></a>配置。</p></td> </tr> <tr> <td><p>Duplex</p></td> <td><p>接口工作的双工模式。</p> <ul> <li>FULL:全双工模式。</li> <li>HALF:半双工模式。</li> </ul> <ul> <li>自协商模式下,可以使用命令<a rel="nofollow"><strong>auto duplex</strong></a>配置。</li> <li>非自协商模式下,可以使用命令<a rel="nofollow"><strong>duplex</strong></a>配置。</li> </ul></td> </tr> <tr> <td><p>Negotiation</p></td> <td><p>接口自协商状态。可以使用命令<a rel="nofollow"><strong>negotiation auto</strong></a>配置。</p> <ul> <li>ENABLE:接口开启了自协商功能。</li> <li>DISABLE:接口关闭了自协商功能。</li> </ul></td> </tr> <tr> <td><p>Mdi</p></td> <td><p>接口网线类型。可以使用命令<a rel="nofollow"><strong>mdi</strong></a>配置。</p></td> </tr> <tr> <td><p>Flow-control</p></td> <td><p><span style="color:#ffffff;background-color:#0078d7;">流量</span>控制状态。</p> <ul> <li>ENABLE:接口开启了<span style="color:#ffffff;background-color:#0078d7;">流量</span>控制功能。</li> <li>DISABLE:接口关闭了<span style="color:#ffffff;background-color:#0078d7;">流量</span>控制功能。</li> </ul> <div> <span>说明: </span> <div> 如果用户已使用命令 <a rel="nofollow"><strong>flow-control</strong></a>打开以太网接口的 <span style="color:#ffffff;background-color:#0078d7;">流量</span>控制开关,在如下情况下该字段仍然显示为 <strong>DISABLE</strong>: <ul> <li>接口处于DOWN状态</li> <li>接口处于半双工模式</li> </ul> </div> </div></td> </tr> <tr> <td><p>Last 300 seconds input rate</p></td> <td><p>接口在前5分钟接收的比特速率和报文速率。</p></td> </tr> <tr> <td><p>Last 300 seconds output rate</p></td> <td><p>接口在前5分钟发送的比特速率和报文速率。</p></td> </tr> <tr> <td><p>Input peak rate 0 bits/sec,Record time</p></td> <td><p>入接口报文的最大速率和最大速率的发生时间。</p></td> </tr> <tr> <td><p>Output peak rate 0 bits/sec,Record time</p></td> <td><p>出接口报文的最大速率和最大速率的发生时间。</p></td> </tr> <tr> <td><p>Input</p></td> <td><p>接收报文总数量。</p></td> </tr> <tr> <td><p>Output</p></td> <td><p>发送报文总数量。</p></td> </tr> <tr> <td><p>Unicast</p></td> <td><p>接口接收或发送的单播报文的数目。</p></td> </tr> <tr> <td><p>Multicast</p></td> <td><p>接口接收或发送的组播报文的数目。</p></td> </tr> <tr> <td><p>Broadcast</p></td> <td><p>接口接收或发送的广播报文的数目。</p></td> </tr> <tr> <td><p>Jumbo</p></td> <td><p>接口接收的以太网帧长在1518字节到最大Jumbo帧长设定值之间,或者接口接收的VLAN帧长在1522字节到最大Jumbo帧长设定值之间,且FCS正确的报文数目。</p><p>接口发出的帧长超过1518字节或者发送的VLAN帧长超过1522字节且FCS正确的报文数目。</p><p>对于X系列单板,该字段还包含大于1518小于接口上Jumbo帧长设定值且CRC错误的报文数目。</p><p>最大Jumbo帧长设定值可以由<a rel="nofollow"><strong>jumboframe enable</strong></a>设置。</p></td> </tr> <tr> <td><p>Discard</p></td> <td><p>接口在物理层检测时发现的丢弃报文数目。</p></td> </tr> <tr> <td><p>Total Error</p></td> <td><p>接口在物理层检测时发现的错误报文总数目。</p></td> </tr> <tr> <td><p>CRC</p></td> <td><p>接口接收的CRC错误报文数目。</p><p>对于X1E系列单板,该字段还包含大于接口上Jumbo帧长设定值并且CRC错误的报文数目。</p><p>对于X1E系列单板,该字段还包含大于1518小于接口上Jumbo帧长设定值且CRC错误的报文。</p></td> </tr> <tr> <td><p>Giants</p></td> <td><p>接口接收的超过Jumbo帧大小的报文数目。</p></td> </tr> <tr> <td><p>Jabbers</p></td> <td><p>接口接收的帧长在1518字节到最大Jumbo帧长设定值之间且FCS错误的报文数目。</p></td> </tr> <tr> <td><p>Fragments</p></td> <td><p>接口接收到的碎片报文。</p><p>对于X1E系列单板,该字段还包含接口接收的超小帧且FCS正确的报文数目。</p><p>对于EE系列单板,该字段显示为0。</p></td> </tr> <tr> <td><p>Runts</p></td> <td><p>接口接收的超小帧且FCS正确的报文数目。</p><p>对于X1E系列单板和EE系列单板,该字段还包含接收长度小于64字节,且CRC不正确的报文。</p></td> </tr> <tr> <td><p>DropEvents</p></td> <td><p>接口接收的报文因为内存池满(GBP full)或者反压(Back Pressure)导致的丢包数目。</p></td> </tr> <tr> <td><p>Alignments</p></td> <td><p>接口接收的帧对齐错误的报文数目。</p></td> </tr> <tr> <td><p>Symbols</p></td> <td><p>接口接收的编码错误的报文数目。</p></td> </tr> <tr> <td><p>Ignoreds</p></td> <td><p>接口接收的OpCode不是PAUSE的MAC控制帧的报文数目。</p></td> </tr> <tr> <td><p>Frames</p></td> <td><p>接口接收的802.3长度和实际数据长度不符的报文数目。</p></td> </tr> <tr> <td><p>Pause</p></td> <td><p>Pause帧。</p></td> </tr> <tr> <td><p>Collisions</p></td> <td><p>接口发送报文过程中遇到1-15次冲突的报文数目。</p></td> </tr> <tr> <td><p>ExcessiveCollisions</p></td> <td><p>接口发送报文过程中遇到16次冲突并最终发送失败的报文数目。</p></td> </tr> <tr> <td><p>Late Collisions</p></td> <td><p>接口发送报文时遇到冲突,且又延迟发送的报文数目。</p></td> </tr> <tr> <td><p>Deferreds</p></td> <td><p>接口发送报文有延迟但没有冲突的报文数目。</p></td> </tr> <tr> <td><p>Buffers Purged</p></td> <td><p>接口发送报文时在队列缓冲区中存在时间太长,被老化掉的报文数目。</p></td> </tr> <tr> <td><p>Input bandwidth utilization threshold</p></td> <td><p>输入带宽占用率阈值。</p></td> </tr> <tr> <td><p>Output bandwidth utilization threshold</p></td> <td><p>输出带宽占用率阈值。</p></td> </tr> <tr> <td><p>Input bandwidth utilization</p></td> <td><p>输入带宽占用率。</p></td> </tr> <tr> <td><p>Output bandwidth utilization</p></td> <td><p>输出带宽占用率。</p></td> </tr> </tbody> </table> # 4 常见功能 # 参考: http://network.51cto.com/art/201001/177448.htm 史上最全华为路由器交换机配置命令大合集,熟练掌握下面的华为路由器交换机配置知识,你只需花几分钟的时间就能明白华为路由器交换机配置。交换机的配置命令等等。 **华为路由器交换机配置命令:计算机命令** PCAlogin:root;使用root用户 password:linux;口令是linux \#shutdown-hnow;关机 \#init0;关机 \#logout;用户注销 \#login;用户登录 \#ifconfig;显示IP地址 \#ifconfigeth0netmask;设置IP地址 \#ifconfigeht0netmaskdown;禁用IP地址 \#routeadd0.0.0.0gw;设置网关 \#routedel0.0.0.0gw;删除网关 \#routeadddefaultgw;设置网关 \#routedeldefaultgw;删除网关 \#route;显示网关 \#ping;发ECHO包 \#telnet;远程登录 **华为路由器交换机配置命令:交换机命令** \[Quidway\]discur;显示当前配置 \[Quidway\]displaycurrent-configuration;显示当前配置 \[Quidway\]displayinterfaces;显示接口信息 \[Quidway\]displayvlanall;显示路由信息 \[Quidway\]displayversion;显示版本信息 \[Quidway\]superpassword;修改特权用户密码 \[Quidway\]sysname;交换机命名 \[Quidway\]interfaceethernet0/1;进入接口视图 \[Quidway\]interfacevlanx;进入接口视图 \[Quidway-Vlan-interfacex\]ipaddress10.65.1.1255.255.0.0;配置VLAN的IP地址 \[Quidway\]iproute-static0.0.0.00.0.0.010.65.1.2;静态路由=网关 \[Quidway\]rip;三层交换支持 \[Quidway\]local-userftp \[Quidway\]user-interfacevty04;进入虚拟终端 \[S3026-ui-vty0-4\]authentication-modepassword;设置口令模式 \[S3026-ui-vty0-4\]setauthentication-modepasswordsimple222;设置口令 \[S3026-ui-vty0-4\]userprivilegelevel3;用户级别 \[Quidway\]interfaceethernet0/1;进入端口模式 \[Quidway\]inte0/1;进入端口模式 \[Quidway-Ethernet0/1\]duplex\{half|full|auto\};配置端口工作状态 \[Quidway-Ethernet0/1\]speed\{10|100|auto\};配置端口工作速率 \[Quidway-Ethernet0/1\]flow-control;配置端口流控 \[Quidway-Ethernet0/1\]mdi\{across|auto|normal\};配置端口平接扭接 \[Quidway-Ethernet0/1\]portlink-type\{trunk|access|hybrid\};设置端口工作模式 \[Quidway-Ethernet0/1\]portaccessvlan3;当前端口加入到VLAN \[Quidway-Ethernet0/2\]porttrunkpermitvlan\{ID|All\};设trunk允许的VLAN \[Quidway-Ethernet0/3\]porttrunkpvidvlan3;设置trunk端口的PVID \[Quidway-Ethernet0/1\]undoshutdown;激活端口 \[Quidway-Ethernet0/1\]shutdown;关闭端口 \[Quidway-Ethernet0/1\]quit;返回 \[Quidway\]vlan3;创建VLAN \[Quidway-vlan3\]portethernet0/1;在VLAN中增加端口 \[Quidway-vlan3\]porte0/1;简写方式 \[Quidway-vlan3\]portethernet0/1toethernet0/4;在VLAN中增加端口 \[Quidway-vlan3\]porte0/1toe0/4;简写方式 \[Quidway\]monitor-port;指定镜像端口 \[Quidway\]portmirror;指定被镜像端口 \[Quidway\]portmirrorint\_listobserving-portint\_typeint\_num;指定镜像和被镜像 \[Quidway\]descriptionstring;指定VLAN描述字符 \[Quidway\]description;删除VLAN描述字符 \[Quidway\]displayvlan\[vlan\_id\];查看VLAN设置 \[Quidway\]stp\{enable|disable\};设置生成树,默认关闭 \[Quidway\]stppriority4096;设置交换机的优先级 \[Quidway\]stproot\{primary|secondary\};设置为根或根的备份 \[Quidway-Ethernet0/1\]stpcost200;设置交换机端口的花费 \[Quidway\]link-aggregatione0/1toe0/4ingress|both;端口的聚合 \[Quidway\]undolink-aggregatione0/1|all;始端口为通道号 \[SwitchA-vlanx\]isolate-user-vlanenable;设置主vlan \[SwitchA\]isolate-user-vlansecondary;设置主vlan包括的子vlan \[Quidway-Ethernet0/2\]porthybridpvidvlan;设置vlan的pvid \[Quidway-Ethernet0/2\]porthybridpvid;删除vlan的pvid \[Quidway-Ethernet0/2\]porthybridvlanvlan\_id\_listuntagged;设置无标识的vlan 如果包的vlanid与PVId一致,则去掉vlan信息.默认PVID=1。 所以设置PVID为所属vlanid,设置可以互通的vlan为untagged. **华为路由器交换机配置命令:路由器命令** \[Quidway\]displayversion;显示版本信息 \[Quidway\]displaycurrent-configuration;显示当前配置 \[Quidway\]displayinterfaces;显示接口信息 \[Quidway\]displayiproute;显示路由信息 \[Quidway\]sysnameaabbcc;更改主机名 \[Quidway\]superpasswrod123456;设置口令 \[Quidway\]interfaceserial0;进入接口 \[Quidway-serial0\]ipaddress;配置端口IP地址 \[Quidway-serial0\]undoshutdown;激活端口 \[Quidway\]link-protocolhdlc;绑定hdlc协议 \[Quidway\]user-interfacevty04 \[Quidway-ui-vty0-4\]authentication-modepassword \[Quidway-ui-vty0-4\]setauthentication-modepasswordsimple222 \[Quidway-ui-vty0-4\]userprivilegelevel3 \[Quidway-ui-vty0-4\]quit \[Quidway\]debugginghdlcallserial0;显示所有信息 \[Quidway\]debugginghdlceventserial0;调试事件信息 \[Quidway\]debugginghdlcpacketserial0;显示包的信息 **华为路由器交换机配置命令:静态路由:** \[Quidway\]iproute-static\{interfacenumber|nexthop\}\[value\]\[reject|blackhole\] 例如:\[Quidway\]iproute-static129.1.0.01610.0.0.2 \[Quidway\]iproute-static129.1.0.0255.255.0.010.0.0.2 \[Quidway\]iproute-static129.1.0.016Serial2 \[Quidway\]iproute-static0.0.0.00.0.0.010.0.0.2 **华为路由器交换机配置命令:动态路由:** \[Quidway\]rip;设置动态路由 \[Quidway\]ripwork;设置工作允许 \[Quidway\]ripinput;设置入口允许 \[Quidway\]ripoutput;设置出口允许 \[Quidway-rip\]network1.0.0.0;设置交换路由网络 \[Quidway-rip\]networkall;设置与所有网络交换 \[Quidway-rip\]peerip-address; \[Quidway-rip\]summary;路由聚合 \[Quidway\]ripversion1;设置工作在版本1 \[Quidway\]ripversion2multicast;设版本2,多播方式 \[Quidway-Ethernet0\]ripsplit-horizon;水平分隔 \[Quidway\]routeridA.B.C.D;配置路由器的ID \[Quidway\]ospfenable;启动OSPF协议 \[Quidway-ospf\]import-routedirect;引入直联路由 \[Quidway-Serial0\]ospfenablearea;配置OSPF区域 **华为路由器交换机配置命令:标准访问列表命令格式如下:** acl\[match-orderconfig|auto\];默认前者顺序匹配。 rule\[normal|special\]\{permit|deny\}\[sourcesource-addrsource-wildcard|any\] 例:\[Quidway\]acl10 \[Quidway-acl-10\]rulenormalpermitsource10.0.0.00.0.0.255 \[Quidway-acl-10\]rulenormaldenysourceany **华为路由器交换机配置命令:扩展访问控制列表配置命令** 配置TCP/UDP协议的扩展访问列表: rule\{normal|special\}\{permit|deny\}\{tcp|udp\}source\{|any\}destination|any\} \[operate\] 配置ICMP协议的扩展访问列表: rule\{normal|special\}\{permit|deny\}icmpsource\{|any\]destination\{|any\] \[icmp-code\]\[logging\] **华为路由器交换机配置命令:扩展访问控制列表操作符的含义** equalportnumber;等于 greater-thanportnumber;大于 less-thanportnumber;小于 not-equalportnumber;不等 rangeportnumber1portnumber2;区间 **[华为路由器交换机][Link 6]配置命令:扩展访问控制列表举例** \[Quidway\]acl101 \[Quidway-acl-101\]ruledenysouceanydestinationany \[Quidway-acl-101\]rulepermiticmpsourceanydestinationanyicmp-typeecho \[Quidway-acl-101\]rulepermiticmpsourceanydestinationanyicmp-typeecho-reply \[Quidway\]acl102 \[Quidway-acl-102\]rulepermitipsource10.0.0.10.0.0.0destination202.0.0.10.0.0.0 \[Quidway-acl-102\]ruledenyipsourceanydestinationany \[Quidway\]acl103 \[Quidway-acl-103\]rulepermittcpsourceanydestination10.0.0.10.0.0.0destination-portequalftp \[Quidway-acl-103\]rulepermittcpsourceanydestination10.0.0.20.0.0.0destination-portequalwww \[Quidway\]firewallenable \[Quidway\]firewalldefaultpermit|deny \[Quidway\]inte0 \[Quidway-Ethernet0\]firewallpacket-filter101inbound|outbound **华为路由器交换机配置命令:地址转换配置举例** \[Quidway\]firewallenable \[Quidway\]firewalldefaultpermit \[Quidway\]acl101;内部指定主机可以进入e0 \[Quidway-acl-101\]ruledenyipsourceanydestinationany \[Quidway-acl-101\]rulepermitipsource129.38.1.10destinationany \[Quidway-acl-101\]rulepermitipsource129.38.1.20destinationany \[Quidway-acl-101\]rulepermitipsource129.38.1.30destinationany \[Quidway-acl-101\]rulepermitipsource129.38.1.40destinationany \[Quidway-acl-101\]quit \[Quidway\]inte0 \[Quidway-Ethernet0\]firewallpacket-filter101inbound \[Quidway\]acl102;外部特定主机和大于1024端口的数据包允许进入S0 \[Quidway-acl-102\]ruledenyipsourceanydestinationany \[Quidway-acl-102\]rulepermittcpsource202.39.2.30destination202.38.160.10 \[Quidway-acl-102\]rulepermittcpsourceanydestination202.38.160.10destination-portgreat-than 1024 \[Quidway-acl-102\]quit \[Quidway\]ints0 \[Quidway-Serial0\]firewallpacket-filter102inbound;设202.38.160.1是路由器出口IP。 \[Quidway-Serial0\]natoutbound101interface;是Easyip,将acl101允许的IP从本接口出时变换源地址。 **华为路由器交换机配置命令:内部服务器地址转换配置命令(静态nat):** natserverglobal\[port\]insideport\[protocol\];global\_port不写时使用inside\_port \[Quidway-Serial0\]natserverglobal202.38.160.1inside129.38.1.1ftptcp \[Quidway-Serial0\]natserverglobal202.38.160.1inside129.38.1.2telnettcp \[Quidway-Serial0\]natserverglobal202.38.160.1inside129.38.1.3wwwtcp 设有公网IP:202.38.160.101~202.38.160.103可以使用。;对外访问(原例题) \[Quidway\]nataddress-group202.38.160.101202.38.160.103pool1;建立地址池 \[Quidway\]acl1 \[Quidway-acl-1\]rulepermitsource10.110.10.00.0.0.255;指定允许的内部网络 \[Quidway-acl-1\]ruledenysourceany \[Quidway-acl-1\]intserial0 \[Quidway-Serial0\]natoutbound1address-grouppool1;在s0口从地址池取出IP对外访问 \[Quidway-Serial0\]natserverglobal202.38.160.101inside10.110.10.1ftptcp \[Quidway-Serial0\]natserverglobal202.38.160.102inside10.110.10.2wwwtcp \[Quidway-Serial0\]natserverglobal202.38.160.1028080inside10.110.10.3wwwtcp \[Quidway-Serial0\]natserverglobal202.38.160.103inside10.110.10.4smtpudp 华为路由器交换机配置命令:PPP设置:\[Quidway-s0\]link-protocolppp;默认的协议 **华为路由器交换机配置命令:PPP验证:** 主验方:pap|chap \[Quidway\]local-userq2password\{simple|cipher\}hello;路由器1 \[Quidway\]interfaceserial0 \[Quidway-serial0\]pppauthentication-mode\{pap|chap\} \[Quidway-serial0\]pppchapuserq1;pap时,没有此句 **华为路由交换机配置命令:pap被验方:** \[Quidway\]interfaceserial0;路由器2 \[Quidway-serial0\]ppppaplocal-userq2password\{simple|cipher\}hello **华为路由器交换机配置命令:chap被验方:** \[Quidway\]interfaceserial0;路由器2 \[Quidway-serial0\]pppchapuserq2;自己路由器名 \[Quidway-serial0\]local-userq1password\{simple|cipher\}hello;对方路由器名 帧中继frame-relay(二分册6-61) \[q1\]frswitching \[q1\]ints1 \[q1-Serial1\]ipaddress192.168.34.51255.255.255.0 \[q1-Serial1\]link-protocolfr;封装帧中继协议 \[q1-Serial1\]frinterface-typedce \[q1-Serial1\]frdlci100 \[q1-Serial1\]frinarp \[q1-Serial1\]frmapip192.168.34.52dlci100 \[q2\]ints1 \[q2-Serial1\]ipaddress192.168.34.52255.255.255.0 \[q2-Serial1\]link-protocolfr \[q2-Serial1\]frinterface-typedte \[q2-Serial1\]frdlci100 \[q2-Serial1\]frinarp \[q2-Serial1\]frmapip192.168.34.51dlci100 **华为路由器交换机配置命令:帧中继监测** \[q1\]displayfrlmi-info\[\]interfacetypenumber\] \[q1\]displayfrmap \[q1\]displayfrpvc-info\[serialinterface-number\]\[dlcidlci-number\] \[q1\]displayfrdlci-switch \[q1\]displayfrinterface \[q1\]resetfrinarp-info \[q1\]debuggingfrall\[interfacetypenumber\] \[q1\]debuggingfrarp\[interfacetypenumber\] \[q1\]debuggingfrevent\[interfacetypenumber\] \[q1\]debuggingfrlmi\[interfacetypenumber\] **华为路由器交换机配置命令:启动ftp服务:** \[Quidway\]local-userftppassword\{simple|cipher\}aaaservice-typeftp \[Quidway\]ftpserverenable [Link 1]: https://baike.baidu.com/item/%E8%99%9A%E6%8B%9F%E5%B1%80%E5%9F%9F%E7%BD%91 [Link 2]: https://baike.baidu.com/item/%E7%BB%88%E7%AB%AF%E8%AE%BE%E5%A4%87 [Link 3]: https://baike.baidu.com/item/%E4%B8%AD%E7%BB%A7%E9%93%BE%E8%B7%AF [Link 4]: https://baike.baidu.com/item/%E4%BA%A4%E6%8D%A2%E6%9C%BA [VLAN]: https://baike.baidu.com/item/%E6%9C%AC%E5%BE%81VLAN [Link 5]: https://baike.baidu.com/item/%E6%95%B0%E6%8D%AE%E5%8C%85 [70]: /images/20220522/c2849f6f780646ff97af1b6cc2dc50b5.png [70 1]: /images/20220522/34746498600440bc85d0428616be9088.png [https_blog.csdn.net_yongchaocsdn_article_details_70246157]: https://blog.csdn.net/yongchaocsdn/article/details/70246157 [http_support.huawei.com_enterprise_zh_doc_EDOC1000178156]: http://support.huawei.com/enterprise/zh/doc/EDOC1000178156 [imgDownload_uuid_dc3f33a1be08475db419ad8621484e52.gif]: /images/20220522/8884543e8f4a45b7bea78a1308a4332e.png [Link 6]: http://network.51cto.com/art/201001/177441.htm
还没有评论,来说两句吧...