Configure BGP directory  

The BGP implementation of the router

How does BGP select the path

Basic configuration task of BGP

Advanced BGP configuration tasks

Configure basic BGP features

Configure advanced BGP features

The supervision and maintenance of BGP

Examples of BGP configuration

 

This chapter describes how to configure border gateway protocol (BGP). For complete description about BGP commands in this chapter, please refer to other sections related to “BGP command”. BGP is an Exterior Gateway Protocol (EGP) defined in RFC1163, 1267 and 1771. It permits to establish a route selection mechanism among different autonomous systems, this mechanism can automatically guarantee the loop-free routing information exchange between the autonomous systems.

The BGP implementation of the router

In BGP, each route includes a network number, the autonomous system list this route has tranverse (called As-path) and other attribute lists. Our router software supports BGP v4 defined in RFC1771. The basic function of BGP is to exchange network reachability information with other BGP systems, including information about AS-path information. This information can be used to construct the AS connection graph which can eliminate route loop, and it can implement AS level routing policy with AS connection graph. BGP v4 supports classless inter-domain router (CIDR), CIDR can reduce the size of the routing table through creating summary routes and thus creates a super network. CIDR removes the concept of network level in BGP, and supports IP prefix broadcasting. CIDR route can be transferred through OSPF, Enhanced IGRP, ISIS-IP and RIP2.

An important difference between exterior gateway routing and interior gateway router is the former has better controllability. In order to control the route, the implementation of BGP provides several optional methods:

l        In order to filter routes, it can be based on access-list based on neighbour, aspath-list, prefix-list and also use the access-list based on interface, prefix-list to filter routes or the Nexthop attribute of the routes.

l        In order to change the attribute of the routes, you can use the route-map to mend the attributes of BGP routes including MED, Local preference, route value and etc

l        In order to interact with the interior gateway dynamic routing protocol (OSPF, RIP, etc…), you can redistribute route, so as to automatically generate BGP routing information. You can also generate BGP routes through manual configuration of network, aggregation. While generating BGP routes, you can use route-map to configure the attributes of the routes.

l        In order to control the precedence of BGP routes in the system, you can use command “distance” to configure the management distance of BGP routes.

How does BGP select the path

The decision process of BGP is established on the basis of comparing route attribute value. When the same network has several routes, BGP selects the best route to the destination. The following process summarizes how BGP selects the best route:

1.  If it cannot arrive at the next hop, it will not be considered.

2.   If the path is internal and the synchronization is activated, and if the route is not in IGP, the route will not be considered.

3.   Select preferable path with the maximum precedence.

4.   If each route has the same value, preferably select the route with the maximum local precedence.

5.   If each route has the same local precedence, select preferably the route generated by local router. For example, route may be generated by local router through the using of command “network, aggregate” or by redistributing IGP route.

6.  If the local precedences are the same, or if there is no route generated by local router, then select preferably the route with the shortest AS path.

7.   If the AS path lengths are the same, then select preferably the route with the lowest attribute value of “origin” (IGP<EGP<IMCOMPLETE)

8.   If the attribute values of “Origin” are the same, then select preferable route with the lowest MED value. Unless “bgp always-compare-med” is activated, this comparable can only be carried out between the routes from the same neighbour AS.

9.   If each route has the same MED, select preferable external path (EBGP) rather than internal path (IBGP). All paths inside the autonomous system confederation are considered to be internal paths, but select preferably EBGP confederation not IBGP confederation.

10.  If each route has the same connection attribute, select preferable route with a smaller router-id.

Basic configuration task of BGP

The configuration tasks of BGP can be divided into basic tasks and advanced tasks. The first two entries of basic tasks are necessary to configure BGP, other entries in basic tasks and all advanced tasks are optional.

The basic configuration tasks of BGP include:

Advanced BGP configuration tasks

Advanced, optional BGP configuration tasks are listed as the following

For more related information about the configuration of the attributes of several IP route selection protocols, please refer to“The configuration of attributes of IP routing which are independent from the protocol”.

Configure basic BGP features

The task of this section is to configure the basic configuration attribute of BGP.

Activate the route selection of BGP

Configure BGP neighbor

Configure BGP soft reconfiguration

Reset BGP connection

Configure the synchronization between BGP and IGPs

Configure BGP route value

Configure BGP route filter based on the neighbour

Configure BGP route filtration based on the interface

Disable the nexthop treatment of BGP update

Cancel BGP update treatment towards next hop.

Activate the route selection of BGP

In order to activate BGP route selection, use the following commands under global configuration mode to activate BGP route selection: 

Step

Command

Function

1 router bgp autonomous-system

Under router configuration mode, activate BGP route selection process

2

network network-number/masklen [route-map route-map-name]

Tag the network as local autonomous system and add it to the BGP list.

NOTICE: For exterior gateway routing protocol, the using of configuration command “network ” to configure an IP network canand to only control which networks will be informed. This is opposite to interior gateway protocol (IGP), such as RIP, it is using command “network” to decide where to send the update.

NOTICE: Command “network” is used to import IGP routes to BGP routing table. Router resource, such as configured RAM, decides the upper limit of the usable command “network”. As a choice, you can use command “redistribute” to achieve the same effect.

 

Configure BGP neighbour

To configure BGP neighbour is to establish the peer to exchange routing information. BGP neighbour ought to be configured in order to exchange routing information with the outer world.

BGP supports two kinds of neighbours: internal neighbour (IBGP) and external neighbour (EBGP). Internal neighbours are in the same AS; external neighbours are in different ASs. Normally, external neighbours are adjacent to each other and share the same sub-network. But internal neighbours can be at any place in the same AS.

Use configuration command “Neighbor” to configure BGP neighbour:  

Command

Function

neighbor {ip-address | peer-group-name} remote-as number

Designate a BGP neighbour

For example about the configuration of the BGP neighbor, please refer to the section in the bottom of this chapter “an example of the configuration of the BGP neighbor”.

Configure BGP soft reconfiguration

Generally speaking, BGP neighbors only exchange all routes when the connections are established, after that, they only exchange update routes. So if the configured routing policy gently changes, in order to apply it on the received routes, it is necessary to clear BGP session. The clearing of BGP session will cause the invalidation of cache and will exert great influence on the operation of the network. Soft reconfiguration function enables the configuration and activation of policy without clearing BGP session. So, we recommend you to use soft reconfiguration, currently, we enable the soft reconfiguration based on each neighbour. When the soft reconfiguration is used on the incoming update produced by the neighbor, it is called incoming soft reconfiguration; When the soft reconfiguration is used on the outcoming update to the neighbor, it is called outcoming soft reconfiguration. Applying incoming soft reconfiguration can make the new input policy effective, Applying outcoming soft reconfiguration makes new local output policy effective without the reset of BGP session.

In order to generate new incoming update without resetting of BGP session, local BGP speaker should save the received incoming update without any modification, regardless whether it would be accepted or denied under current incoming policy. This will be very memory consuming and should be avoided. On the other hand, outcoming reconfiguration does not have any extra memory consumption, so it is always effective. You can trigger outcoming soft reconfiguration on the other side of BGP session to make the new local incoming policy effective.

In order to permit incoming soft reconfiguration, you should configure the BGP to save all accepted routing update. Outcoming reconfiguration need not be pre-configured.

Use the following router configuration command to configure BGP soft reconfiguration:  

Command

Function

Neighbor {ip-address | peer-group-name} soft-reconfiguration [inbound]

Configure BGP soft reconfiguration

If you use parameter “peer-community-name” to designate BGP peer community, all peer community members in it will inherit the feature of this command.

Reset BGP connection

Once two routers are defined as BGP neighbours, they create a BGP connection, and exchange routing information. If the BGP routing policy has been changed, or other configurations have been changed, then you should reset the BGP connection in order to make the change of configuration effective. Use one of the following two management mode commands to reset BGP connection:  

Command

Function

clear ip bgp *

clear ip bgp address

Reset all BGP connections.

Recreate a special BGP connection.

Configure the synchronization between BGP and IGPs

If you permit another AS to transfer data to the third AS through your AS, then the synchronization between your AS internal routing state and the routing information it broadcasted to another ASs is very important. For example, if your BGP wants to broadcast routes before all routers in your AS get to know the routes through IGP, then your AS may receive some information that some routers cannot route. In order to prevent these situations, BGP should wait until all IGP routers inside AS get to know that routing information, this is the synchronization between BGP and IGP, and the synchronization is activated by default.

Under certain situations, it is not necessary to synchronize. If you do not permit other ASs to transfer data through your AS, or if all routers in your AS will run BGP, your can cancel the Synchronization function. Cancelling that feature will enable you to put fewer routes in your IGP, and enable quicker convergence of BGP. Use the following router configuration command to cancel synchronization:   

Command

Function

no synchronization

Cancel the synchronization between BGP and IGP

While canceling synchronization, you should use command “clear ip bgp” to clear BGP dialogue.

For an example about BGP synchronization, please refer to the section in the bottom of this chapter an example of BGP path filtration by the neighbors.

Normally, you do not expect to redistribute all routes to your IGP. A common design is to redistribute one or two routes, and make them the external routes in IGRP, or force the BGP session to generate an AS default route. When BGP redistribute routes to IGP, only the routes acquired through EBGP will be redistributed. Under most situations, you do not want to allocate your IGP to BGP, just use configuration command “network ” to list the network in AS, then your network will be broadcasted. The networks listed in this form are called local network, and enables BGP to have attribute “Origin” of IGP. They must appear in the main IP routing table, and are effective; for example, they are direct-connected routes, static routes or routes known through IGP. BGP routing process periodically scans the main IP routing table to check the existence of a local network, and accordingly updates BGP routing table if you really want BGP to execute redistribution, you must be very careful, because these may be the routes in IGP that are injected by other routers through BGP, this may bring force a kind of situation that BGP potentially injects the information into IGP, and then send back the information to BGP. Vice versa.

 

