华为交换机基本配置命令参考
system-view
sysname S5700
clock timezone Beijing,Chongqing,Hongkon,Urumqi add 08:00:00
display clock
system-view
aaa
local-user root password cipher P@ssw0rd privilege level 3 #admin已经存在,cipher会改不了密码
local-user root password irreversible-cipher P@ssw0rd privilege level 3
local-user root service-type telnet ftp #root用户可以登录telnet和ftp服务
local-user root ftp-directory flash:/ #配置root用户ftp访问目录,如果不配置登录输入密码后会马上断开
local-user root privilege level 3
quit
user-interface vty 0 4
authentication-mode aaa
protocal inbound all #此命令只能手工输入,粘贴无效
user privilege level 15
quit
system-view
vlan 10
quit
system-view
stp root primary #指定生成对根交换机
stp root secondary #指定交换机为生成树备份根交换机
undo stp root #取消交换机的根交换机或备份根交换机资格
quit
system-view
int gigabitethernet 0/0/1
port link-type access
quit
system-view
vlan 121
port gigabitethernet 0/0/21 to 0/0/22
quit
system-view
interface Gigabitethernet 0/0/23
port link-type trunk
port trunk allow-pass vlan 128 131
system-view
interface vlanif 1
ip address 192.168.0.253 255.255.255.0
shutdown
undo shutdown
system-view
ip route-static 0.0.0.0 0.0.0.0 192.168.0.254
NTP
system-view
ntp-service unicast-peer 192.168.0.254
system-view
undo http server enable
undo dhcp enable
save
system-view
interface eth-trunk 1
quit
interface Ethernet0/0/1
eth-trunk 1
quit
interface Ethernet0/0/2
eth-trunk 1
quit
interface Ethernet0/0/3
eth-trunk 1
quit
display trunkmembership
display trunkmembership eth-trunk 1
display eth-trunk 1
display version
display current-configuration
display saved-configuration
display interfaces brief
display ip routing-table
display sysname
display startup #显示启动配置信息
display local-user
display pat #显示补丁安装信息
display device #查看板卡运行状态
ls #列出flash中文件名称,不带文件信息
dir #列出flash中文件信息
undo interface vlanif 20
undo vlan 20
ip route-static 0.0.0.0 0.0.0.0 192.168.0.254
undo ip route-static 0.0.0.0 0.0.0.0 192.168.0.254
directory of flash:/
system-view
http server load s5700si-v100r005c01spc100.web.zip #载入Web管理介面
http server enable
ftp server enable ##配置FTP服务用于升级固件
reboot
当Master交换机主动放弃Master地位(如Master交换机退出备份组)时,会发送优先级为0的通告报文,用来使Backup交换机快速切换成Master交换机,而不用等到Master_Down_Interval定时器超时。这个切换的时间称为Skew time,计算方式为:(256-Backup交换机的优先级)/256,单位为秒。
当Master交换机发生网络故障而不能发送通告报文的时候,Backup交换机并不能立即知道其工作状况。等到Master_Down_Interval定时器超时后,才会认为Master交换机无法正常工作,从而将状态切换为Master。其中,Master_Down_Interval定时器取值为:(3×Advertisement_Interval)+Skew_time,单位为秒。
在性能不稳定的网络中,网络堵塞可能导致Backup交换机在Master_Down_Interval期间没有收到Master交换机的报文,Backup交换机则会主动切换为Master。如果此时原Master交换机的报文又到达了,新Master交换机将再次切换回Backup。如此则会出现VRRP备份组成员状态频繁切换的现象。为了缓解这种现象,可以配置抢占延时,使得Backup交换机在等待了Master_Down_Interval后,再等待抢占延迟时间。如在此期间仍没有收到通告报文,Backup交换机才会切换为Master交换机。
systemview
vrrp viersion v3 #配置当前设备的VRRP协议版本号,缺省情况下,VRRP协议版本号为v2
#VRRP协议包括两个版本:VRRPv2和VRRPv3,VRRPv2仅适用于IPv4网路,VRRPv3适用于IPv4和IPv6两种网络。
#VRRPv2和VRRPv3的主要区别为:
? #1.支持的网络类型不同。VRRPv3适用于IPv4和IPv6两种网络,而VRRPv2仅适用于IPv4网络。
? #2.认证功能不同。VRRPv3不支持认证功能,而VRRPv2支持认证功能。
? #3.发送通告报文的时间间隔的单位不同。VRRPv3支持的是厘秒级,而VRRPv2支持的是秒级。
#基于不同的网络类型,VRRP还可以分为VRRP for IPv4和VRRP for IPv6(简称VRRP6)。
#VRRP for IPv4支持VRRPv2和VRRPv3,而VRRP for IPv6仅支持VRRPv3。
vrrp version-3 send-packet-mode v2v3-both #缺省情况下,VRRPv3版本备份组发送通告报文的模式为v3-only。
#可选配置,还可以执行命令vrrp version-3 send-packet-mode { v2-only | v3-only | v2v3-both },配置VRRPv3发送通告报文的模式。
systemview
interface vlanif 100
vrrp vrid 1 authentication-mode md5 hello #配置备份组1的认证方式为MD5认证,认证字为hello。
#同一VRRP备份组配置的认证方式和认证字必须相同,否则Master设备和Backup设备无法协商成功。
vrrp vrid 1 virtual-ip 10.1.1.111 #配置VIP
vrrp vrid 1 priority 120 #配置优先级120
vrrp vrid 1 preempt-mode timer delay 20 #配置的抢占延迟时间,解决设备主备状态频繁切换
quit
display vrrp protocol-information #检查各Master设备配置的VRRP版本和报文发送方式
display vrrp virtual-router-id #检查各Master设备配置的虚拟IP地址、通告报文发送间隔、认证方式及认证字是否一致