分类 网络 下的文章

网络中部署VRRP负载分担时,多台设备同时承担业务,每个虚拟设备都包括一个Master设备和若干个Backup设备。如果为了接入备份需要同时部署冗余链路,则需要部署MSTP消除网络中的环路,保证流量的负载分担。

如图所示,主机通过SwitchC接入网络,SwitchC通过双上行连接SwitchA和SwitchB来接入Internet。由于接入备份的需要,用户部署了冗余链路。冗余备份链路的存在导致出现环网,可能会引起广播风暴和MAC地址表项被破坏。用户希望在存在冗余备份链路的同时消除网络中的环路,在一条上行链路断开的时候,流量能切换到另外一条上行链路转发,还能合理利用网络带宽。此时可以在网络中部署MSTP解决环路问题。MSTP可阻塞二层网络中的冗余链路,将网络修剪成树状,达到消除环路的目的。同时在SwitchA和SwitchB上配置VRRP,HostA以SwitchA为默认网关接入Internet,SwitchB作为备份网关;HostB以SwitchB为默认网关接入Internet,SwitchA作为备份网关,以实现可靠性及流量的负载分担。
此章节摘自于华为官方文档,我做过类似的项目,所以放这里,以便以后查看。
75113-9qgb2s42r8.png
67972-bny80u44koj.png