Configure BGP route value

BGP route value is a number set to BGP route in order to control the route selection process, value is local for the router. The value ranges from 0 to 65535. BGP route generated locally has a default value of 32768, the route got from the neighbour values 0. The administrator can implement routing policy through the change of route value.

Use the following router configuration command to configure BGP route weight:

Command

Function

neighbor {ip-address | peer-group-name} weight weight

Designate a value to each route from one neighbour

Besides, you can change the route weight through route-map.

Configure BGP route filter based on the neighbour

There are 4 methods in BGP implementation of router software to filter BGP routes of the designated neighbours:



1. Use Aspath list filter together with global configuration command ip aspath-list and command neighbour filter-list.

Step

Command

Function

1 ip aspath-list aspaths-list-name {permit | deny} as-regular-expression Define an accessing list relative to BGP.
2 router bgp autonomous-system Enter into router configuration mode.

3

neighbor {ip-address | peer-group-name} filter-list aspath-list-name {in | out }

Establish a BGP filter.

 

2. Use access list together with global configuration command “ip access-list” and command “neighbour distribute-list”.

Step

Command

Function

1

ip access-list standard access-list-name

Define an access list.
2

router bgp autonomous-system

Enter into router configuration mode.

3

neighbor {ip-address | peer-group-name} distribute-list access-list-name {in | out }

Establish a BGP filter.

 

3. Use prefix list together with global configuration command “ip prefix-list” and command “neighbour prefix-list”.

Step

Command

Function

1

ip prefix-list prefixs-list-name permit |denyA.B.C.D/n ge x le y

Define a prefix list.
2 router bgp autonomous-system Enter into router configuration mode.

3

neighbor {ip-address | peer-group-name} prefix-list prefix-list-name {in | out }

Establish a BGP filter.

 

4. Use route-map together with global configuration command “route-map” and command “neighbour route-map”.

Using route-map can not only filter routes, but also changes routes attribute, the usage will be described in the following chapters.

For example based on neighbour filter route, please refer to “example of BGP route filtration based on the neighbor”.

Configure BGP route filtration based on the interface

Configuring BGP route filtration based on the interface can be achieved through using access list and prefix list.  Network number and the gateway address of the routes can be filtered. It can designate “access-list” option to use access list for filtration of network number of the routes, designate “prefix-list” option to use prefix list for filtration of network number of the routes, designate “gateway” option to use access list for filtration of “nexthop” attribute of the routes. It can even filter the network number and “nexthop” attribute of routes at the same time, but “access-list” option cannot be used together with “prefix-list” option. Designate  “*” can filter the routes on all interfaces.

To order to configure the filtration of BGP routes based on the interface, you should carry out the following configurations under BGP configuration mode:

Command

Function

filter interface in | out}〔access-list access-list-name prefix-list prefix-list-name〕〔gateway access-list-name

Filter BGP routes based on the interface

For examples of route filtration based on the interface, please refer to “examples of BGP route filtration based on the interface”.

Disable the nexthop treatment of BGP update

You can configure to disable the nexthop treatment of neighbour BGP update. This may be useful in non-broadcasting network (such as FR or X.25), in FR or X.25 network, BGP neighbour may not directly access all other neighbors in the same IP sub-network. There are two methods to cancel nexthop treatment:

1. Use the local IP address of this BGP connection to replace the nexthop address of the outcoming route;

2. Use route-map to designate the nexthop address of incoming or outcoming routes. (Please refer to other chapters)

Use the following router configuration command to disable nexthop treatment and use the local IP address of this BGP connection to replace the nexthop address of the outcoming routes.

Command

Function

neighbor {ip-address | peer-group-name} next-hop-self

Disable the nexthop treatment while carrying out BGP neighbour update.

Using this command to configure will enable the current router to inform itself to be the nexthop of the route. So, other BGP neighbours will forward packets to this network to the current router. This is very useful in non-broadcasting network environment, because there exists a path from the current router to the designated neighbor. But it is not the case in broadcasting network environment, because this will induce unnecessary extra hops.

 

Configure advanced BGP features

The task of this section is to configure advanced BGP features.

Use route-map to filter and modify route update

Configure aggregate address

Configure BGP community attribute

Configure autonomous system confederation

Configure route reflector

Shut down peer entity

Configure multihop external peer body

Configure the management distance of BGP routes

Adjust BGP timer

Compare MED of routes from different AS

Use route-map to filter and modify route update

You can use route-map to filter route update and modify parameter attribute based on each neighbour. Route-map can be applied both on incoming update and outcoming update. Only the routes passing route-map can be processed while sending or accepting route update.

