Friday , September 20 2024

Huawei’s equivalent of Cisco’s ‘logging synchronous’

If a router wants you to know something, it wants you to know right now!

Let’s look what will happen if you are entering a long command and the device wants you to be informed about a link’s failure:

[Huawei-acl-adv-3000]rule 10 permit ip vpn-instance vpn_labnario source 1.1.1.1 0.0.0.255 destination 1.1.1.2
Jan 15 2013 11:04:18-08:00 Huawei %%01PHY/1/PHY(l)[5]:    GigabitEthernet0/0/0:
change status to down
Jan 15 2013 11:04:18-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[6]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the DOWN state.
^
Error:Incomplete command found at '^' position.

When you click ‘Enter’ you will have to write the command once again. It is frustrating for all network administrators.

Unfortunately we cannot change it, like on Cisco’s devices, by ‘logging synchronous‘ command.

Instead you have 3 ways to do this on Huawei’s devices:

If you remember the syntax of the command just continue writing:

[Huawei-acl-adv-3000]rule 10 permit ip vpn-instance vpn_labnario source 1.1.1.1 0.0.0.255 destination 1.1.1.2 
Jan 15 2013 11:19:15-08:00 Huawei %%01PHY/1/PHY(l)[21]:    GigabitEthernet0/0/0:
 change status to down
Jan 15 2013 11:19:15-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[22]:The line protoco
l IP on the interface GigabitEthernet0/0/0 has entered the DOWN state.0.0.0.255
[Huawei-acl-adv-3000]

You can just use question mark ‘?‘ to know the syntax of the command:

[Huawei-acl-adv-3000]rule 10 permit ip vpn-instance vpn_labnario source 1.1.1.1 0.0.0.255 destination 1.1.1.2 
Jan 15 2013 11:21:28-08:00 Huawei %%01PHY/1/PHY(l)[23]:    GigabitEthernet0/0/0:
 change status to up
Jan 15 2013 11:21:28-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[24]:The line protoco
l IP on the interface GigabitEthernet0/0/0 has entered the UP state.?
  0        Wildcard bits : 0.0.0.0 ( a host )
  X.X.X.X  Wildcard of destination
[Huawei-acl-adv-3000]rule 10 permit ip vpn-instance vpn_labnario source 1.1.1.1 0.0.0.255 destination 1.1.1.2 0.0.0.255

You can just click CTRL_R to repeat the display of the information of the current line:

[Huawei-acl-adv-3000]rule 10 permit ip vpn-instance vpn_labnario source 1.1.1.1 0.0.0.255 destination 1.1.1.2 
Jan 15 2013 11:24:35-08:00 Huawei %%01PHY/1/PHY(l)[25]:    GigabitEthernet0/0/0:
 change status to down
Jan 15 2013 11:24:35-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[26]:The line protoco
l IP on the interface GigabitEthernet0/0/0 has entered the DOWN state.
CTRL_R
[Huawei-acl-adv-3000]rule 10 permit ip vpn-instance vpn_labnario source 1.1.1.1 0.0.0.255 destination 1.1.1.2

Unfortunately you have to repeat it each time when the router wants you to know about something.

All system-defined shortcut keys you can find in huawei CLI introduction.

Read More »

BGP peering with loopback interfaces

Read More »

Huawei eNSP – news

New year, a new version of Huawei Network Simulation Platform eNSP has been released.

You can download it clicking on the below link:

Read More »

how does BGP select routes

When there are multiple routes to the same destination, BGP (Border Getaway Protocol)  on Huawei devices:

  1. Prefers the route with the largest PreVal. PrefVal is a Huawei-specific parameter. It is valid only on the device where it is configured.
  2. Prefers the route with the highest Local_Pref.
  3. Prefers a locally originated route. A locally originated route takes precedence over a route learned from a peer.
  4. Prefers the aggregated route. The preference of an aggregated route is higher than a non-aggregated route.
  5. Prefers the local route that is manually aggregated. The preference of the local route that is manually aggregated is higher than that of automatically aggregated.
  6. Prefers the local route that is imported by using network command. The preference of the route that is imported by using the network command is higher than that imported by  import-route command.
  7. Prefers the route with the shortest AS_Path.
  8. Compares Origin attributes, and selects routes whose origin types are IGP, EGP, and Incomplete respectively.
  9. Prefers the route with the smallest MED.
  10. Prefers the routes learned from EBGP. The preference of an EBGP route is higher than an IBGP.
  11. Prefers the route of an IGP with the lawest metric in an AS. If load balancing is configured and there are multiple external routes with the same AS_Path, load balancing is performed according to the number of configured routes.
  12. Prefers the route with the shortest Cluster_List.
  13. Prefers the route with the smallest Originator_ID.
  14. Prefers the route advertised by the router with the smallest router ID.
  15. Compares IP addresses of its peers, and prefers the route that is learnt from the peer with the smallest IP address.

