Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ How to use Quagga BGP (Border Gateway Protocol) router to filter BGP routing     - Several SQL Server data migration / Export Import Practice (Database)

- stat - Get more information than ls (Linux)

- STL spatial Configurator (Programming)

- Install Oracle 11g illustrations and dependent libraries under SUSE11 (Database)

- MySQL database to open a remote connection method (Database)

- CentOS Linux firewall configuration and Close (Linux)

- Java garbage collection (Programming)

- Hadoop2.0 configuration yarn success (Server)

- Recover Ubuntu 14.04 wakes up from standby in case mouse keyboard appears dead (Linux)

- Ora-14450: attempt to access ah transactional temptable already in use (Database)

- How to use the Linux terminal Git commands (Linux)

- Java Prototype Pattern (Programming)

- How to monitor Linux system performance Nmon (Linux)

- Introduction to Linux Shell (Programming)

- Install OpenGL development environment in Fedora and Ubuntu (Linux)

- How to test your MongoDB application upgrade? (Database)

- Oracle RMAN repair logical bad blocks (Database)

- Hadoop upload files error solved (Server)

- Hadoop scheduling availability of workflow platform - Oozie (Server)

- Linux centralized log server rsyslog (Server)

  How to use Quagga BGP (Border Gateway Protocol) router to filter BGP routing
  Add Date : 2017-01-08      
  How to use Quagga CentOS server to become a BGP router, also introduced BGP peers and exchange prefix settings. In this tutorial, we will focus on how to use the prefix list (prefix-list) and route maps (route-map) to control the injection data and data output.

Previous articles have said, BGP routing decision is based on the broadcast prefix and prefix of charge. To avoid the wrong route, you need to use some filtering mechanism to control the transmission of these prefixes. For example, if one of your BGP neighbors started to broadcast a do not belong to their prefixes, and you will be wrong received these unusual prefix, and will forward it to the network, the forwarding process will continue to go on forever do not stop (the so-called "black hole" thus produced). So make sure this prefix is not received or is not forwarded to any network, to achieve this purpose, you can use the prefix list, and route maps. The former is based on the filtering mechanism prefix, which is more common prefix-based policy can be used to fine-tune the filtering mechanism.

This article will show you how to use the prefix list in Quagga routing and mapping.

Topology and demand

This tutorial uses the following topology.

Service Provider A and B have other suppliers set to eBGP peers, communicate with each other. Their autonomous system numbers and prefixes are shown below.

Peer sections:
Service Provider A: AS number 100, prefix
Service Provider B: AS number 200, prefix
In this scenario, the vendor B want to receive, and three prefixes from A.

Installation and setup Quagga BGP peer

In the previous tutorial, we have written and set to install Quagga BGP peer method, therefore will not be described in detail, and only a brief introduction and configure BGP prefix advertisement

Description BGP peer has been opened. Router-A in to the router-B broadcast multiple prefixes, and Router-B is also a prefix to the router-A broadcast Two routers can send and receive the correct prefix.


Create a prefix list

You can use the router ACL or prefix list to filter a prefix. Prefix list is more common than ACL, because the former fewer processing steps, and easy to create and maintain.

ip prefix-list DEMO-PRFX permit
The above command to create the prefix list named "DEMO-FRFX" and allows only prefix.

Another powerful feature list is support prefix subnet mask range, see the following example:

ip prefix-list DEMO-PRFX permit le 24
This command creates prefix list contains a prefix between and / or 24, respectively,, and Operators "le" indicates less, you can also use "ge" means greater than equal.

A prefix list statements can have multiple allow or deny the operation. Each statement is automatically or manually assigned a serial number.

If more than one prefix list statements exist, these statements will be executed in sequence order of the sequence number. Configured prefix list, we need to pay attention after all prefix list statements are implicit denial statement, that those who are not allowed to clear, will be rejected.

If you want to set to allow all prefixes, prefix list statements are set as follows:

ip prefix-list DEMO-PRFX permit le 32
We already know how to create a prefix list statements, and now we want to create a prefix list named "PRFX-LST" and to meet the needs of our test scene.

router-b # conf t
router-b (config) #ip prefix-list PRFX-LST permit le 24

Create route map

In addition to the list of prefixes and ACL, there's another mechanism, called a route map can be controlled prefix BGP router. In fact, the route map for the prefix match for fine-tuning effects are stronger than the prefix list, and ACL.

Similar to the prefix list, the route map statement can also be specified to allow and deny actions, but also need to assign a serial number. Each route can have multiple matching allow or deny the operation. E.g:

route-map DEMO-RMAP permit 10
The above statement creates a route map called "DEMO-RMAP", add the number of 10 allowed to operate. Now we use the match command in the serial number corresponding to the route map to match.

router-a (config-route-map) # match (press? in the keyboard)
as-path Match BGP AS path list
community Match BGP community list
extcommunity Match BGP / VPN extended community list
interface match first hop interface of route
ip IP information
ipv6 IPv6 information
metric Match metric of route
origin BGP origin code
peer Match peer address
probability Match portion of routes defined by percentage value
tag Match tag of route
As you can see, the route map can match many properties in this tutorial is a prefix match.