Route-map supports incoming and outcoming update to match with AS path, community and network number. AS matching demands the using of command “aspath-list”; the matching based on community demands the using of command “community-list”, the matching based on the network demands the use of command “ip access-list”.

Use the following BGP configuration command to configure route-map for filtration and modification of route update:

Command

Function

neighbor {ip-address | peer-group-name} route-map route-map-name {in  | out}

Apply route-map on incoming or outcoming routes

For examples of using route-map to filter and modify the route update, please refer to Examples of BGP route-map.

Configure aggregate address

Classless inter-domain routing can create aggregate routing (and super network) to minimize the routing table. You can configure aggregate routing in BGP through redistributing aggregate routes to BGP or through using conditional aggregate attributes described in the following task list. If there is at least one more detailed record in BGP routing table, add the aggregate address to the BGP routing table.

Use one or more router configuration commands in the following to create an aggregate address in the routing table:

Command

Function

aggregate network/len Create aggregate address in BGP routing table.
aggregate network/len summary-only Broadcast summary address only.

aggregate network/len route-map map-name

Generate aggregate address according to conditions designated by route-map.

 For examples regarding the using of BGP route aggregation, please refer to the section in the bottom of this chapter “examples of BGP route aggregation”.

Configure BGP community attribute

The routing policy that BGP supports is mainly based on one of the 3 values in BGP routing information:



1. Network number of routes: 

2. AS_PATH attribute value of routes:

3. The community attribute value of routes



Dividing the routes into communities through “community” attribute, and applying the routing policy based on the community, thereby simplifies the configuration of control of routing information.

Community is a group of routes with the common attributes; each route may belong to several communities. AS administrators can define a certain route belongs to a certain community.

Community attribute is an optional and transferable global attribute ranging from 1 to 4,294,967,200. The famous communities pre-defined in the Internet communities include:

No-export----- Do not advertise this route to EBGP peer  (Including the EBGP peers inside the autonomous system confederation).

No-advertise----Do not advertise this route to any peer .

local-as----Do not advertise this route to the exterior of autonomous system (ca send this route to the other sub-AS peers in the autonomous system confederation.)

When generating, accepting or sending routes, BGP speakers can configure, add or modify the route community attribute. when aggregating routes, the generated aggregation includes the “community” attributes from complete communities of all original routes.

By default, “Community” attributes are not sent to the neighbor. Use the following BGP configuration command to designate sending “community” attribute to the neighbour:

Command

Function

neighbor {ip-address | peer-group-name} send-community

Designate to send attribute “community” to the neighbor.

 

You need to do the following jobs to configure community attribute for the router:

Step

Command

Function

1 route-map map-name sequence-number {deny | permit}  Configure route-map.
2 set community community-value Configure rule of setting.
3 router bgp autonomous-system Enter into router configuration mode.

4

neighbor {ip-address | peer-group-name} route-map access-list-name {in | out }

Apply route-map.

 

To filter routing information based on community attributes, you need to do the following jobs:

Step

Command

Function

1

ip community-list community-list-name {permit | deny} communtiy-expression Define community list.

2

route-map map-name sequence-number {deny | permit} 

Configure route-map.

3

match community-list-name Configure rules of matching.

4

router bgp autonomous-system Enter into router configuration mode

5

neighbor {ip-address | peer-group-name} route-map route-map-name {in | out }

Apply route-map.

 For examples of using community attributes, please refer to “Examples of route-map using BGP community attribute”.

Configure autonomous system confederation

The way to reduce the number of IBGP connections is to divide an AS into several sub-AS, then form them into an autonomous system confederation. From the external perspective, the confederation looks like an AS. In the confederation, each sub-AS is full-mesh inside, and has connections with other sub-ASs in the same confederation. Even if there are EBGP sessions between peers of different sub-ASs, they may still exchange routing selection information like IBGP peers. Concretely speaking, it is saving the nexthop, MED and local precedence information.

To configure a BGP autonomous system confederation, you should designate the confederation identifier. The confederation identifier is an AS number, from an external perspective, the confederation is just like a single AS with AS number being the confederation identifier.

Use the following BGP configuration command to configure confederation identifier of the        autonomous system.:  

Command

Function

bgp confederation0 identifier autonomous-system

Configure the confederation identifier of the autonomous system.

 

In order to designate the autonomous system number belonging to autonomous system confederation, use the following BGP configuration command:  

Command

Function

bgp confederation peers autonomous-system [autonomous-system ...]

Designate the AS belongs to the confederation of autonomous system

 For examples of autonomous system confederation, please refer to “examples of BGP autonomous system confederation”.

Configure route reflector

Another method to reduce the number of IBGP connections instead of configuring autonomous system confederation is to configure route reflector.

The internal peers of the route reflector are divided into two groups: client peers and all other routers (non-client peers). The route reflector reflects the routes between the two groups; the route reflector and its client peers form a cluster. Non-client peers must be full-mesh connected, but client peers need not. The clients in the cluster do not communicate with IBGP speakers outside the cluster.

