交换机配置与查看(华三、华为)
⼤部分命令默认是华三的;华为的命令会特别注明
交换机系统⽂件操作命令
dir            #相当于ls,不显⽰隐藏⽂件
dir /all        #显⽰隐藏⽂件
save            #其他命令详见华为产品⽂档---命令参考---⽂件管理命令
<H3C>logfile save              #将⽇志保存为⽂件(貌似不是简单的logbuffer啊,因为该⽇志⽂件记录的信息⽐logbuffer多,显⽰⽇期也更久)
<H3C>more logfile/logfile.log  #查看⽇志⽂件
<H3C>cd logfile/        #切换⽬录
<H3C>delete logfile.log
交换机系统⽂件操作命令
堆叠状态查看
dis cu conf irf
<H3C>dis irf
<H3C>display irf link
<H3C>display irf topology
<H3C>display irf configuration
irf-port 1/2
<H3C>dis link-aggregation verbose
display mad verbose
<Huawei>dis stack
<Huawei>display eth-trunk
堆叠状态查看
交换机如何配置为tftp服务器??
交换机系统命令(软硬件信息、配置等)
<H3C>display diagnostic-information    #系统全⾯⾃检,可以保存结果到⽂件or直接显⽰结果
display version
display device
display power              #查看电源,State为Normal
display fan                #查看风扇,State为Normal
display cpu                #查看cpu的占⽤率,是否忽⾼忽低,震荡较⼤,或者⼀直很⾼;不要超过70%;期望要求低于30%
display memory              #查看内存占⽤率,不要超过70%;FreeRatio⼤于%70
display boot-loader        #系统启动⽂件系统
display logbuffer          #查看系统⽇志
display logbuffer summary
<H3C>display current-configuration
<H3C>display saved-configuration
<H3C>display current-configuration diff    #⽐较当前配置与保存的配置的区别
交换机系统命令(软硬件信息、配置等)
接⼝相关命令
display interface brief
display interface | include crc      ⼀般情况下为0 CRC;出现⾮零的情况,再观察端⼝crc有⽆明显增长。
display ip interface brief
display interface g0/0/0    #查看端⼝协商,双⼯模式等;观察error是否丢包,、CRC(⼀般也是链路问题导致的丢包);
fiber为光⼝;twisted pair为双绞线
Flow-control is not enabled
display transceiver diagnosis interface ten1/0/49      #查看收发光信息
display transceiver manuinfo interface ten1/0/49        #查看光模块信息
display transceiver interface ten1/0/49                #查看光模块信息
display transceiver alarm interface    #查看光模块的告警信息
display like-aggregation verbose bridge-aggregation        #查看聚合端⼝的⼦接⼝
display monitor-link group all
接⼝相关命令
查看流控相关配置
[Huawei]display cu conf acl
[Huawei]display cu conf classifier
[Huawei]display cu conf behavior
[Huawei]display cu conf trafficpolicy
[Huawei]display cu inter g0/0/0
[Huawei]display cu conf ospf
[Huawei]display cu conf bgp
查看流控相关配置
动态路由协议查看
display ip routing-table statistics        #查看路由统计信息,注意added和deleted数据以及系统运⾏时间
display ip routing-table                    #查看⽹络设备路由表
display ip routing-table vpn-instance xxxx  #查看vpn⽰例路由表
<H3C>display ospf peer
<Huawei>dis ospf peer
<H3C>display bgp peer ipv4
<Huawei>dis bgp peer
dis cu conf bgp
动态路由协议查看
icmp配置
华三
ip unreachables enable #默认关闭,icmp reply正常,但该功能关闭将导致traceroute最后⼀跳⽆响应(traceroute使⽤udp,⽬的IP设备需要回复icmp unreachables报⽂) ip ttl-expires enable  #默认关闭,icmp reply正常,但该功能关闭将导致traceroute中间设备⽆响应(traceroute使⽤udp,中间设备需
回复ip ttl-expires报⽂)
icmp配置
info-center 信息中⼼(在华三⽂档的分类就是信息中⼼)应该就是syslog
//华为版本
配置交换机⽇志推送到⽇志主机: eg:⽇志主机IP地址:
[HW] system-view
[HW] info-center channel 6 name loghost1
[HW] info-center source default channel loghost1 log state on
[HW] info-center loghost source *******
[HW] info-center channel loghost1
[HW] commit
/
/华三版本
[H3C] system-view
[H3C] info-center host 1.1.1.1 6
# 开启信息中⼼。
<Sysname> system-view
[Sysname] info-center enable
# 指定向⽇志主机输出⽇志信息的通道为 loghost 通道。
[Sysname] info-center loghost 1.2.0.1 channel loghost
# 关闭所有模块⽇志主机的 log、trap、debug 的状态。
[Sysname] info-center source default channel loghost debug state off log state off trap state off
注意:
由于系统对各通道允许输出的系统信息的缺省情况不⼀样,所以配置前必须将所有模块的需求通道(本例为loghost )上log、trap、debug 状态设为关闭,再根据当前的需求配置输出相应的系统信息。可以⽤displaychannel 命令查看通道的状态。# 将 IP 地址为 1.2.0.1/16 的主机作为⽇志主机,设置信息级别为informational,输出语⾔为英⽂,允许输出信息的模块为所有模块。
[Sysname] info-center loghost 1.2.0.1 facility local7 language english
[Sysname] info-center source default channel loghost log level informational
info-center 信息中⼼(在华三⽂档的分类就是信息中⼼)应该就是syslog
snmp
=====================================================================================================
⽹络管理和监控配置指导 www.h3c/cn/d_202104/1404142_30005_0.htm
SNMP⽹络架构由三部分组成:NMS、Agent和MIB。
个⼈理解:snmp基于C/S架构,NMS提供web管理页⾯,agent是部署在交换机or服务器上的,MIB(Management Information Base,管理信息库)
NMS会主动发起get/set操作,agent负责响应(猜测⽆论是谁,只要发起请求,agent就会响应)
配置trap的相关配置后,当有告警出现,agent会主动发出告警
MIB虽然是在agent上,但猜测应该是通过NMS进⾏配置的。
==============================================================================================
华三交换机:
snmp-agent                                                #启动SNMP Agent服务,默认是关闭的
snmp-agent local-engineid xxxxxxxxx                        #系统⾃动⽣成,⽆需配置
snmp-agent community read readtest                        #只读团体名为readtest,读写团体名为writetest
snmp-agent community write writetest                    #只读团体名为readtest,读写团体名为writetest
snmp-agent sys-info version all                            #{ all | { v1 | v2c | v3 } * },选择启⽤的snmp版本,默认为v3    #此处应该选择v3
#snmp-agent sys-info version v2c v3
snmp-agent group v3 group_name authentication read-view iso-view write-view iso-view notify-view iso-view                #创建SNMPv3组,缺省情况下,设备上没有配置SNMP组,新配置的SNMP组采⽤不认证、不加密⽅式建⽴SNMPv3连接时,是否进⾏认证和加密,受snmp-agent group v3和snmp-agent usm-user v3两条命令的影响:
创建组时,如果不指定authentication和privacy参数,则表⽰不认证不加密。此时,使⽤和该组绑定的⽤户名建⽴SNMP连接时,均不认证不加密。即便⽤户配置了认证密码/加密密码,认证密码/加密密码也不⽣效。
创建组时,如果指定authentication参数,则表⽰认证不加密。此时,使⽤和该组绑定的⽤户名建⽴SNMP连接时,均认证不加密。即便⽤户配置了加密密码,加密密码也不⽣效。该组内的⽤户必须配置认证密码,否则,不能建⽴SNMP连接创建组时,如果指定privacy参数,则表⽰认证加密。此时,使⽤和该组绑定的⽤户名建⽴SNMP连接时,均认证加密。该组内的⽤户必须配置认证密码和加密密码,否则,不能建⽴SNMP连接。
snmp-agent target-host trap address udp=domin $ip udp-port $port params securityname monitor_user v2c                    #设置Trap报⽂的⽬的主机
snmp-agent target-host trap address udp=domin $ip udp-port $port params securityname monitor_use
r v2c                    #可以配置多条
snmp-agent mib-view included iso-view iso                                                                                #创建MIB视图或更新MIB视图内容
snmp-agent usm-user v3 monitor_user monitor_group cipher authentication-mode md5 $password                                #创建SNMPv3⽤户
snmp-agent usm-user v3 username group_name simple authentication-mode md5 111111 privacy-mode des 222222                  #⽤户名h3c,⽤户组group_name,认证协议md5,认证密码:111111,加密协议:DES,加密密码:222222
snmp-agent trap source LoopBack1
--------------------------------------------------------------------------
华为交换机:
snmp-agent
snmp-agent local-engineid xxxxxxxxx
snmp-agent sys-info version v3
snmp-agent group v3 snmpv3_alibaba authentication read-view iso-view write-view iso-view notify-view iso-view
snmp-agent mib-view included iso-view iso
snmp-agent usm-user v3 alimonitor
snmp-agent usm-user v3 alimonitor group snmpv3_alibaba
snmp-agent usm-user v3 alimonitor authentication-mode md5 cipher $password
snmp
镜像端⼝
[H3C] mirroring-group 1 local        # 创建本地镜像组。
[H3C] mirroring-group 1 mirroring-port ten-gigabitethernet 3/0/1 ten-gigabitethernet 3/0/2 inbound  # 将Ten-GigabitEthernet3/0/1和Ten-GigabitEthernet3/0/2配置为镜像源端⼝,对这两个端⼝接收的报⽂进⾏
镜像。
[H3C] mirroring-group 1 monitor-port ten-gigabitethernet 3/0/3        # 将Ten-GigabitEthernet3/0/3配置为镜像⽬的端⼝。
[DeviceA] display mirroring-group 1        # 在完成上述配置后,在DeviceA上显⽰镜像组1的配置信息。
镜像端⼝
⽤户配置 + telnet/ssh登录设备配置
===============================================================================================================
● network-admin:具有最⾼权限,可操作系统所有功能和度资源(除安全⽇志⽂件管理相关命令外),配置此权限默认会给network-operator权限。
● network-operator:可执⾏系统所有功能和答资源的相关回display命令(除安全⽇志等查看命令外,具体⼤家可以⾃答⾏查看)
dis cu configuration local-user
-
--------------------------------------------------------------------------------------------------------------
华三配置telnet登录交换机---登录设备配置举例
#
telnet server enable
telnet server acl 2000
#
acl basic 2000
rule 1 permit source 192.168.0.46 0
rule 2 permit source 192.168.0.52 0
rule 3 deny
#
line vty 0 63
authentication-mode scheme
user-role network-operator
#
local-user userA class manage
password hash $h$6$I2Sg4Llj1qVUWQZ3$JA6KkU3zfVVRg48MM92X6cVpdiqR2JF887PKi3GQMwnXXXcsWBuz7GIeJZeeNFMmMBaV7DPkKblnb0sGT2axvg==
service-type telnet
authorization-attribute user-role network-admin
#
local-user userB class manage
password hash $h$6$q+c3OcSxrPpDpsDf$BWkgfOyxBLyR5zyYgF/+VvN/1ofy81zoHDlFf80OjDla6/EiSJbSBl33PeazilSkWSYcttkg5v5bGecB7oYwAw==
service-type telnet
authorization-attribute user-role roleB
#
role name roleB
rule 1 permit read feature
---------------------------------------------------------------------------------------------------------------
华三配置ssh登录交换机---SSH典型配置举例
line vty 0 63
authentication-mode scheme
#
ssh server enable
#
local-user client001 class manage
password hash $h$6$CqMnWdX6LIW/hz2Z$4+0Pumk+A98VlGVgqN3n/mEi7hJka9fEZpRZIpSNi9bcBEXhpvIqaYTvIVBf7ZUNGnovFsqW7nYxjoToRDvYBg==
service-type ssh
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
---------------------------------------------------------------------------------------------------------------
华为⽤户配置
<HUAWEI> system-view
[~HUAWEI] aaa
[~HUAWEI-aaa] local-user admin password irreversible-cipher $password
[~HUAWEI-aaa] commit
<H3C> system-view [H3C] local-user admin class manage
[H3C] password hash $password
<HUAWEI> system-view
[~HUAWEI] sysname SwitchA
[*HUAWEI] commit
[~SwitchA] observe-port 1 interface 10ge 1/0/2
[*SwitchA] commit
[~SwitchA] interface 10GE 1/0/1
[~SwitchA-10GE1/0/1] port-mirroring observe-port 1 inbound
[*SwitchA-10GE1/0/1] commit
[~SwitchA-10GE1/0/1] return
<SwitchA> display port-mirroring
⽤户配置 + telnet/ssh登录设备配置
其他配置查看
display current-configuration | in load-sharing
display current-configuration | in arp
display current-configuration | in mac
display current-configuration | inmonitor-link
display current-configuration | in ntp
display license
其他配置查看
其他命令
<H3C>display mac-address mac-move  #查看mac地址漂移
<Huawei>display mac-address flapping    #查看mac地址漂移
display stp
display stp brief          #查看STP⾮正常阻塞端⼝
display stp abnormal-port  #查看STP⾮正常阻塞端⼝
display snmp-agent trap-list    #查看trap功能设置
display curr | inc snmp-agent
display lldp neighbor-information list
display vrrp
其他命令
常⽤⽹络测试命令
ping
ping -vpn-instance xxxxxxxx 10.0.0.1
tracert
traceroute          #traceroute可以显⽰出ecmp路由
tracepath          #显⽰内容与traceroute不同,不能显⽰ecmp路由
常⽤⽹络测试命令
reset counters interface E1/0/1
dis vxlan tunnel
vxlan⼆层转发逻辑;vxlan三层转发逻辑
==================================================================
vxlan⼆层转发逻辑(基于下⾯的实验配置):
1.数据包从交换机发出,路由器⼦接⼝接收
2.路由器⼦接⼝配置了'xconnect vsi test_vsi',所以报⽂被转⼊到vsi交换机
3.vsi交换机配置了vxlan 1111以及使⽤tunnel 1,所以报⽂被封装vxlan vni 1111,同时数据被转发到vxlan隧道Tunnel1
4.对端vtep接收到报⽂,拆解vxlan,根据vxlan vni 1111将报⽂放⼊到相应的vsi交换机
5.。。。。。
conf---------------------------------------------------------------------------
vxlan三层转发逻辑:
⼊⽹场景:
1.交换机接收报⽂,报⽂进⼊vpn实例路由空间
2.查看vpn实例路由表,匹配到相应的静态路由:该路由指定了出接⼝为Vsi-interface,同时指定了下⼀跳
3.交换机根据静态路由,⾛了vxlan隧道(因为Vsi-interface接⼝就是vsi交换机的3层接⼝?还是arp static指定了下⼀跳⾛vxlan隧道?)
出⽹场景:
1.交换机从vxlan隧道接收到报⽂
2.拆分vxlan,发现vxlan vni,把报⽂放⼊到相应的vsi交换机,即报⽂到达了vpn实例(从这⼀步看,猜测Vsi-interface接⼝就是vsi交换机的3层接⼝,将Vsi-interface接⼝绑定到vpn实例,相当于将vsi交换机放⼊到vpn实例中)
3.根据vpn实例路由表进⾏路由转发
vxlan⼆层转发逻辑;vxlan三层转发逻辑
vxlan⼆层转发实验;vxlan三层转发配置
=================================================================================
blog.csdn/qq_29910529/article/details/103939980 H3C VXLAN实验
模拟器的交换机不⽀持配置vxlan,需要使⽤路由器进⾏配置
-----------------------------------------------------------------------
vxlan⼆层转发实验
开启L2VPN功能;缺省情况下,L2VPN功能处于关闭状态
l2vpn enable
创建VXLAN隧道
interface Tunnel1 mode vxlan
source 10.0.0.1
destination 10.0.0.2
创建VXLAN;关联VXLAN和VXLAN隧道
vsi test_vsi        #VSI(Virtual Switch Instance,虚拟交换实例):VTEP上为⼀个VXLAN提供⼆层交换服务的虚拟交换实例。
#VSI可以看做是VTEP上的⼀台基于VXLAN进⾏⼆层转发的虚拟交换机,它具有传统以太⽹交换机的所有功能,包括源MAC地址学习、MAC地址⽼化、泛洪等。VSI与VXLAN⼀⼀对应。 vxlan 1111        #创建VXLAN
tunnel 1          #关联VXLAN和VXLAN隧道,即配置了vsi test_vsi转发⼆层报⽂,转发时携带vni 1111,穿越vxlan隧道 tunnel 1
-----------------------------
配置⼦接⼝,将接⼝连接(捆绑)到vsi交换机
interface GigabitEthernet0/1.200
vlan-type dot1q vid 200
xconnect vsi test_vsi
-----------------------------
另起⼀台交换机,模拟客户端
接⼝配置trunk,起vlanif接⼝模拟vm
vm同样使⽤ip 10.0.0.1;10.0.0.2
=============================================================================
vxlan3层转发:需要在⼆层转发的配置基础上,在vsi交换机上起⼀个3层接⼝,通过这个3层接⼝实现抓发
> vsi vsi170
>  gateway vsi-interface 170
>  vxlan 15737250
>  tunnel 1
> interface Vsi-interface170
>  ip binding vpn-instance vpn-11111111
>  ip address 100.64.2.169 255.255.255.252
>  mac-address 0000-5e00-0102
>  arp static 100.64.2.170 0001-0203-0400 Vsi-interface170 Tunnel1 vsi vsi170 vpn-instance vpn-11111111
>  ip route-static vpn-instance vpn-11111111 192.168.0.0 17 Vsi-interface170 100.64.2.170
>  ip route-static vpn-instance vpn-11111111 172.16.0.0 17 Route-Aggregation1.2030 10.10.209.149
vxlan⼆层转发实验;vxlan三层转发配置
scp 10.1.1.1 put startup.cfg /root/startup.cfg source
scp 10.1.1.1 22 get /lizp/S6800-CMW710-SYSTEM-R2612P02H3113.bin