route-map DEMO-RMAP permit 10
match ip address prefix-list DEMO-PRFX
Prefix list before this match will match command built in to allow the IP address (ie prefix, and

Next, we can use the set command to modify these properties. Examples are:

route-map DEMO-RMAP permit 10
match ip address prefix-list DEMO-PRFX
set (press? in keyboard)

aggregator BGP aggregator attribute
as-path Transform BGP AS-path attribute
atomic-aggregate BGP atomic aggregate attribute
comm-listset BGP community list (for deletion)
community BGP community attribute
extcommunity BGP extended community attribute
forwarding-address ForwardingAddress
ip IP information
ipv6 IPv6 information
local-preference BGP local preference path attribute
metric Metric value for destination routing protocol
metric-type Type of metric
origin BGP origin code
originator-id BGP originator ID attribute
src src address forroute
tag Tag value for routing protocol
vpnv4 VPNv4 information
weight BGP weight for routing table
As you can see, set commands can also modify many attributes. In order to make a demonstration, we modify the BGP local-preference this property.

route-map DEMO-RMAP permit 10
match ip address prefix-list DEMO-PRFX
setlocal-preference 500
As prefix list, at the end of the route map statement also implicit deny action. So we need a permit to add another statement (serial number 20) to allow all prefixes.

route-map DEMO-RMAP permit 10
match ip address prefix-list DEMO-PRFX
setlocal-preference 500
route-map DEMO-RMAP permit 20
SERIES 20 command specifies no matches, so the default matches all prefixes. In this route map statement, all prefixes are allowed.

Recall that our needs are only allowed to refuse or only some of the prefix, so the above set command should not exist in this scenario. We only need a permit statement, as shown below:

router-b # conf t
router-b (config) # route-map RMAP permit 10
router-b (config-route-map) # match ip address prefix-list PRFX-LST
The route map is the effect we need.

Application route map

Note that, before being applied to an interface or a BGP neighbor, ACL, prefix lists, and route maps will not take effect. And ACL and prefix lists, a route map statement can also be multiple interfaces or neighbors use. However, an interface or a neighbor can have only one route map statement applied to the input terminal, and a route map statement applied to the output terminal.

Let this be applied by the route map statement BGP configuration router-B for neighbor router-B is set to enter a prefix broadcast.

router-b # conf terminal
router-b (config) # router bgp 200
router-b (config-router) # neighbor RMAP in
Now broadcast routing and routing charged under examination.

Show broadcast routing command:

show ip bgp neighbor-IP advertised-routes
Displays the command to receive routes:

show ip bgp neighbor-IP routes

You can see, router-A has four routes prefix reach router-B, while the router-B receives only three. Look at the context, we can only know the route map is allowed prefixes can be displayed on the router-B, other prefixes Yigai discarded.

Tip: If you receive a prefix does not refresh the content, try to reset the BGP session, use this command: clear ip bgp neighbor-IP. This tutorial command is as follows:

clearip bgp
We can see that the system has met our request. Then we can create a similar prefix list and route map statement on the router-A router-B and to better control the prefix input and output.

Here the configuration process summarize for easy viewing.

router bgp 200
neighbor remote-as100
neighbor RMAP in
ip prefix-list PRFX-LST seq 5 permit le 24
route-map RMAP permit 10
match ip address prefix-list PRFX-LST

To sum up

In this tutorial we demonstrate how to set prefix list, and route maps to filter in Quagga BGP routes. We also show how the prefix list incorporated into the route map to fine-tune function input prefix. You can refer to these methods to set meet their needs prefix list, and route maps. These tools are to protect networks from poison routing and routing from bogon: Broadcast (LCTT Annotation refers to the address in the internet routing table should not appear) in.
- C language to view various types of data size (Programming)
- Shilpa Nair interview experience sharing RedHat Linux package management (Linux)
- 10 easy to use Linux utilities Recommended (Linux)
- Ubuntu 14.04 Nvidia proprietary drivers for install two graphic cards (Linux)
- PHP Performance Analysis and Experiment: Performance Micro Analysis (Programming)
- Zabbix installation under Linux (Server)
- Clojure programming languages: take full advantage of the Clojure plug-in Eclipse (Programming)
- Cache implementation APP interacts with the server-side interface control Session (Server)
- Nginx server load balancing dual-system availability (Server)
- Java memory area Explanation (Programming)
- Java MVC CRUD examples (Programming)
- TeamCity continuous integration in the Linux installation (Linux)
- Linux systems for entry-learning - Install Go language in Linux (Linux)
- Red Hat Enterprise Linux configuration VNC multi-user access methods (Linux)
- Linux system started to learn: how to view the Linux thread of a process (Linux)
- Ubuntu 14.04 Nvidia graphics driver installation and settings (Linux)
- Linux system file directory structure Introduction (Linux)
- Plasma 5.4 How to install on Kubuntu 15.04 (Linux)
- Let VMware ESXi virtual switch support VLAN (Linux)
- Source code is installed MySQL 5.6.28 (Database)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.