Showing posts with label Internet. Show all posts
Showing posts with label Internet. Show all posts

Thursday, 27 March 2025

Huawei 6720 Switch PBR Configuration

Note=The below configuration will not check the local routing table and it will forward all traffic to that nexthop..! 


[6720]acl number 3100

[6720-acl-adv-3100]rule 10 permit ip source 10.14.7.0 0.0.0.255



[6720]traffic classifier ABC

[6720-classifier-ABC]if-match acl 3100



[6720]traffic behavior ABC

[6720-behavior-ABC]redirect ip-nexthop 10.70.29.19



[6720]traffic policy ABC

Info: If the traffic policy has been applied to board, making modifications that are not supported by the board on the traffic policy may cause the failure to apply this traffic policy.

[6720-trafficpolicy-ABC]classifier ABC behavior ABC



[6720]traffic-policy ABC global inbound


Even if you configure it on interface still it will not check the local routing table and will forward all the traffic to that nexthop.



[6720]interface XGigabitEthernet 0/0/11

[6720-XGigabitEthernet0/0/11] traffic-policy ABC inbound


Here , i want that when there is a route not present in the routing table in that case the traffic will be forwarded to the nexthop only so i configured the acl to check the default route only..!


[6720]acl number 3100

[6720-acl-adv-3100]rule 10 permit ip source 110.14.7.0 0.0.0.255 destination 0.0.0.0 0.0.0.0


[6720]traffic-policy ABC global inbound

Interface Based PBR Configuration in Huawei Switch & Router..!

Policy-based routing PBR

Let’s assume that we have topology like this:

What we have to do is to force router CX_1 to choose interface G7/5/0 and next hop 10.0.2.2 to forward traffic from source IP 5.5.5.5 to destination IP 15.15.15.15. Rest of traffic should go through interface G7/5/7.

Configure IP addresses based on this topology.

Use OSPF protocol to ensure communication in tested network. Let’s take CX_1 as an example:

#
ospf 1 router-id 6.6.6.6
 area 0.0.0.0
  network 10.0.1.0 0.0.0.3
  network 10.0.2.0 0.0.0.3
  network 10.0.0.0 0.0.0.3
  network 6.6.6.6 0.0.0.0
#

Configure OSPF for the remaining routers.

Increase OSPF cost of one of the links between CX_1 and CX_2 to exclude load-balancing:

#
interface GigabitEthernet7/5/0
 ospf cost 100
#

Display routing-table of AR29 to check if all necessary subnets are available through OSPF (display ip routing-table).

Configure ACL on CX_1 which permits IP source 5.5.5.5 to send packets to destination IP 15.15.15.15:

[CX_1]acl number 3000
[CX_1-acl-3000}rule 5 permit ip source 5.5.5.5 0.0.0.0

Configure traffic classifier and traffic behavior for classified packets:

#
traffic classifier ABC
if-match acl 3000 # traffic behavior ABC
redirect ip-nexthop 10.0.2.2 interface GigabitEthernet7/5/0 #

Configure traffic policy and assign it to interface G7/5/5 as inbound:

#
traffic policy ABC
 statistics enable
 classifier ABC behavior ABC
# interface GigabitEthernet7/5/5 traffic-policy ABC inbound
#

Let’s check now what the result of such traffic policy is. On AR29 router we can use tracert command to check how traffic is going to 15.15.15.15.

<AR29>tracert -a 5.5.5.5 15.15.15.15
 traceroute to  15.15.15.15(15.15.15.15), max hops: 30, packet length: 40, press CTRL_C to break
1   10.0.0.1 4 ms  2 ms  7 ms
2   10.0.2.2 3 ms  4 ms  5 ms

As we can see traffic policy is working correctly choosing 10.0.2.2 as the IP next hop.

Now we can try the same but without source IP 5.5.5.5:

<AR29>tracert 15.15.15.15
 traceroute to  15.15.15.15(15.15.15.15), max hops: 30, packet length: 40, press CTRL_C to break
1   10.0.0.1 3 ms  1 ms  1 ms
2   10.0.1.2 3 ms  2 ms  2 ms

We can see that policy-based routing is working properly for traffic classified in ACL 3000. Rest of traffic is choosing a route based on IP routing table.

We can also check statistics for this traffic policy. We can use ping for such purposes. Use ping from AR29 and check statistics on CX_1:

<AR29>ping -a 5.5.5.5 -c 100 -m 100 15.15.15.15
<CX_1>display traffic policy statistics interface g 7/5/5 inbound
Info: The statistics is shared because the policy is shared.
Interface: GigabitEthernet7/5/5
Traffic policy inbound: labnario
Traffic policy applied at 2012-02-06 16:15:04
Statistics enabled at 2012-02-06 16:15:16
Statistics last cleared: 2012-02-06 20:14:59
Rule number: 4 IPv4, 0 IPv6
Current status: OK!
Item                             Packets                      Bytes
-------------------------------------------------------------------
Matched                              100                     10,200
  +--Passed                          100                     10,200
  +--Dropped                           0                          0
    +--Filter                          0                          0
    +--URPF                            0                          0
    +--CAR                             0                          0
Missed                                19                      2,640
Last 30 seconds rate
Item                                 pps                        bps
-------------------------------------------------------------------
Matched                                0                          0
  +--Passed                            0                          0
  +--Dropped                           0                          0
    +--Filter                          0                          0
    +--URPF                            0                          0
    +--CAR                             0                          0
Missed                                 0                        288
<AR29>ping -c 100 -m 100 15.15.15.15
<CX_1>dis traffic policy statistics interface g 7/5/5 inbound
Info: The statistics is shared because the policy is shared.
Interface: GigabitEthernet7/5/5
Traffic policy inbound: labnario
Traffic policy applied at 2012-02-06 16:15:04
Statistics enabled at 2012-02-06 16:15:16
Statistics last cleared: 2012-02-06 20:14:59
Rule number: 4 IPv4, 0 IPv6
Current status: OK!
Item                             Packets                      Bytes
-------------------------------------------------------------------
Matched                              100                     10,200
  +--Passed                          100                     10,200
  +--Dropped                           0                          0
    +--Filter                          0                          0
    +--URPF                            0                          0
    +--CAR                             0                          0
Missed                               126                     13,956
Last 30 seconds rate
Item                                 pps                        bps
-------------------------------------------------------------------
Matched                                0                          0
  +--Passed                            0                          0
  +--Dropped                           0                          0
    +--Filter                          0                          0
    +--URPF                            0                          0
    +--CAR                             0                          0
Missed                                 3                      2,648

You can also configure policy-based routing in MPLS L3VPN to allow some IP traffic (based on ACL) from one VPN to be redirected to another VPN. Maybe I will show you such configuration in the future.

Interface Based PBR Configuration in Huawei router..!




Step 1: As we verified the connectivity between PCs and the path taken by the traffic from PC2 to PC4 and PC3 to PC5.

Traffic from PC2 to PC4 passes through R4
Traffic from PC3 to PC5 also passes through R4.

The objective of this lab is to use Policy based routing to ensure traffic from PC2 to PC4 passes through R4 while traffic from PC3 to PC5 passes through R5.


Step 2: Configure ACLs to match traffic from PC2 and PC3 as follows on R3. We use extended ACLs to be able to match the source IP addresses.

***************************R3
#
acl number 3000
 rule 5 permit ip source 40.40.40.0 0.0.0.1
#
acl number 3002
 rule 5 permit ip source 50.50.50.0 0.0.0.1
#

Step 3: Configure PBR and apply it on the interfaces facing PCs on R3.

**************************R3
#
policy-based-route TEST_PBR permit node 5
 if-match acl 3000
 apply output-interface Serial0/0/0
policy-based-route TEST_PBR permit node 10
 if-match acl 3002
 apply output-interface Serial0/0/1
#
interface Ethernet0/0/0
 ip policy-based-route TEST_PBR
#
interface Ethernet0/0/1
 ip policy-based-route TEST_PBR
#

Step 4: Verify the path taken by traffic from PC2 and PC3.

Traffic from PC3 now follows the path through R5 and R7.

Note: The PBR configured on R3 doe not affect the path for the return traffic from PC4 and PC5. You must configure same PBR on R6 to be able to control the flow of the return traffic.

Return traffic from PC5 still goes through R4.