When route reflector receives routing information, it completes the following tasks:

1. Broadcast the routes from external BGP speaker to all clents and non-client peers.

2. Broadcast the routes from non-client to all clents.

3. Broadcast the routes from the clients to all clients and non-client peers. So, the client peers need not be full-mesh-conneted.

Use the following router configuration command to configure the local router as the reflector and        designate neighbors as the router reflector client:

Command

Function

neighbor ip-address route-reflector-client

Configure the local router as route reflector and designate neighbors as the client

 An AS may have several route reflectors, the way route reflector to process other route reflectors is the same as the processing of IBGP speakers.Normally, a cluster of clients have only one route reflector, and then the cluster is identified by the route reflector ‘s router ID. In order to increase the redundancy and avoid the failure of single node, a cluster may have more than one route reflectors. In this case, all the route reflectors in the cluster should be configured with 4-bit cluster ID, so that the route reflector can identify the update information of the route reflector in the same cluster. All the route reflectors belonging to the same cluster should be full-mesh-connected, and they should have the same client and non-client peer set.

If there is more than one route reflector in the cluster, you can use the following BGP configuration command to configure cluster ID:

Command

Function

bgp cluster-id cluster-id

Configure cluster-ID.

 

For examples of the configuration of route reflector, please refer to “examples of the configuration of BGP route reflector”.

Shut down peer entity

Use the following BGP configuration command to shut down BGP neighbour:

Command

Function

neighbor {ip-address | peer-group-name} shutdown

Shut down BGP neighbour

Use the following BGP configuration command to activate the neighbour shut down previously:

Command

Function

no neighbor {ip-address | peer-group-name} shutdown

Activate BGP neighbour

 

Configure multihop external peer body

By default, external peers should be on a directly connected network, in order to configure multihop external peer, you need to carry out the following task:

Command

Function

neighbor {ip-address | peer-group-name} ebgp-multihop ttl

Configure BGP neighbor as multihop external peer.

Configure the management distance of BGP routes

Management distance is a kind of measurement of the preference of different routing protocol. BGP uses 3 different management distances: external distance, internal distance and local distance. The routes obtained from external BGP will be assigned with the external distiance; the routes obtained from internal BGP will have a distance as internel distance, local routes will be given the local distance. Use the following BGP configuration command to configure BGP route management distance:

Command

Function

distance bgp external-distance internal-distance local-distance

Configure BGP route management distances

 The change of management distances of BGP route is dangerous, and normally it is not recommended. The external distance should be shorter than the distance of any other dynamic routing protocol and the internal distance should be longer than the distance of any other dynamic routing protocol.

Adjust BGP timer

Use the following BGP configuration command to adjust the BGP “keepalive” and “holdtime” timers of detailed neighbour:  

Command

Function

neighbor [ip-address | peer group-name] timers keepalive holdtime

Set “keepalive” and “holdtime” timer interval (count with unit ‘second’) for designated peer or peer community

Use command “no neighbour timers” to reset the timer interval of BGP neighbor or peer community to the default value.

Compare MED of routes from different AS

MED is a parameter to be considered when selecting the best route from several paths. The path with lower MED value will be preferably considered than the route with higher MED value.

Under default situation, during the process of selecting the best route, MED’s comparison only takes place in the routes from the same AS. You can permit the MEDs’ comparison to take place in routing selection, regardless of which AS the routes come from.

Use the following BGP configuration command to realize the above objective:  

Command

Function

bgp always-compare-med

Permit to make MEDs comparison among routes from different AS.

The supervision and maintenance of BGP

The administrator can show, delete the content of the routing table or other database in BGP, it can also show the detailed statistical information. The following part desbribes these tasks.

Clear BGP routing table and database

Show routing table and system statistical information

Trace BGP information

 

Clear BGP routing table and database

The following table lists the tasks related to the clearing of cache, table or BGP database, use these commands under the management mode:

Command

Function

clear ip bgp *

Reset all BGP connections

clear ip bgp as-number Reset BGP connection of the designated autonomous system.
clear ip bgp address Reset BGP connection of the designated neighbor
clear ip bgp address soft in|out Clear the incoming database or outcoming database of the designated neighbour.

clear ip bgp aggregates

Clear the routes generated by router aggregation.
clear ip bgp networks Clear the routes generated by command “network”.
clear ip bgp redistribute Clear the routes generated by redistributon

Show routing table and system statistical information

It can show you the detailed statistical information such as BGP routing table, database content or so on. The provided information can be used to decide the utilization of resource and to solve the network problem. It can also show you the information for network node rechability.

Use the following management commands to show various statistical information about routing:

Command

Function