采用以下思路配置:

  1. 在处于环形网络中的交换设备上配置MSTP基本功能,包括:
    a. 配置MST域并创建多实例,配置VLAN2映射到MSTI1,VLAN3映射到MSTI2,实现流量的负载分担。
    b. 在MST域内,配置各实例的根桥与备份根桥。
    c. 配置各实例中某端口的路径开销值,实现将该端口阻塞。
    d. 使能MSTP,实现破除环路,包括:
    设备全局使能MSTP。
    除与终端设备相连的端口外,其他端口使能MSTP。
  2. 配置保护功能,实现对设备或链路的保护。例如:在各实例的根桥设备指定端口
    配置根保护功能。
  3. 配置设备的二层转发功能。
  4. 配置各设备端口IP地址及路由协议,使各设备间网络层连通。
  5. 在SwitchA和SwitchB上创建VRRP备份组1和VRRP备份组2,在备份组1中,配置SwitchA为Master设备,SwitchB为Backup设备;在备份组2中,配置SwitchB为Master设备,SwitchA为Backup设备。
    操作步骤
    步骤1 配置MSTP基本功能
  6. 配置SwitchA、SwitchB、SwitchC到域名为RG1的域内,创建实例MSTI1和实例
    MSTI2
    配置SwitchA的MST域。

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] stp region-configuration //进入MST域视图。
    [SwitchA-mst-region] region-name RG1 //配置域名为RG1。
    [SwitchA-mst-region] instance 1 vlan 2 //将VLAN 2映射到实例1上。
    [SwitchA-mst-region] instance 2 vlan 3 //将VLAN 3映射到实例2上。
    [SwitchA-mst-region] active region-configuration //激活MST域的配置。
    [SwitchA-mst-region] quit

    配置SwitchB的MST域。

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchB
    [SwitchB] stp region-configuration //进入MST域视图。
    [SwitchB-mst-region] region-name RG1 //配置域名为RG1。
    [SwitchB-mst-region] instance 1 vlan 2 //将VLAN 2映射到实例1上。
    [SwitchB-mst-region] instance 2 vlan 3 //将VLAN 3映射到实例2上。
    [SwitchB-mst-region] active region-configuration //激活MST域的配置。
    [SwitchB-mst-region] quit

    配置SwitchC的MST域。

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchC
    [SwitchC] stp region-configuration //进入MST域视图。
    [SwitchC-mst-region] region-name RG1 //配置域名为RG1。
    [SwitchC-mst-region] instance 1 vlan 2 //将VLAN 2映射到实例1上。
    [SwitchC-mst-region] instance 2 vlan 3 //将VLAN 3映射到实例2上。
    [SwitchC-mst-region] active region-configuration //激活MST域的配置。
    [SwitchC-mst-region] quit
  7. 在域RG1内,配置MSTI1与MSTI2的根桥与备份根桥
    – 配置MSTI1的根桥与备份根桥

    # 配置SwitchA为MSTI1的根桥。
    [SwitchA] stp instance 1 root primary
    # 配置SwitchB为MSTI1的备份根桥。
    [SwitchB] stp instance 1 root secondary
    – 配置MSTI2的根桥与备份根桥
    # 配置SwitchB为MSTI2的根桥。
    [SwitchB] stp instance 2 root primary
    # 配置SwitchA为MSTI2的备份根桥。
    [SwitchA] stp instance 2 root secondary
  8. 配置实例MSTI1和MSTI2中将要被阻塞端口的路径开销值大于缺省值
    说明
    – 端口路径开销值取值范围由路径开销计算方法决定,这里选择使用华为计算方法为例,
    配置实例MSTI1和MSTI2中将被阻塞端口的路径开销值为20000。
    – 同一网络内所有交换设备的端口路径开销应使用相同的计算方法。

    # 配置SwitchA的端口路径开销计算方法为华为计算方法。
    [SwitchA] stp pathcost-standard legacy
    # 配置SwitchB的端口路径开销计算方法为华为计算方法。
    [SwitchB] stp pathcost-standard legacy
    #配置SwitchC的端口路径开销计算方法为华为计算方法,将端口GE1/0/1在实例MSTI2中的路径开销值配置为20000,将端口GE1/0/4在实例MSTI1中的路径开销值配置为20000。
    [SwitchC] stp pathcost-standard legacy
    [SwitchC] interface gigabitethernet 1/0/1
    [SwitchC-GigabitEthernet1/0/1] stp instance 2 cost 20000
    [SwitchC-GigabitEthernet1/0/1] quit
    [SwitchC] interface gigabitethernet 1/0/4
    [SwitchC-GigabitEthernet1/0/4] stp instance 1 cost 20000
    [SwitchC-GigabitEthernet1/0/4] quit
  9. 使能MSTP,实现破除环路
    – 设备全局使能MSTP

    # 在SwitchA上启动MSTP。
    [SwitchA] stp enable
    # 在SwitchB上启动MSTP。
    [SwitchB] stp enable
    # 在SwitchC上启动MSTP。
    [SwitchC] stp enable

    – 将与Host相连的端口配置为边缘端口

    [SwitchC] interface gigabitethernet 1/0/2
    [SwitchC-GigabitEthernet1/0/2] stp edged-port enable
    [SwitchC-GigabitEthernet1/0/2] quit
    [SwitchC] interface gigabitethernet 1/0/3
    [SwitchC-GigabitEthernet1/0/3] stp edged-port enable
    [SwitchC-GigabitEthernet1/0/3] quit
    (可选)配置SwitchC的BPDU保护功能。
    [SwitchC] stp bpdu-protection

    – 将与Router相连的端口配置为边缘端口

    # 配置SwitchA端口。
    [SwitchA] interface gigabitethernet 1/0/3
    [SwitchA-GigabitEthernet1/0/3] stp edged-port enable
    [SwitchA-GigabitEthernet1/0/3] quit
    (可选)配置SwitchA的BPDU保护功能。
    [SwitchA] stp bpdu-protection
    # 配置SwitchB端口。
    [SwitchB] interface gigabitethernet 1/0/3
    [SwitchB-GigabitEthernet1/0/3] stp edged-port enable
    [SwitchB-GigabitEthernet1/0/3] quit
    (可选)配置SwitchB的BPDU保护功能。
    [SwitchB] stp bpdu-protection

    说明
    如果与边缘端口相连的是使能了STP功能的网络设备,配置BPDU保护功能后,如果
    边缘端口收到BPDU报文,边缘端口将会被shutdown,边缘端口属性不变。
    步骤2 配置保护功能,如在各实例的根桥设备的指定端口配置根保护功能

    # 在SwitchA端口GE1/0/1上启动根保护。
    [SwitchA] interface gigabitethernet 1/0/1
    [SwitchA-GigabitEthernet1/0/1] stp root-protection
    [SwitchA-GigabitEthernet1/0/1] quit
    # 在SwitchB端口GE1/0/1上启动根保护。
    [SwitchB] interface gigabitethernet 1/0/1
    [SwitchB-GigabitEthernet1/0/1] stp root-protection
    [SwitchB-GigabitEthernet1/0/1] quit

    步骤3 配置处于环网中的设备的二层转发功能

    l 在交换设备SwitchA、SwitchB、SwitchC上创建VLAN2~3
    # 在SwitchA上创建VLAN2~3。
    [SwitchA] vlan batch 2 to 3
    # 在SwitchB上创建VLAN2~3。
    [SwitchB] vlan batch 2 to 3
    # 在SwitchC上创建VLAN2~3。
    [SwitchC] vlan batch 2 to 3

    l 将交换设备上接入环路中的端口加入VLAN

    # 将SwitchA端口GE1/0/1加入VLAN。
    [SwitchA] interface gigabitethernet 1/0/1
    [SwitchA-GigabitEthernet1/0/1] port link-type trunk
    [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 2 to 3
    [SwitchA-GigabitEthernet1/0/1] quit
    # 将SwitchA端口GE1/0/2加入VLAN。
    [SwitchA] interface gigabitethernet 1/0/2
    [SwitchA-GigabitEthernet1/0/2] port link-type trunk
    [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 to 3
    [SwitchA-GigabitEthernet1/0/2] quit
    # 将SwitchB端口GE1/0/1加入VLAN。
    [SwitchB] interface gigabitethernet 1/0/1
    [SwitchB-GigabitEthernet1/0/1] port link-type trunk
    [SwitchB-GigabitEthernet1/0/1] port trunk allow-pass vlan 2 to 3
    [SwitchB-GigabitEthernet1/0/1] quit
    # 将SwitchB端口GE1/0/2加入VLAN。
    [SwitchB] interface gigabitethernet 1/0/2
    [SwitchB-GigabitEthernet1/0/2] port link-type trunk
    [SwitchB-GigabitEthernet1/0/2] port trunk allow-pass vlan 2 to 3
    [SwitchB-GigabitEthernet1/0/2] quit
    # 将SwitchC端口GE1/0/1加入VLAN。
    [SwitchC] interface gigabitethernet 1/0/1
    [SwitchC-GigabitEthernet1/0/1] port link-type trunk
    [SwitchC-GigabitEthernet1/0/1] port trunk allow-pass vlan 2 to 3
    [SwitchC-GigabitEthernet1/0/1] quit
    # 将SwitchC端口GE1/0/2加入VLAN。
    [SwitchC] interface gigabitethernet 1/0/2
    [SwitchC-GigabitEthernet1/0/2] port link-type access
    [SwitchC-GigabitEthernet1/0/2] port default vlan 2
    [SwitchC-GigabitEthernet1/0/2] quit
    # 将SwitchC端口GE1/0/3加入VLAN。
    [SwitchC] interface gigabitethernet 1/0/3
    [SwitchC-GigabitEthernet1/0/3] port link-type access
    [SwitchC-GigabitEthernet1/0/3] port default vlan 3
    [SwitchC-GigabitEthernet1/0/3] quit
    # 将SwitchC端口GE1/0/4加入VLAN。
    [SwitchC] interface gigabitethernet 1/0/4
    [SwitchC-GigabitEthernet1/0/4] port link-type trunk
    [SwitchC-GigabitEthernet1/0/4] port trunk allow-pass vlan 2 to 3
    [SwitchC-GigabitEthernet1/0/4] quit

    步骤4 验证配置结果
    经过以上配置,在网络计算稳定后,执行以下操作,验证配置结果。
    说明
    本配置举例以实例1和实例2为例,因此不用关注实例0中端口的状态。
    在SwitchA上执行display stp brief命令,查看端口状态和端口的保护类型,结果如
    下:

    [SwitchA] display stp brief
      MSTID      Port                        Role  STP State       Protection
        0        GigabitEthernet1/0/1        DESI  FORWARDING      ROOT
        0        GigabitEthernet1/0/2        DESI  FORWARDING      NONE
        1        GigabitEthernet1/0/1        DESI  FORWARDING      ROOT
        1        GigabitEthernet1/0/2        DESI  FORWARDING      NONE
        2        GigabitEthernet1/0/1        DESI  FORWARDING      ROOT
        2        GigabitEthernet1/0/2        ROOT  FORWARDING      NONE

    在MSTI1中,由于SwitchA是根桥,SwitchA的端口GE1/0/2和GE1/0/1成为指定端口。在
    MSTI2中,SwitchA的端口GE1/0/1成为指定端口,端口GE1/0/2成为根端口。
    在SwitchB上执行display stp brief命令,结果如下:

    [SwitchB] display stp brief
      MSTID      Port                        Role  STP State       Protection
        0        GigabitEthernet1/0/1        DESI  FORWARDING      ROOT
        0        GigabitEthernet1/0/2        ROOT  FORWARDING      NONE
        1        GigabitEthernet1/0/1        DESI  FORWARDING      ROOT
        1        GigabitEthernet1/0/2        ROOT  FORWARDING      NONE
        2        GigabitEthernet1/0/1        DESI  FORWARDING      ROOT
        2        GigabitEthernet1/0/2        DESI  FORWARDING      NONE

    在MSTI2中,由于SwitchB是根桥,端口GE1/0/1和GE1/0/2在MSTI2中成为指定端口。
    在MSTI1中,SwitchB的端口GE1/0/1成为指定端口,端口GE1/0/2成为根端口。
    在SwitchC上执行display stp interface brief命令,结果如下:

     [SwitchC] display stp interface gigabitethernet 1/0/1 brief
      MSTID      Port                        Role  STP State       Protection
        0        GigabitEthernet1/0/1        ROOT  FORWARDING      NONE
        1        GigabitEthernet1/0/1        ROOT  FORWARDING      NONE
        2        GigabitEthernet1/0/1        ALTE  DISCARDING      NONE
    
     [SwitchC] display stp interface gigabitethernet 1/0/4 brief
      MSTID      Port                        Role  STP State       Protection
        0        GigabitEthernet1/0/4        ALTE  DISCARDING      NONE
        1        GigabitEthernet1/0/4        ALTE  DISCARDING      NONE
        2        GigabitEthernet1/0/4        ROOT  FORWARDING      NONE

    SwitchC的端口GE1/0/1在MSTI1中为根端口,在MSTI2中被阻塞。SwitchC的另一个端
    口GE1/0/4,在MSTI1中被阻塞,在MSTI2中为根端口。
    步骤5 配置设备间的网络互连
    配置设备各端口的IP地址,以SwitchA为例。SwitchB的配置与SwitchA类似,详见配
    置文件。

    [SwitchA] vlan batch 4
    [SwitchA] interface gigabitethernet 1/0/3
    [SwitchA-GigabitEthernet1/0/3] port link-type trunk
    [SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 4
    [SwitchA-GigabitEthernet1/0/3] quit
    [SwitchA] interface vlanif 2
    [SwitchA-Vlanif2] ip address 10.1.2.102 24
    [SwitchA-Vlanif2] quit
    [SwitchA] interface vlanif 3
    [SwitchA-Vlanif3] ip address 10.1.3.102 24
    [SwitchA-Vlanif3] quit
    [SwitchA] interface vlanif 4
    [SwitchA-Vlanif4] ip address 10.1.4.102 24
    [SwitchA-Vlanif4] quit

    配置SwitchA、SwitchB和路由器间采用OSPF协议进行互连。以SwitchA为例,
    SwitchB的配置与SwitchA类似,详见配置文件。

    [SwitchA] ospf 1
    [SwitchA-ospf-1] area 0
    [SwitchA-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.0] network 10.1.3.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.0] quit
    [SwitchA-ospf-1] quit

    步骤6 配置VRRP备份组
    在SwitchA和SwitchB上创建VRRP备份组1,配置SwitchA的优先级为120,抢占延时
    为20秒,作为Master设备;SwitchB的优先级为缺省值,作为Backup设备。

    [SwitchA] interface vlanif 2 
    [SwitchA-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 //创建组号为1的VRRP备份组并为备份组指定虚拟IP地址10.1.2.100。
    [SwitchA-Vlanif2] vrrp vrid 1 priority 120 //配置VRRP备份组1的优先级为120。
    [SwitchA-Vlanif2] vrrp vrid 1 preempt-mode timer delay 20 //配置VRRP备份组1抢占延时为20秒。
    [SwitchA-Vlanif2] quit
    [SwitchB] interface vlanif 2
    [SwitchB-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 //创建组号为1的VRRP备份组并为备份组指定虚拟IP地址10.1.2.100。
    [SwitchB-Vlanif2] quit

    在SwitchA和SwitchB上创建VRRP备份组2,配置SwitchB的优先级为120,抢占延时为
    20秒,作为Master设备;SwitchA的优先级为缺省值,作为Backup设备。

    [SwitchB] interface vlanif 3
    [SwitchB-Vlanif3] vrrp vrid 2 virtual-ip 10.1.3.100 //创建组号为2的VRRP备份组并为备份组指定虚拟IP地址10.1.3.100。
    [SwitchB-Vlanif3] vrrp vrid 2 priority 120 //配置VRRP备份组1的优先级为120。
    [SwitchB-Vlanif3] vrrp vrid 2 preempt-mode timer delay 20 //配置VRRP备份组2抢占延时为20秒。
    [SwitchB-Vlanif3] quit
    [SwitchA] interface vlanif 3
    [SwitchA-Vlanif3] vrrp vrid 2 virtual-ip 10.1.3.100 //创建组号为2的VRRP备份组并为备份组指定虚拟IP地址10.1.3.100。
    [SwitchA-Vlanif3] quit

    配置主机HostA的缺省网关为备份组1的虚拟IP地址10.1.2.100,配置主机HostB的缺省
    网关为备份组2的虚拟IP地址10.1.3.100。
    步骤7 验证配置结果
    完成上述配置后,在SwitchA上执行display vrrp命令,可以看到SwitchA在备份组1中
    作为Master设备,在备份组2中作为Backup设备。

     [SwitchA] display vrrp
       Vlanif2 | Virtual Router 1
         State : Master
         Virtual IP : 10.1.2.100
         Master IP : 10.1.2.102
         PriorityRun : 120
         PriorityConfig : 120                                                        
         MasterPriority : 120                                                        
         Preempt : YES   Delay Time : 20 s                                           
         TimerRun : 1 s                                                              
         TimerConfig : 1 s                                                           
         Auth type : NONE                                                            
         Virtual MAC : 0000-5e00-0101                                                
         Check TTL : YES                                                             
         Config type : normal-vrrp                                                   
         Backup-forward : disabled
         Create time : 2012-05-11 11:39:18                                           
         Last change time : 2012-05-26 11:38:58
       Vlanif3 | Virtual Router 2
         State : Backup
         Virtual IP : 10.1.3.100
         Master IP : 10.1.3.103
         PriorityRun : 100
         PriorityConfig : 100                                                        
         MasterPriority : 120                                                        
         Preempt : YES   Delay Time : 0 s                                            
         TimerRun : 1 s                                                              
         TimerConfig : 1 s                                                           
         Auth type : NONE                                                            
         Virtual MAC : 0000-5e00-0102                                                
         Check TTL : YES                                                             
         Config type : normal-vrrp                                                   
         Backup-forward : disabled
         Create time : 2012-05-11 11:40:18                                           
         Last change time : 2012-05-26 11:48:58

    在SwitchB上执行display vrrp命令,可以看到SwitchB在备份组1中作为Backup设备,
    在备份组2中作为Master设备。

     [SwitchB] display vrrp
       Vlanif2 | Virtual Router 1
         State : Backup
         Virtual IP : 10.1.2.100
         Master IP : 10.1.2.102
         PriorityRun : 100
         PriorityConfig : 100                                                        
         MasterPriority : 120                                                        
         Preempt : YES   Delay Time : 0 s                                            
         TimerRun : 1 s                                                              
         TimerConfig : 1 s                                                           
         Auth type : NONE                                                            
         Virtual MAC : 0000-5e00-0101                                                
         Check TTL : YES                                                             
         Config type : normal-vrrp                                                   
         Backup-forward : disabled
         Create time : 2012-05-11 11:39:18                                           
         Last change time : 2012-05-26 11:38:58
       Vlanif3 | Virtual Router 2
         State : Master
         Virtual IP : 10.1.3.100
         Master IP : 10.1.3.103
         PriorityRun : 120
         PriorityConfig : 120                                                        
         MasterPriority : 120                                                        
         Preempt : YES   Delay Time : 20 s                                            
         TimerRun : 1 s                                                              
         TimerConfig : 1 s                                                           
         Auth type : NONE                                                            
         Virtual MAC : 0000-5e00-0102                                                
         Check TTL : YES                                                             
         Config type : normal-vrrp                                                   
         Backup-forward : disabled
         Create time : 2012-05-11 11:40:18                                           
         Last change time : 2012-05-26 11:48:58 

    ----结束
    配置文件
    SwitchA的配置文件

#
sysname SwitchA
#
vlan batch 2 to 4
#
stp instance 1 root primary
stp instance 2 root secondary
stp bpdu-protection
stp pathcost-standard legacy
#
stp region-configuration
 region-name RG1
 instance 1 vlan 2
 instance 2 vlan 3
 active region-configuration  
#
interface Vlanif2
 ip address 10.1.2.102 255.255.255.0
 vrrp vrid 1 virtual-ip 10.1.2.100
 vrrp vrid 1 priority 120
 vrrp vrid 1 preempt-mode timer delay 20
#
interface Vlanif3
 ip address 10.1.3.102 255.255.255.0
 vrrp vrid 2 virtual-ip 10.1.3.100
#
interface Vlanif4
 ip address 10.1.4.102 255.255.255.0
 #
interface GigabitEthernet1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
 stp root-protection
#
interface GigabitEthernet1/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
#
interface GigabitEthernet1/0/3
 port link-type trunk
 port trunk allow-pass vlan 4
 stp edged-port enable
#
ospf 1
 area 0.0.0.0
  network 10.1.2.0 0.0.0.255
  network 10.1.3.0 0.0.0.255
  network 10.1.4.0 0.0.0.255
#
return

SwitchB的配置文件

#
sysname SwitchB
#
vlan batch 2 to 3 5
#
stp instance 1 root secondary
stp instance 2 root primary
stp bpdu-protection
stp pathcost-standard legacy
#
stp region-configuration
 region-name RG1
 instance 1 vlan 2
 instance 2 vlan 3
 active region-configuration  
#
interface Vlanif2
 ip address 10.1.2.103 255.255.255.0
 vrrp vrid 1 virtual-ip 10.1.2.100
#
interface Vlanif3
 ip address 10.1.3.103 255.255.255.0
 vrrp vrid 2 virtual-ip 10.1.3.100
 vrrp vrid 2 priority 120
 vrrp vrid 2 preempt-mode timer delay 20
#
interface Vlanif5
 ip address 10.1.5.103 255.255.255.0
#
interface GigabitEthernet1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
 stp root-protection
#
interface GigabitEthernet1/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
#
interface GigabitEthernet1/0/3
 port link-type trunk
 port trunk allow-pass vlan 5
 stp edged-port enable
#
ospf 1
 area 0.0.0.0
  network 10.1.2.0 0.0.0.255
  network 10.1.3.0 0.0.0.255
  network 10.1.5.0 0.0.0.255
#
return

SwitchC的配置文件

#
sysname SwitchC
#
vlan batch 2 to 3
#
stp bpdu-protection
stp pathcost-standard legacy
#
stp region-configuration
 region-name RG1
 instance 1 vlan 2
 instance 2 vlan 3
 active region-configuration  
#
interface GigabitEthernet1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
 stp instance 2 cost 20000
#
interface GigabitEthernet1/0/2
 port link-type access
 port default vlan 2
 stp edged-port enable
#
interface GigabitEthernet1/0/3
 port link-type access
 port default vlan 3
 stp edged-port enable
#
interface GigabitEthernet1/0/4
 port link-type trunk
 port trunk allow-pass vlan 2 to 3
 stp instance 1 cost 20000
#
return

AAA是指:authentication(认证)、authorization(授权)、accounting(计费)的简称,是网络安全的一种管理机制;Authentication是本地认证/授权,authorization和accounting是由远处radius(远程拨号认证系统)服务或hwtacacs(华为终端访问控制系统)服务器完成认证/授权;AAA是基于用户进行认证、授权、计费的,而NAC方案是基于接入设备接口进行认证的,在实际应用中,可以使用AAA的一种或两种服务

如果是一台刚初始化过的华为交换机,需要输入两次相同的密码作为登录交换机的登录密码,交换机上有console 端口 MEth管理端口 usb端口
通过串口线配置S5700 的管理IP地址,串口线接在交换机的console口,ip设置完成后网线接在ETH口:

<S5700> system-view                   
[S5700] interface MEth 0/0/1       
[S5700-MEth0/0/1]ip address 192.168.100.1 255.255.255.0              ///设置MEth管理端口的ip地址
[S5700-MEth0/0/1]quit
[S5700]ip route-static 0.0.0.0 0.0.0.0 192.168.200.1(gateway)
[S5700-MEth0/0/1]display ip interface MEth 0/0/1               ///查看MEth管理端口的配置信息
[S5700]  

生成本地密钥对

    <S5700> system-view
    [S5700] rsa local-key-pair create
    The key name will be: Host
    RSA keys defined for Host already exist.
    Confirm to replace them? (y/n)[n]:y
    The range of public key size is (512 ~ 2048).
    NOTES: If the key modulus is less than 2048,
    It will introduce potential security risks.
    Input the bits in the modulus[default = 2048]:2048
    Generating keys...
    ......................................................................................+++
    ....+++
    .......................................++++++++
    ..............++++++++

添加用户,设置ssh telent远程登录

<S5700> system-view                                        ///进入系统配置模式
[S5700]aaa                                                 ///进入AAA模式           
[S5700-aaa]local-user admin password irreversible-cipher admin@123        ///设置本地用户名和密码  cipher加密
[S5700-aaa]local-user admin service-type ssh telnet          ///设置用户设置登录ssh telnet服务
[S5700-aaa]display ssh server status             ///查看ssh服务是否生效
[S5700-aaa]display telnet server status            ///查看telnet服务是否生效
[S5700-aaa]local-user admin privilege level 15               ///设置用户级别
[S5700-aaa]q                                               ///退出AAA模式
设置vty 0 4远程登陆的虚拟端口

VTY是路由器的远程登陆的虚拟端口,0 4表示可以同时打开5个会话,line vty 0 4是进入VTY端口,对VTY端口进行配置,比如说配置密码,或者ACL.

[S5700]user-interface vty 0 4                     ///进入vty 0 4远程虚拟端口
[S5700-ui-vty0-4]authentication-mode aaa          ///为虚拟用户终端配置AAA身份验证模式
[S5700-ui-vty0-4]user privilege level 15          ///为虚拟用户终端配置用户级别
[S5700-ui-vty0-4]protocol inbound all             ///为虚拟用户终端配置使用的协议,all即都支持
[S5700-ui-vty0-4]protocol inbound telnet          ///为虚拟用户终端配置telnet协议,即可以使用telnet远程登录
[S5700-ui-vty0-4]protocol inbound ssh             ///为虚拟用户终端配置ssh协议,即用户可以使用ssh远程登录
[S5700]ssh user admin authentication-type password  ///为admin用户设置ssh认证为password,此命令对设置单一用户设置来说比较实用
[S5700]ssh authentication-type default password   ///设置ssh默认的认证方式为密码认证,对设置多个用户来说很实用
[S5700]ssh user admin service-type stelnet          ///为admin用户设置ssh认证服务类型为stelnet
[S5700]display ssh user-information admin           ///查看ssh服务admin用户的配置信息
[S5700]q                        ///退出系统设置视图
<S5700>save                      ///保存设置

配置带内管理IP地址

<S5700> system-view                                   //进入系统配置模式 
[S5700]interface Vlanif 1                             //进入三层 vlanif 接口
[S5700-Vlanif1]ip address 192.168.0.1  255.255.255.0  //配置管理 IP 地址
创建web登录管理账号
[S5700]http server enable                             ///系统视图下开启http服务
[S5700]http secure-server enable                      ///系统视图下开启http安全服务 即https
[S5700]aaa                                            //系统视图下进入aaa模式
[S5700-aaa]local-user admin privilege level 15        ///配置 http 登录名权限
[S5700-aaa]local-user admin service-type http         /// 开启 http 登录服务
[S5700-aaa]quit                                       /// 退出aaa模式

SI4093交换机是一款二层交换机,并且不支持生成树协议,我们在配置这款交换机时,最简单的方法,是把它配置成直通模式(类似具有端口聚合功能的直通模块).在直通模式下时SI4093会透传任何报文,无论这些报文的VLAN是多少,都统统透传.

- 阅读剩余部分 -