This is how you can use PBR to control traffic flow in your network. Thank You for reading and please leave your comments below. Check out other related articles on our page. 

Tuesday, 24 December 2024

Spanning Tree Root Bridge Configuration..!

 

Configuration

Here is the topology we’ll use:

spanning-tree Configuration




We have three switches. On each switch, I configure three VLANs:

SW1, SW2 & SW3
(config)#vlan 10
(config)#vlan 20
(config)#vlan 30

And we’ll configure the interfaces as trunk interfaces:

SW1, SW2 & SW3
(config)#interface range GigabitEthernet 0/0 - 1
(config-if-range)#switchport trunk encapsulation dot1q 
(config-if-range)#switchport mode trunk

Let’s check the bridge IDs for our switches:

SW1#show spanning-tree bridge detail 
VLAN0001         
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0010         
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0020         
  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0030         
  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
SW2#show spanning-tree bridge detail
VLAN0001         
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0010         
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0020         
  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0030         
  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
SW3#show spanning-tree bridge detail
VLAN0001         
  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0010         
  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0020         
  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
VLAN0030         
  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

The priority has a default value of 32768 so without configuring anything, the MAC address is the tie-breaker. In my case, SW2 is the root bridge for all VLANs:

SW2#show spanning-tree vlan 10

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    32778
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  15  sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p 
SW2#show spanning-tree vlan 20

VLAN0020
  Spanning tree enabled protocol ieee
  Root ID    Priority    32788
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32788  (priority 32768 sys-id-ext 20)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p
SW2#show spanning-tree vlan 30

VLAN0030
  Spanning tree enabled protocol ieee
  Root ID    Priority    32798
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32798  (priority 32768 sys-id-ext 30)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p 

Let’s see what we can do about that. I want to configure my network so it looks like this:

spanning-tree Configuration



We can change the root bridge for each VLAN with the spanning-tree Command. Here are our options:

SW1(config)#spanning-tree vlan 10 ?    
  forward-time  Set the forward delay for the spanning tree
  hello-time    Set the hello interval for the spanning tree
  max-age       Set the max age interval for the spanning tree
  priority      Set the bridge priority for the spanning tree
  root          Configure switch as root

Above, we see two options:

  • priority: We can manually change the bridge priority.
  • root: We can configure the switch as root.

What’s the difference between these two parameters? Let’s find out.

The spanning-tree vlan command also accepts ranges of VLANs.

Root Parameter

We’ll start with the root parameter. Let’s check our options:

SW1(config)#spanning-tree vlan 10 root ?
  primary    Configure this switch as primary root for this spanning tree
  secondary  Configure switch as secondary root

I can configure the switch to become the primary or secondary root bridge. Let’s try primary:

SW1(config)#spanning-tree vlan 10 root primary

Let’s check whether that works:

SW1#show spanning-tree vlan 10

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    24586
             Address     5254.001a.935a
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    24586  (priority 24576 sys-id-ext 10)
             Address     5254.001a.935a
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  15  sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p

In the output above, we see that SW1 is now the root bridge for VLAN 10. The priority of SW1 is now 24586.

We can also configure another switch to become the “secondary” root bridge. Let’s try that on SW2:

SW2(config)#spanning-tree vlan 10 root secondary

Let’s check what this command does:

SW2#show spanning-tree vlan 10

VLAN0010
  Spanning tree enabled protocol ieee
  Root ID    Priority    24586
             Address     5254.001a.935a
             Cost        4
             Port        1 (GigabitEthernet0/0)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    28682  (priority 28672 sys-id-ext 10)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Root FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p

Above, we see that the priority of SW2 is now 28682. In reality, there is no such thing as a “secondary” root bridge.

What happens is that behind the scenes, Cisco IOS sets a priority when you use the root primary or root secondary parameters. We can verify this by looking at our configuration:

SW1#show running-config | include priority              
spanning-tree vlan 10 priority 24576
SW2#show running-config | include priority
spanning-tree vlan 10 priority 28672

The way this works is that the switch looks at the priority of the current root bridge and then decreases its own priority so that it becomes the new root bridge.

Priority Parameter

We can also configure the priority manually like this:

SW2(config)#spanning-tree vlan 20 priority ?
  <0-61440>  bridge priority in increments of 4096