show ip bgp Show the BGP routing table in the system.
show ip bgp prefix Show the routes matching the designated prefix list.
show ip bgp community Show the statistical information about community attributes.
show ip bgp regexp regular-expression Show the routes matching the designated regular expression
show ip bgp network Show the designated BGP routes.
show ip bgp neighbors address Show the detailed information about the TCP and BGP connection with the designated neighbour.
show ip bgp neighbors [address] [received-routes | routes | advertised-routes] Show the acquired routes from special BGP neighbor.
show ip bgp paths Show all BGP path information in the database.

show ip bgp summary

Show all states of BGP connection.

Trace BGP information

You can observe the process of the establishment of BGP connection and the process of route receiving and sending through the tracing of BGP information in order to appoint the errors and solve the problems. The command of tracing the information is listed as the following:

Command

Function

debug ip bgp * Trace general BGP information
debug ip bgp all Trace all BGP information.
debug ip bgp fsm Trace BGP states machine.
debug ip bgp keepalive Trace the “keepalive” message of BGP.
debug ip bgp open Trace the “open” message of BGP.

debug ip bgp update

Trace the “update” message of BGP.

Examples of BGP configuration

The following sections provide the examples of BGP configuration

An example of BGP route-map

An example of neighbour configuration

An example of BGP route filtration based on the neighbor

Examples of BGP route filtration based on the interface

Examples of using prefix list to configure route filtration

Example of BGP route aggregation

Example of BGP route reflector

An example of BGP confederation

An example of route map with BGP group attribute

An example of BGP route-map

 

The following example illustrates how to use route-map to change the incoming route attribute from the neighbor. Set the metric of all routes that come from neighbour 140.222.1.1 and meet the requirement of ASPATH accessing list “aaa” to 200, local precedence value to 250, and they are accepted, all other routes will be denied.

router bgp 100

!

 neighbor 140.222.1.1 route-map fix-weight in

 neighbor 140.222.1.1 remote-as 1

!

route-map fix-weight permit 10

 match as-path aaa

 set local-preference 250

 set weight 200

!

ip aspath-list aaa permit ^690$

ip aspath-list aaa permit ^1800

 

In the following example, the first entry of route-map “freddy” will set the MED attributes of all routes origining from autonomous system 690 to 127. The second entry allows the routes that don’t meet the above conditions to be transferred to neighbor 1.1.1.1.

router bgp 100

 neighbor 1.1.1.1 route-map freddy out

!

ip aspath-list abc permit ^690_

ip aspath-list xyz permit .*

!

route-map freddy permit 10

 match as-path abc

 set metric 127

!

route-map freddy permit 20

match as-path xyz

 

The following example illustrates how to use route-map to change the routes from route redistribution:

router bgp 100

 redistribute rip route-map rip2bgp

!

 route-map rip2bgp

 match ip address rip

 set local-preference 25

 set metric 127

 set weight 30000

 set next-hop 192.92.68.24

 set origin igp

!

ip access-list standard rip

 permit 131.108.0.0 255.255.0.0

 permit 160.89.0.0 255.255.0.0

 permit 198.112.0.0 255.255.128.0

An example of neighbour configuration

In the following example, BGP router belongs to AS109, and creates two networks. This router has 3 neighbors: the first neighbor is an external one (in different AS); the second is internal one (with the same AS number). The third is also an external one.

 

router bgp 109

 network 131.108.0.0

 network 192.31.7.0

 neighbor 131.108.200.1 remote-as 167

 neighbor 131.108.234.2 remote-as 109

 neighbor 150.136.64.19 remote-as 99

 

An example of BGP route filtration based on the neighbor

Here is an example of BGP path filtration based on the neighbor. The routes passing through as-path access list “test1” will receive a metric value as 100. Only routes passing through as-path access list “test2” will be sent to 193.1.12.10, similarly, only those routes passing access list “test3” will be accepted by 193.1.12.10:

 

router bgp 200

 neighbor 193.1.12.10 remote-as 100

 neighbor 193.1.12.10 filter-list test1 weight 100

 neighbor 193.1.12.10 filter-list test2 out

 neighbor 193.1.12.10 filter-list test3 in

ip aspath-list test1 permit _109_

ip aspath-list test2 permit _200$

ip aspath-list test2 permit ^100$

ip aspath-list test3 deny _690$

ip aspath-list test3 permit .*

Examples of BGP route filtration based on the interface

 The following is the example of the configuration of route filtration based on the interface. It filters the routes from interface e1/0 through access list ac1:

router bgp 122

 filter e1/0 in access-list acl

 

The following example uses access list “filter-network” to filter the network numbers of the routes, and meanwhile, uses access list “filter-gateway” to filter gateway address of the routes  from interface s1/0.

router bgp 100

 filter s1/0 in access-list filter-network gateway filter-gateway

 

The following example: uses prefix list “filter-prefix” to filter the network numbers of the routes, and meanwhile, use accessing list “filter-gateway” to filter gateway address of routes from all interfaces.

router bgp 100

 filter * in prefix-list filter-prefix gateway filter-gateway

