6.7. BGP

Overview

Border Gateway Protocol (BGP) allows the exchange of routing information between an Autonomous System (AS) and other Autonomous Systems. The Clavister NetShield Firewall can act as a single AS and use BGP to both import routes from and export routes to other autonomous systems.

BGP is implemented in cOS Stream in a similar way to OSPF. A single BGPProcess object must be defined which identifies the firewall as an AS with an AS number and router ID. Other objects are then added to define BGP neighbors as well as what routes can be imported from these neighbors and what routes can be exported to them.

BGP can both import and export routes from/to local routing tables as well as OSPF-processes.

In the simplest scenario, BGP setup will involve the following 3 steps:

A. Set up a BGP process that can communicate with other BGP processes.

B. Add process rules to import routes from BGP processes.

C. Add rules to export routes to BGP processes.

A detailed description of these three steps along with examples are given next.

A. Set up a BGP process that can communicate with BGP neighbors:

Example 6.16. Setting Up a BGP Process with Neighbors

This example shows how a BGP process is created with associated neighbors. It is assumed the process will have a private AS number of 64512 and its ID specified as the private IPv4 address 192.168.0.10.

A single BGP neighbor will be associated with the process that has the IPv4 address 10.0.0.100.

Note that this and later examples use private IP addresses and private AS numbers. It is assumed that the AS is not connected to the public Internet.

Command-Line Interface

Add the BGPProcess object:

System:/> add BGPProcess my_bgp ASNum=64512 RouterID=192.168.0.10

Change the CLI context to be the BGP process:

System:/> cc BGPProcess my_bgp

Add a BGPNeighbor as a child:

System:/BGPProcess/my_bgp> add BGPNeighbor
			IPAddress=10.0.0.100
			RemoteASNum=64513

B. Add process rules to import routes from neighbors:

Example 6.17. Adding Rules to Import Routes to a BGP Process

This example continues from the previous example and adds rules to the BGP process to import routes from neighbors. Only routes within the network 10.0.1.0/24 will be imported and they will be inserted into cOS Stream's main routing table.

Command-Line Interface

Make sure the CLI context is the BGP process:

System:/> cc BGPProcess my_bgp

Add a child RouteExportRuleBGP object to import all routes within 10.0.1.0/24:

System:/BGPProcess/my_bgp> add RouteExportRuleBGP 
			DestinationNetworkIn=10.0.1.0/24

Change the CLI context to be the rule:

System:/BGPProcess/my_bgp> cc RouteExportRuleBGP 1

Add an ExportToRoutingTable object as a child to specify the destination:

System:/BGPProcess/my_bgp/RouteExportRuleBGP/1> 
			add ExportToRoutingTable
			Destination=main

Return to the default CLI context:

System:/BGPProcess/my_bgp/RouteExportRuleBGP/1> cc
System:/> 

C. Add rules to export routes to neighbors:

Example 6.18. Adding Rules to Export Routes to BGP Neighbors

This example continues from the previous example and adds a rule to cOS Stream's main routing table to export routes to BGP neighbors.

Command-Line Interface

Change the CLI context to be the main routing table:

System:/> cc RoutingTable main

Add a child RouteExportRule object to export all routes within 10.0.2.0/24:

System:/RoutingTable/main> add RouteExportRule 
			DestinationNetworkIn=10.0.2.0/24

Change the CLI context to be the rule:

System:/RoutingTable/main> cc RouteExportRule 1

Add an ExportToRoutingTable object as a child to specify the destination:

System:/RoutingTable/main/RouteExportRule/1> 
			add ExportToBGP
			ExportToProcess=my_bgp

Return to the default CLI context:

System:/RoutingTable/main/RouteExportRule/1> cc
System:/> 

Dynamically Applying Changes to Exchanged Routes

It is possible to dynamically apply specified modifications to given routes as they are exported to a particular neighbor or imported from a particular neighbor. The modifications could, for example, involve changing the route's next-hop or metric, or a variety of other parameters such as community related options.

Specifying such dynamic changes is done with the following steps:

Using these steps is illustrated in the example below.

Example 6.19. Applying Dynamic Changes to BGP Routes

This example will change the next-hop of the exported route for the host at IP address 10.0.2.15.

Command-Line Interface

Create a new RoutePrefixList object:

System:/> add DynRouteObject RoutePrefixList my_net

Change the CLI context to this list:

System:/> cc DynRouteObject RoutePrefixList my_net

Add a child RoutePrefixEntry object to specify the host:

System:/RoutePrefixList/my_net> add RoutePrefixEntry 
			Action=Allow
			Network=10.0.2.15

Return to the default CLI context:

System:/RoutePrefixList/my_net> cc

Create a new RouteMap object:

System:/> add DynRouteObject RouteMap my_map

Change the CLI context to this map:

System:/> cc DynRouteObject RouteMap my_map

Add a child RouteMapEntry object to specify the desired change:

System:/RouteMap/my_map> add RouteMapEntry 
			Action=Allow
			MatchIP=my_net
			SetNextHop=10.0.0.90

Return to the default CLI context:

System:/RoutingTable/main/RouteExportRule/1> cc

Change the CLI context to be the BGP process:

System:/> cc BGPProcess my_bgp

Set the route map to use for routes exported a specific neighbor:

System:/BGPProcess my_bgp> set BGPNeighbor 1 
			RouteMapOut=my_map

Return to the default CLI context:

System:/RoutingTable/main/RouteExportRule/1> cc
System:/> 

[Note] Note: Configuration with BGP

When BGP is configured with SIIT or NAT64, BGP export needs to be configured accordingly. This is discussed further in section 3.2 of RFC 6052.

Using BFD

Using Bidirectional Forwarding Detection (BFD) with BGP allows very fast failover time when a neighbor becomes unreachable. By default, it is disabled with BGP and is enabled by setting the value of the property FalloverDetection to BFD in the relevant BGPNeighbor object.

The following should be noted about using BFD:

BGP With High Availability Clusters

If a failover occurs in an HA cluster that is running BGP, the following should be noted: