How to configure FlowSpec on Huawei Routers
Overview: BGP FlowSpec (Border Gateway Protocol Flow Specification) is an extension of the BGP protocol used to define traffic filtering rules on routers. Unlike conventional BGP, which routes based on IPv4/IPv6 and prefix information, BGP FlowSpec allows network administrators to specify more granular criteria for packet forwarding, including layer 4 information (TCP/UDP ports) and even packet patterns. Simply put, Flowspec allows network administrators to dynamically create firewall rules through BGP announcements, using Layer 4 criteria such as protocol and application ports, and to apply actions that may include dropping traffic or simply applying bandwidth control. If you want to know more about how FlowSpec works, check out this article explaining whatFlowspec is . Operation: BGP FlowSpec works by adding new types of attributes to BGP, allowing network administrators to specify detailed filtering (or dynamic firewall) rules. These rules can include criteria such as: The following actions can be taken with BGP FlowSpec: When these rules are propagated through the BGP network, routers can use this information to filter or manipulate traffic in accordance with the defined policies. Operation – More Details: In the context of BGP FlowSpec, the actions are specified as part of the filter rules. Each filter rule contains three main parts: Actions in BGP FlowSpec are coded using BGP communities. Each action is mapped to a specific BGP community: When you create a BGP FlowSpec rule, you specify the matching fields, the desired action and, optionally, protocol fields. This rule is then encoded as a BGP community and included in a BGP update message that is sent to neighboring routers. The routers that receive this rule apply the specified actions to the packets that match the matching criteria. Please note that the specific BGP communities for each action may vary depending on the BGP FlowSpec implementation on your router. I recommend consulting your equipment’s documentation for detailed information on the BGP communities associated with each action in BGP FlowSpec. Use Cases: BGP FlowSpec can be used to block or redirect malicious traffic during distributed denial of service (DDoS) attacks. Precise rules can be applied to filter out unwanted traffic and keep services online. Network administrators can use BGP FlowSpec to guarantee quality of service by prioritizing certain types of traffic based on specific ports or protocols. BGP FlowSpec can be used to implement granular security policies, blocking traffic associated with malware or suspicious activity. Configuration examples: Now that you know what FlowSpec is and what it can do, we’re going to show you how to configure FlowSpec on Huawei routers. This configuration applies to Huawei NE20, Huawei NE40, Huawei NE8000-M4, Huawei NE8000-M8, Huawei NE8000-M12, Huawei NE8000-F1A or any Huawei that uses Huawei’s VRP operating system. Example configuration of the dynamic BGP flow specification: If the characteristics of DoS or DDoS attack traffic are unknown, a traffic analysis server, such as Made4Flow with Anti-DDoS, can help implement the BGP flow specification to ensure network security. #Network requirements: As shown in the Topology below, Device A belongs to AS 100, while Device B, Device C and the Server belong to AS 200. Device B is an input of the AS 200. AS 200 communicates with AS 100 via Device B. The source of the attack in AS 100 can flow to AS 200 via Device B, posing a threat to AS 200. In this situation, configure dynamic BGP flow specification to ensure network security. The operating process is as follows: Note: Interfaces 1 to 3 in this example represent GE 1/0/0, GE 2/0/0 and GE 3/0/0 respectively. The configuration script goes as follows: Data preparation: To complete the configuration, you need the following data: Procedure: Let’s go over the commands used. In our lab, we are using a simulator such as PNETLAB/EVE-NG. #Configuredevice B: #Checkthe peer connection status of the FlowSpec session on device B, if the session has the status “Established” the session is correct and functional. #Checkthe routes received via BGP Flowspec by device B: #Check the traffic policy (dynamic firewall rule) for each BGP Flowspec route based on the ReIndex shown in the previous output: Complete scenario configuration files: Device configuration file A: Device configuration file B: Below is another basic example of a BGP FlowSpec rule to block traffic from a particular port: Validate BGP Flowspec routes received: Validate details of the route received: To check whether the BGP Flowspec routes are effective, you can use the commands below: Validate route statistics: More commands for validations: Example of a Flowspec route with rate-limit: RFCs: For detailed information on BGP FlowSpec, see the following RFCs: Be sure to consult these RFCs for detailed information on BGP FlowSpec and its extensions. Did you know that Made4Flow now includes automated BGP Flowspec in its configurations, and that you can protect your network and your customers using this technology? You can automate BGP FlowSpec announcements for discard, rate limit, and flexible rules.
What is FlowSpec? How to use FlowSpec to mitigate DDoS attacks?
Essentially, Flowspec is an extension of the BGP protocol that allows routers to apply rules—such as dynamic ACLs or dynamic firewall rules—to specific types of traffic. These rules can be based on a variety of criteria, including source, destination, protocol, port, and so on.