Let’s try that on SW2 for VLAN 20:

SW2(config)#spanning-tree vlan 20 priority 0

By setting the priority to 0, I’ll have the lowest possible priority. Let’s check whether SW2 is now the root bridge for VLAN 20:

SW2#show spanning-tree vlan 20

VLAN0020
  Spanning tree enabled protocol ieee
  Root ID    Priority    20
             Address     5254.0015.bc74
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    20     (priority 0 sys-id-ext 20)
             Address     5254.0015.bc74
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p

Above, we see that the priority is now 20 (priority 0 and sys-id-ext 20). Let’s configure SW3 to become the root bridge for VLAN 30:

SW3(config)#spanning-tree vlan 30 priority 0

Here’s the output of SW3:

SW3#show spanning-tree vlan 30

VLAN0030
  Spanning tree enabled protocol ieee
  Root ID    Priority    30
             Address     5254.001d.e6bb
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    30     (priority 0 sys-id-ext 30)
             Address     5254.001d.e6bb
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/0               Desg FWD 4         128.1    P2p 
Gi0/1               Desg FWD 4         128.2    P2p 

And as we can see above, SW3 is the root bridge for VLAN 30. That’s all there is to it.

Conclusion

You have now learned how to:

  • Verify the current root bridge per VLAN.
  • Configure the root bridge using the spanning-tree command:Using the root parameter.Using the priority parameter.

Saturday, 7 December 2024

Huawei Port based Rate limit configuration..!--L3 Port

 Huawei Port based Rate limit configuration on routing port .




interface XGigabitEthernet0/0/21
 undo portswitch
 ipv6 enable
 ip address 10.050.5 255.255.255.252
 qos lr outbound cir 600000 cbs 620000
 qos lr inbound cir 600000 cbs 620000
#
return


Tuesday, 17 September 2024

My LibreNMS suddenly Stopped Pooling the Devices .

 There is some bug in libre NMS i found that suddenly my pooling has been stopped without any reason. SO to re run it i just rerun my daily.sh and validated the php to rerun it .



[root@localhost ~]# su - librenms
[librenms@localhost ~]$ ./validate.php

===========================================
Component | Version
--------- | -------
LibreNMS  | 24.8.0-72-g7d450345d (2024-09-15T05:43:11+05:30)
DB Schema | 2024_08_27_182000_ports_statistics_table_rev_length (299)
PHP       | 8.1.21
Python    | 3.6.8
Database  | MariaDB 10.3.28-MariaDB
RRDTool   | 1.7.0
SNMP      | 5.8
===========================================
[OK]    Composer Version: 2.7.9
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[OK]    Database schema correct
[OK]    MySQL and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrd_dir is writable
[OK]    rrdtool version ok
[WARN]  Your install is over 24 hours out of date, last update: Sun, 15 Sep 2024 00:13:11 +0000
        [FIX]:
        Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.



[librenms@localhost ~]$ 
[librenms@localhost /]$ su root
Password:
[root@localhost /]# cd opt/librenms/
[root@localhost librenms]# sudo ./daily.sh

Re-running /opt/librenms/daily.sh as librenms user
Updating to latest codebase                        OK
Updating Composer packages                         OK
Updated from 7d450345d to 7034fd7a4                OK
Updating SQL-Schema                                OK
Updating submodules                                OK
Cleaning up DB                                     OK
Fetching notifications                             OK
Caching PeeringDB data                             OK
[root@localhost librenms]#

Monday, 5 August 2024

Mikrotik Multiple port trunk with bridge .

 Find the diagram given below.

########################################################

/interface bridge
add name=bridge1 protocol-mode=none vlan-filtering=yes

########################################################

/interface vlan
add interface=bridge1 name=10 vlan-id=10
add interface=bridge1 name=192 vlan-id=192

########################################################

/interface bridge port
add bridge=bridge1 interface=ether3
add bridge=bridge1 interface=ether6

########################################################

/interface bridge vlan
add bridge=bridge1 tagged=bridge1,ether3,ether6 vlan-ids=192,10

########################################################

/ip address
add address=11.1.1.1/24 interface=192 network=11.1.1.0
add address=10.1.1.1/24 interface=10 network=10.1.1.0

########################################################