Examples of using prefix list to configure route filtration

In the following example default route 0.0.0.0/0 is denied.

ip prefix-list abc deny 0.0.0.0/0

 

The following example: permits routes matching prefix 35.0.0.0/8:

ip prefix-list abc permit 35.0.0.0/8

 

In the following example, BGP process only accepts prefix with length ranges from /8 to /24:

router bgp

 network 101.20.20.0

 filter * in prefix max24

!

 ip prefix-list max24 seq 5 permit 0.0.0.0/0 ge 8 le 24

!

 

 In the following configuration, the router filters routes from all interfaces, it only accepts routes with prefix from 8 to 24:

router bgp 12

 filter * in prefix-list max24

ip prefix-list max24 seq 5 permit 0.0.0.0/0 ge 8 le 24

 

Here are some other examples of configuration of prefix lists

The following example: permits routes with prefix length no more than 24 in network 192/8:

ip prefix-list abc permit 192.0.0.0/8 le 24

 

The following example: denies routes with prefix length of more than 25 in network 192/8:

ip prefix-list abc deny 192.0.0.0/8 ge 25

 

The following example: permits routes with prefix length of more than 8 yet less than 24 in all address space:

ip prefix-list abc permit 0.0.0.0/0 ge 8 le 24

 

The following example: denies all routes with prefix length of more than 25 in all address space:

ip prefix-list abc deny 0.0.0.0/0 ge 25

 

This example: denies routes from network 10/8, because if the mask on class A network 10.0.0.0/8 is smaller or equal to 32 bit, all routes from that network will be denied:

ip prefix-list abc deny 10.0.0.0/8 le 32

 

The following example: denies routes with mask length of more than 25 in network 204.70.1.24:

ip prefix-list abc deny 204.70.1.0/24 ge 25

 

The following example: permits all routes:

ip prefix-list abc permit any

 

Example of BGP route aggregation

 

The following example illusrates how to create aggregation routes in BGP.It may be created by route redistribution or the using of conditional route aggregation function.

 

In the following example, command “redistribute static” is used to redistribute aggregation route 193.*.*.*:

ip route 193.0.0.0 255.0.0.0 null 0

!

router bgp 100

 redistribute static

 

When there is at least one route in the routing table within the designated range, the following configuration will create an aggregation route in BGP routing table. The aggregation route will be considered to be from your AS, and has the “atomic” attribution, to indicate the possibilities of the loss of information.

router bgp 100

aggregate 193.0.0.0/8

 

The following example not only creates an aggregation route 193.*.*.*, but also prohibit it to broadcast the more concrete routes to all the neighbours:

router bgp 100

aggregate 193.0.0.0/8 summary-only

Example of BGP route reflector

The following is an example of route reflector configuration. RTA, RTB, RTC, RTE all belong to the same autonomous system AS200, RTA serves as route reflector, RTB and RTC are route reflector clients, and RTE is normal IBGP neighbor.  RTD belongs to AS100, and creates EBGP connection with RTA, the configuration is illustrated as the following:

1.          RTA configuration:
interface s1/0
ip address 2.0.0.1 255.0.0.0
!
interface s1/1
ip address 3.0.0.1 255.0.0.0
!
interface s1/2
ip address 4.0.0.1 255.0.0.0
!
interface s1/3
ip address 5.0.0.1 255.0.0.0
!
router bgp 200
neighbor 2.0.0.1 remote-as 200   /*RTC IBGP*/
neighbor 2.0.0.1 route-reflector-client
neighbor 3.0.0.1 remote-as 200   /*RTB IBGP*/
neighbor 3.0.0.1 route-reflector-client
neighbor 5.0.0.1 remote-as 200   /*RTE IBGP*/
neighbor 4.0.0.2 remote-as 100   /*RTD EBGP*/
network 11.0.0.0/8
!
ip route 11.0.0.0 255.0.0.0 2.0.0.12

2.        RTB configuration:
interface s1/0
ip address 3.0.0.2 255.0.0.0
!
router bgp 200
neighbor 3.0.0.1 remote-as 200   /*RTA IBGP*/
network 13.0.0.0/8
!
ip route 13.0.0.0 255.0.0.0 3.0.0.12

3.        RTC configuration:
interface s1/0
ip address 2.0.0.2 255.0.0.0
!
router bgp 200
neighbor 2.0.0.1 remote-as 200   /*RTA IBGP*/
network 12.0.0.0/8
!
ip route 12.0.0.0 255.0.0.0 2.0.0.12

4.       RTD configuration:
interface s1/0
ip address 4.0.0.2 255.0.0.0
!
router bgp 100
neighbor 4.0.0.1 remote-as 200   /*RTA EBGP*/
network 14.0.0.0/8

ip route 14.0.0.0 255.0.0.0 4.0.0.12

