fbpx

Layer 2 Misconfigurations: Packet Flow with Hardware Offloading and MAC Learning

Facebook
Twitter
LinkedIn
WhatsApp
Telegram

Consider the following scenario: A bridge has been configured with the option to hardware offloading enabled to maximize network performance on a RouterOS device. Due to this configuration, the device functions as a switch instead of a simple bridge at the software level.

This improves performance by allowing the switch chip to handle packet forwarding between ports, rather than having the device's CPU do it.

At the end of the article you will find a small test that will allow you assess the knowledge acquired in this reading

Configuration

				
					/interface bridge
add name=bridge1
/interface bridge port
add bridge=bridge1 hw=yes interface=ether1 learn=yes
add bridge=bridge1 hw=yes interface=ether2 learn=yes


				
			

Problem

When tools like Sniffer o Torch To capture packets on the network, an anomaly is observed: only some packets are visible, generally those that are broadcast/multicast. This is due to how the switch chip handles traffic in a configuration with hardware offloading.

MAC Learning vs Host Table

El switch chip maintains a table of MAC addresses and associated ports known as the “Host table”. Each time a packet needs to be forwarded, the switch chip consults this table to determine which port should be used to forward the packet. If the destination MAC address is not found in the table, the packet is flooded to all ports, including the CPU port.

Therefore, if the destination MAC address has already been learned and is in the table, the switch chip can forward the packet directly without going through the CPU. This means that said package will not be visible to tools like Sniffer o Torch, which capture packets at the CPU level.

Layer 2 Misconfigurations: Packet Flow with Hardware Offloading and MAC Learning

Symptom

  1. Packages not visible in Sniffer or Torch.
  2. Filtering rules may not work as expected.

Solution

To solve this problem, it is possible to use rules of ACL (Access Control List) to copy or redirect certain packets to the CPU. For example, you can configure a rule that sends a copy of packets destined for a specific MAC address to the CPU for analysis.

				
					/interface ethernet switch rule
add copy-to-cpu=yes dst-mac-address=4C:5E:0C:4D:12:4B/FF:FF:FF:FF:FF:FF 
ports=ether1 switch=switch1
				
			

It should be noted that sending packets to the CPU for processing will increase the load on the CPU, which could affect the overall performance of the device.

El hardware offloading It is a powerful technique to improve network performance, but it comes with certain limitations in terms of visibility and control at the CPU level. For use cases that require packet analysis or filtering, additional configuration such as ACL rules is required to ensure that the necessary packets are processed by the CPU.

Additional considerations

1. Traffic Prioritization:

In more complex networks, you may want to implement QoS (Quality of Service) to prioritize certain types of traffic. This generally requires packets to pass through the CPU, which could conflict with a hardware offloading configuration.

2. Security:

Hardware offloading can limit the ability to implement stronger security measures, such as Deep Packet Inspection (DPI), because packets may not pass through the CPU.

3. CPU capacity:

It is essential to take into account the processing capacity of the CPU when redirecting traffic to it. Too many packets sent for processing on the CPU can overwhelm it, leading to a decrease in overall system performance.

4. Compatibility:

Not all devices and switch chips support hardware offloading or have the same capabilities. Make sure your hardware supports the features you want to use.

5. Firmware/Software Updates:

Make sure you are using a version of RouterOS that supports all the features you want to implement. Issues and limitations may vary between different versions.

Advanced Solutions

For more complex scenarios, it is possible to use APIs or scripts to automate the addition and removal of ACL rules based on certain events or conditions. This could be especially useful in dynamic environments where destination MAC addresses may change frequently.

Summary

Hardware offloading is an effective technique for improving network performance, but it has its challenges when it comes to detailed traffic control and diagnosis.

Tools like Sniffer or Torch are less effective in this context because many packets are forwarded at the switch chip level and never reach the CPU.

However, with careful planning and the use of features like ACL, it is possible to balance performance with diagnostic and security needs.

Brief knowledge quiz

What do you think of this article?
Do you dare to evaluate your learned knowledge?

QUIZ - Layer 2 Misconfigurations: Packet Flow with Hardware Offloading and MAC Learning

Recommended book for this article

Do you want to suggest a topic?

Every week we post new content. Do you want us to talk about something specific?
Topic for the next blog

Leave a comment

Your email address will not be published. Required fields are marked with *

DISCOUNT CODE

AN24-LIB

applies to MikroTik books and book packs

Days
Hours
Minutes
Seconds

Introduction to
OSPF - BGP - MPLS

Sign up for this Free course

MAE-RAV-ROS-240118
Days
Hours
Minutes
Seconds

Sign up for this Free course

MAS-ROS-240111

Promo for Three Kings Day!

KINGS24

15%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the Three Kings Day discount code!

* promotion valid until Sunday January 7, 2024
** the code (KINGS24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

New Year's Eve Promo!

NY24

20%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the New Year's Eve discount code!

* promotion valid until Monday, January 1, 2024
** the code (NY24) applies to shopping cart
*** buy your course now and take it until March 31, 2024

Christmas discounts!

XMAS23

30%

all the products

MikroTik courses
Academy courses
MikroTik books

Take advantage of the discount code for Christmas!!!

**codes are applied in the shopping cart
Promo valid until Monday December 25, 2023

CYBER WEEK DISCOUNTS

CW23-MK

17%

all MikroTik OnLine courses

CW23-AX

30%

all Academy courses

CW23-LIB

25%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Cyber ​​Week!!!

**codes are applied in the shopping cart
Promo valid until Sunday December 3, 2023

BLACK FRIDAY DISCOUNTS

BF23-MX

22%

all MikroTik OnLine courses

BF23-AX

35%

all Academy courses

BF23-LIB

30%

all MikroTik Books and Book Packs

Take advantage of the discount codes for Black Friday!!!

**Codes are applied in the shopping cart

codes are applied in the shopping cart
valid until Sunday November 26, 2023

Days
Hours
Minutes
Seconds

Sign up for this Free course

MAE-VPN-SET-231115

Halloween promo

Take advantage of discount codes for Halloween.

Codes are applied in the shopping cart

HW23-MK

11% discount on all MikroTik OnLine courses

11%

HW23-AX

30% discount on all Academy courses

30%

HW23-LIB

25% discount on all MikroTik Books and Book Packs

25%

Register and participate in the free course Introduction to Advanced Routing with MikroTik (MAE-RAV-ROS)

Today (Wednesday) October 11, 2023
7pm to 11pm (Colombia, Ecuador, Peru)

MAE-RAV-ROS-231011