Read More »

Multiple Spanning Tree Protocol on Huawei switch

The Multiple Spanning Tree Protocol (MSTP) was originally defined as the IEEE 802.1s standard protocol. Now the standard IEEE 802.1Q-2005 includes MSTP. The basic role of this protocol is to prevent L2 loops. I do not want to explain MSTP in details, as this can be easily found on the Internet. I just want to show you:

  • how to configure this protocol using Huawei CLI
  • how to load balance traffic over redundant links.

Let’s assume that we have the following physical topology:

By default MSTP runs only one spanning-tree topology over a LAN network for every VLAN. Even if we configure 1000 different VLANs throughout this topology, only three links will be utilized. This is because STP blocks two links, preventing our topology from L2 loops. In our case SW1 was elected as the Root Bridge. As a result we have the following logical topology which will be used by every VLAN to forward traffic (assuming default MSTP configuration):

Links SW2—SW3 and SW2—SW4 will be blocked by the SW3 and SW4 switches respectively. Traffic from every device connected to any VLAN configured, will be travelling only these three links. This is a default MSTP behaviour.

To overcome this negative issue, MSTP protocol should be properly planned and configured. By default this protocol runs only one STP instance and maps all VLANs to this instance. To utilize all physical links equally, additional instances should be added.

Let’s assume that we have two VLANs: 100 and 200. By default both VLANs will use the same logical STP topology as in the picture above. This is because both VLANs belong to the same MSTP Instance, which was determined by the one Root Bridge placement (SW1 in our case).

To force VLAN 100 to use one logical topology and VLAN 200 to use a different logical topology, we need to:

  • configure switches to have two different MSTP Instances
  • define different Root Bridge placement for every MSTP Instance
  • map VLAN 100 to the first MSTP Instance and VLAN 200 to the second MSTP Instance.

Please see table and the picture below:

Let’s start configuring our devices. As a first step all switches have to be configured with VLAN information (SW2-4 configuration omitted):

<labnarioSW1>system-view
[labnarioSW1]vlan batch 100 200

Now we can configure MSTP protocol (all switches have to be configured):

[labnarioSW1]stp region-configuration
[labnarioSW1-mst-region] region-name labnario
[labnarioSW1-mst-region] instance 1 vlan 100
[labnarioSW1-mst-region] instance 2 vlan 200	
[labnarioSW1-mst-region] active region-configuration 
Info: This operation may take a few seconds. Please wait for a moment....done.
[labnarioSW1-mst-region]

To check MSTP configuration:

[labnarioSW1-mst-region]check region-configuration 
 Admin configuration
   Format selector    :0             
   Region name        :labnario             
   Revision level     :0

  Instance   VLANs Mapped
      0       1 to 99, 101 to 199, 201 to 4094
      1       100
      2       200
[labnarioSW1-mst-region]

As you see above, by default all VLANs are mapped to the MSTP Instance 0. This is the reason that all VLANs use the same logical topology to forward traffic between devices.

Now SW1 should be configured as the Root Bridge for MSTP Instance 1 and SW2 as the Root Bridge for MSTP Instance 2. In case of Root Bridge failure, backup devices should be also defined as follows:

[labnarioSW1]stp instance 1 root primary
[labnarioSW1]stp instance 2 root secondary

[labnarioSW2]stp instance 1 root secondary
[labnarioSW2]stp instance 2 root primary

Let’s check our MSTP configuration is working as we have planned:

[labnarioSW1]display stp instance 1 
-------[MSTI 1 Global Info]-------
MSTI Bridge ID      :0.4c1f-cc10-af35
MSTI RegRoot/IRPC   :0.4c1f-cc10-af35 / 0
MSTI RootPortId     :0.0
MSTI Root Type      :Primary root
Master Bridge       :32768.4c1f-cc10-af35
Cost to Master      :0
TC received         :33
TC count per hello  :0
Time since last TC  :0 days 1h:46m:14s
Number of TC        :34
Last TC occurred    :Ethernet0/0/3
 ----[Port1(Ethernet0/0/1)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :0.4c1f-cc10-af35 / 128.1
 Port Times          :RemHops 20
 TC or TCN send      :16
 TC or TCN received  :10
 ----[Port2(Ethernet0/0/2)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :0.4c1f-cc10-af35 / 128.2
 Port Times          :RemHops 20
 TC or TCN send      :22
 TC or TCN received  :6
 ----[Port3(Ethernet0/0/3)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :0.4c1f-cc10-af35 / 128.3
 Port Times          :RemHops 20
 TC or TCN send      :3
 TC or TCN received  :3
[labnarioSW1]

As you can see, SW1 MSTP bridge ID is:

0.4c1f-cc10-af35

Zero followed by the MAC address means, that this switch is the Root Bridge Primary for the MSTP Instance 1. By default bridge priority equals to 32768. Let’s check MSTP Instance 2:

[labnarioSW1]display stp instance 2
-------[MSTI 2 Global Info]-------
MSTI Bridge ID      :4096.4c1f-cc10-af35
MSTI RegRoot/IRPC   :0.4c1f-cc60-2fd3 / 1
MSTI RootPortId     :128.1
MSTI Root Type      :Secondary root
Master Bridge       :32768.4c1f-cc10-af35
Cost to Master      :0
TC received         :30
TC count per hello  :0
Time since last TC  :0 days 1h:56m:51s
Number of TC        :34
Last TC occurred    :Ethernet0/0/1
 ----[Port1(Ethernet0/0/1)][FORWARDING]----
 Port Role           :Root Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :0.4c1f-cc60-2fd3 / 128.1
 Port Times          :RemHops 20
 TC or TCN send      :11
 TC or TCN received  :12
 ----[Port2(Ethernet0/0/2)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :4096.4c1f-cc10-af35 / 128.2
 Port Times          :RemHops 19
 TC or TCN send      :15
 TC or TCN received  :7
 ----[Port3(Ethernet0/0/3)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :4096.4c1f-cc10-af35 / 128.3
 Port Times          :RemHops 19
 TC or TCN send      :5
 TC or TCN received  :0
[labnarioSW1]

Bridge ID is:

4096.4c1f-cc10-af35

Bridge priority equals to 4096, this is because this switch is configured as the Root Bridge Secondary for the MSTP Instance 2.

Look at the field:

MSTI RegRoot/IRPC   :0.4c1f-cc60-2fd3

As you see, RegRoot ID is different than Bridge ID. This is because SW2 was configured as the STP Root Bridge Primary for the MSTP Instance 2.

Let’s check STP port roles and states:

[labnarioSW1]display stp brief 
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/2               DESI  FORWARDING      NONE
   0    Ethernet0/0/3               DESI  FORWARDING      NONE
   1    Ethernet0/0/1               DESI  FORWARDING      NONE
   1    Ethernet0/0/2               DESI  FORWARDING      NONE
   1    Ethernet0/0/3               DESI  FORWARDING      NONE
   2    Ethernet0/0/1               ROOT  FORWARDING      NONE
   2    Ethernet0/0/2               DESI  FORWARDING      NONE
   2    Ethernet0/0/3               DESI  FORWARDING      NONE
[labnarioSW1]

All ports in MSTP Instance 1 have a Designated role. This means that SW1 is the Root Bridge for this Instance.

To check MSTP topology per VLAN, just type:

[labnarioSW1]display stp vlan 100
 ProcessId   InstanceId   Port                        Role  State             
 ----------------------------------------------------------------------
    0            1        Ethernet0/0/1               DESI  FORWARDING
    0            1        Ethernet0/0/2               DESI  FORWARDING
    0            1        Ethernet0/0/3               DESI  FORWARDING
[labnarioSW1]display stp vlan 200
 ProcessId   InstanceId   Port                        Role  State             
 ----------------------------------------------------------------------
    0            2        Ethernet0/0/1               ROOT  FORWARDING
    0            2        Ethernet0/0/2               DESI  FORWARDING
    0            2        Ethernet0/0/3               DESI  FORWARDING
[labnarioSW1]

The same verification commands on SW2:

[labnarioSW2]dis stp instance 1
-------[MSTI 1 Global Info]-------
MSTI Bridge ID      :4096.4c1f-cc60-2fd3
MSTI RegRoot/IRPC   :0.4c1f-cc10-af35 / 1
MSTI RootPortId     :128.1
MSTI Root Type      :Secondary root
Master Bridge       :32768.4c1f-cc10-af35
Cost to Master      :1
TC received         :47
TC count per hello  :0
Time since last TC  :0 days 2h:12m:1s
Number of TC        :40
Last TC occurred    :Ethernet0/0/1
 ----[Port1(Ethernet0/0/1)][FORWARDING]----
 Port Role           :Root Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :0.4c1f-cc10-af35 / 128.1
 Port Times          :RemHops 20
 TC or TCN send      :10
 TC or TCN received  :16
 ----[Port2(Ethernet0/0/2)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :4096.4c1f-cc60-2fd3 / 128.2
 Port Times          :RemHops 19
 TC or TCN send      :32
 TC or TCN received  :14
 ----[Port3(Ethernet0/0/3)][FORWARDING]----
 Port Role           :Designated Port
 Port Priority       :128
 Port Cost(Dot1T )   :Config=auto / Active=1
 Designated Bridge/Port   :4096.4c1f-cc60-2fd3 / 128.3
 Port Times          :RemHops 19
 TC or TCN send      :9
 TC or TCN received  :0
[labnarioSW2]

RegRoot field points to SW1’s MAC address. This means that SW1 is the Root Bridge for MSTP Instance 1. Bridge ID followed by the 4096 means that SW2 is the Root Bridge Secondary for MSTP Instance 1.

Port roles and states:

[labnarioSW2]display stp brief
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ROOT  FORWARDING      NONE
   0    Ethernet0/0/2               ALTE  DISCARDING      NONE
   0    Ethernet0/0/3               DESI  FORWARDING      NONE
   1    Ethernet0/0/1               ROOT  FORWARDING      NONE
   1    Ethernet0/0/2               DESI  FORWARDING      NONE
   1    Ethernet0/0/3               DESI  FORWARDING      NONE
   2    Ethernet0/0/1               DESI  FORWARDING      NONE
   2    Ethernet0/0/2               DESI  FORWARDING      NONE
   2    Ethernet0/0/3               DESI  FORWARDING      NONE
[labnarioSW2]

All ports in MSTP Instance 2 have Designated role and Forwarding state. This switch is the Root Bridge for MSTP Instance 2.

STP port roles and states per VLAN:

[labnarioSW2]dis stp vlan 100
 ProcessId   InstanceId   Port                        Role  State             
 ----------------------------------------------------------------------
    0            1        Ethernet0/0/1               ROOT  FORWARDING
    0            1        Ethernet0/0/2               DESI  FORWARDING
    0            1        Ethernet0/0/3               DESI  FORWARDING
[labnarioSW2]dis stp vlan 200
 ProcessId   InstanceId   Port                        Role  State             
 ----------------------------------------------------------------------
    0            2        Ethernet0/0/1               DESI  FORWARDING
    0            2        Ethernet0/0/2               DESI  FORWARDING
    0            2        Ethernet0/0/3               DESI  FORWARDING
[labnarioSW2]

Which links are blocked by the MSTP? Lets check STP topologies on SW3:

[labnarioSW3]dis stp brief
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               ROOT  FORWARDING      NONE
   0    Ethernet0/0/3               ALTE  DISCARDING      NONE
   1    Ethernet0/0/1               ROOT  FORWARDING      NONE
   1    Ethernet0/0/3               ALTE  DISCARDING      NONE
   2    Ethernet0/0/1               ALTE  DISCARDING      NONE
   2    Ethernet0/0/3               ROOT  FORWARDING      NONE
[labnarioSW3]

Interface Eth0/0/3 is blocked by the STP Instance 1 and Eth0/0/1 blocked by the STP Instance 2.

Which ports are blocked on the SW4?

[labnarioSW4]dis stp brief
 MSTID  Port                        Role  STP State     Protection
   0    Ethernet0/0/1               DESI  FORWARDING      NONE
   0    Ethernet0/0/3               ROOT  FORWARDING      NONE
   1    Ethernet0/0/1               ALTE  DISCARDING      NONE
   1    Ethernet0/0/3               ROOT  FORWARDING      NONE
   2    Ethernet0/0/1               ROOT  FORWARDING      NONE
   2    Ethernet0/0/3               ALTE  DISCARDING      NONE
[labnarioSW4]

In the MSTP Instance 1 Eth0/0/1 is blocked, and Eth0/0/3 in MSTP Instance 2.

MSTP debugging commands:

<labnarioSW4>debugging stp ?
  all           Specify all debug switch
  event         Specify event debug switch
  global-error  Specify global error debug switch
  global-event  Specify global event debug switch
  ha-info       Backup information
  instance      Spanning tree instance
  interface     Specify interface
  msti          Specify debugging packet's MSTIs
  packet        Specify packet debug switch
  process       The MSTP process

Read More »