5.      RTE configuration:
interface s1/0
ip address 5.0.0.2 255.0.0.0
!
router bgp 200
neighbor 5.0.0.1 remote-as 200   /*RTA IBGP*/
network 15.0.0.0/8
!
ip route 15.0.0.0 255.0.0.0 5.0.0.12

An example of BGP confederation

The following is the configuration of confederation. RTA, RTB, RTC create IBGP connections, and it belongs to a private autonomous system 65010; RTE belongs to another private autonomous system 65020; RTE and RTA establish internal EBGP connection of confederation; AS65010 AS65020 conprise the confederation, whose identifier is AS200; RTD belongs to autonomous system AS100, RTD establishes EBGP connection with autonomous system 200 through RTA.  

 

1.          RTA configuration:
interface s1/0
ip address 1.0.0.1 255.0.0.0
!
interface s1/1
ip address 2.0.0.1 255.0.0.0
!
interface s1/2
ip address 4.0.0.1 255.0.0.0
!
interface s1/3
ip address 5.0.0.1 255.0.0.0
!
router bgp 65010
bgp confederation identifier 200
bgp confederation peers 65020
neighbor 1.0.0.2 remote-as 65010  /*RTB IBGP*/
neighbor 2.0.0.2 remote-as 65010  /*RTC IBGP*/
neighbor 5.0.0.2 remote-as 65020  /*RTE EBGP*/
neighbor 4.0.0.2 remote-as 100    /*RTD EBGP*/

2.    RTB configuration:
interface s1/0
ip address 1.0.0.2 255.0.0.0
!
interface s1/1
ip address 3.0.0.1 255.0.0.0
!
router bgp 65010
bgp confederation identifier 200
bgp confederation peers 65020
neighbor 1.0.0.1 remote-as 65010  /*RTA IBGP*/
neighbor 3.0.0.2 remote-as 65010  /*RTC IBGP*/

3.   RTC configuration:
interface s1/0
ip address 2.0.0.2 255.0.0.0
!
interface s1/1
ip address 3.0.0.2 255.0.0.0
!
router bgp 65010
bgp confederation identifier 200
bgp confederation peers 65020
neighbor 2.0.0.1 remote-as 65010  /*RTA IBGP*/
neighbor 3.0.0.1 remote-as 65010  /*RTB IBGP*/

4.    RTD configuration:
interface s1/0
ip address 4.0.0.2 255.0.0.0
!
router bgp 100
neighbor 4.0.0.1 remote-as 200  /*RTA EBGP*/

5.   RTE configuration:
interface s1/0
ip address 5.0.0.2 255.0.0.0
!
router bgp 65020
bgp confederation identifier 200
bgp confederation peers 65010
neighbor 5.0.0.1 remote-as 65010  /*RTA EBGP*/

An example of route map with BGP group attribute

This section includes three examples of using route map with BGP community attribute.

In the first example, “route map set-community” is applied on the outcoming update of neighbor 171.69.232.50. Set the special community attribute with value “no-export”  for the routes passing access list aaa, while other routes are broadcasted normally. This special community attribute will automatically prevent BGP speakers in AS200 from advertising the route outside of the autonomous system.

router bgp 100

 neighbor 171.69.232.50 remote-as 200

 neighbor 171.69.232.50 send-community

 neighbor 171.69.232.50 route-map set-community out

!

 route-map set-community 10 permit

 match ip address aaa

 set community no-export

!

 route-map set-community 20 permit

 

In the second example, “route map set-community” is used for the outcoming update of neighbour 171.69.232.90. All routes orgining from AS70 will insert value 200 into the community attribute 200, all other routes will just be advertised normally.

route-map bgp 200

 neighbor 171.69.232.90 remote-as 100

 neighbor 171.69.232.90 send-community

 neighbor 171.69.232.90 route-map set-community out

!

route-map set-community 10 permit

 match as-path test1

 set community-additive 200 200

!

route-map set-community 20 permit

 match as-path test2

!

ip aspath-list test1 permit 70$

ip aspath-list test2 permit .*

 

In the third example, selectively set the MED and local preference value of routes from neighbor 171.69.232.55 according to the commumity attribute value of the routes. All routers matching with community list com1will be set with MED as 8000, this may include routes with community value “100 200 300” or “900 901”. These routes may have other attribute values.

All routes transmitting community list com2 will be set with the local preference value as 500.

All other routes will be set with the local priority value as 50. So, all the rest of the routes of neighbor 171.69.232.55 have the preference of 50.

router bgp 200

neighbor 171.69.232.55 remote-as 100

neighbor 171.69.232.55 route-map filter-on-community in

!

route-map filter-on-community 10 permit

match community com1

set metric 8000

!

route-map filter-on-community 20 permit

match community com2

set local-preference 500

!

route-map filter-on-community 30 permit

set local-preference 50

!

ip community-list com1 permit 100 200 300

ip community-list com1 permit 900 901

!

ip community-list com2 permit 88

ip community-list com2 permit 90

!