bgpd
****

bgpd is a Border Gateway Protocol 4 (BGP-4) protocol daemon. BGP-4 is described in RFC1771.  bgpd also supports Multiprotocol Extension for BGP-4 (sometimes known as BGP-4+ or MBGP) which is described in RFC2283.

BGP-4 is one of the EGPs (Exterior Gateway Protocols) and is used for inter-domain routing.

Configuring bgpd
================

Default configuration file of bgpd is bgpd.conf. bgpd searches the current directory first then INSTALL_PREFIX_ETC/bgpd.conf.  All of bgpd's command must be configured in bgpd.conf.

bgpd specific invocation options are described below.  Common options may also be specified (see Common Invocation Options).

-p PORT
--bgp_port=PORT
     Set the bgp protocol's port number.

-r
--retain
     When program terminates, retain BGP routes added by zebra.

BGP router
==========

First of all you must configure BGP router with router bgp command.  To configure BGP router, you need AS number.  AS number is an identification of autonomous system.  BGP protocol uses the AS number for detecting whether the BGP connection is internal one or external one.

AS number is a digit between 1 and 65535.  The use of AS numbers is described in RFC1930.  AS numbers 64512 through 65535 are defined as private AS numbers.  Private AS numbers must not to be advertised in the global Internet.

 -- Command: router bgp AS-NUMBER
     Enable a BGP protocol process with the specified AS-NUMBER.  After this statement you can input any BGP Commands.  You can not create different BGP process under different AS-NUMBER without specifying multiple-instance (see Multiple instance).

 -- Command: no router bgp AS-NUMBER
     Destroy a BGP protocol process with the specified AS-NUMBER.

 -- BGP Command: bgp router-id ROUTER-ID
     This command specifies the router-ID.  If bgpd connects to zebra it gets interface and address information.  In that case default router ID value is selected as the largest IP Address of the interfaces.  When router zebra is not enabled bgpd can't get interface information so router-id is set to 0.0.0.0.  So please set router-id by hand.

BGP peer
========

 -- BGP Command: neighbor PEER remote-as AS-NUMBER
     Creates a new neighbor whose remote-as is AS-NUMBER.  PEER can be an IPv4 address or an IPv6 address.

          router bgp 1
           neighbor 10.0.0.1 remote-as 2

     In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1.

     This command must be the first command used when configuring a neighbor. If the remote-as is not specified, bgpd will complain like this:

          can't find neighbor 10.0.0.1

BGP network
===========

 -- BGP Command: network NETWORK
     This command adds the announcement network.

          router bgp 1
           network 10.0.0.0/8

     This configuration example says that network 10.0.0.0/8 will be announced to all neighbors.  Some vendors' routers don't advertise routes if they aren't present in their IGP routing tables; bgp doesn't care about IGP routes when announcing its routes.

 -- BGP Command: no network NETWORK

 -- BGP Command: aggregate-address NETWORK
     This command specifies an aggregate address.

 -- BGP Command: no aggregate-address NETWORK

Redistribute to BGP
===================

 -- BGP Command: redistribute kernel
     Redistribute kernel route to BGP process.

 -- BGP Command: redistribute static
     Redistribute static route to BGP process.

 -- BGP Command: redistribute connected
     Redistribute connected route to BGP process.

 -- BGP Command: redistribute rip
     Redistribute RIP route to BGP process.

 -- BGP Command: redistribute ospf
     Redistribute OSPF route to BGP process.

Peer configuration
==================

In a router bgp clause there are neighbor specific configurations required.

 -- BGP Command: neighbor PEER shutdown
 -- BGP Command: no neighbor PEER shutdown
     Shutdown the peer.  We can delete the neighbor's configuration by no neighbor PEER remote-as AS-NUMBER but all configuration of the neighbor will be deleted.  When you want to preserve the configuration, but want to drop the BGP peer, use this syntax.

 -- BGP Command: neighbor PEER ebgp-multihop
 -- BGP Command: no neighbor PEER ebgp-multihop

 -- BGP Command: neighbor PEER description ...
 -- BGP Command: no neighbor PEER description ...
     Set description of the peer.

 -- BGP Command: neighbor PEER version VERSION
     Set up the neighbor's BGP version.  VERSION can be 4, 4+ or 4-.  BGP version 4 is the default value used for BGP peering.  BGP version 4+ means that the neighbor supports Multiprotocol Extensions for BGP-4.  BGP version 4- is similar but the neighbor speaks the old Internet-Draft revision 00's Multiprotocol Extensions for BGP-4.  Some routing software is still using this version.

 -- BGP Command: neighbor PEER interface IFNAME
 -- BGP Command: no neighbor PEER interface IFNAME
     When you connect to a BGP peer over an IPv6 link-local address, you have to specify the IFNAME of the interface used for the connection.

 -- BGP Command: neighbor PEER next-hop-self
 -- BGP Command: no neighbor PEER next-hop-self
     This command specifies an announced route's nexthop as being equivalent to the address of the bgp router.

 -- BGP Command: neighbor PEER update-source
 -- BGP Command: no neighbor PEER update-source

 -- BGP Command: neighbor PEER default-originate
 -- BGP Command: no neighbor PEER default-originate
     bgpd's default is to not announce the default route (0.0.0.0/0) even it is in routing table.  When you want to announce default routes to the peer, use this command.

 -- BGP Command: neighbor PEER port PORT
 -- BGP Command: neighbor PEER port PORT

 -- BGP Command: neighbor PEER send-community
 -- BGP Command: neighbor PEER send-community

 -- BGP Command: neighbor PEER weight WEIGHT
 -- BGP Command: no neighbor PEER weight WEIGHT
     This command specifies a default WEIGHT value for the neighbor's routes.

 -- BGP Command: neighbor PEER maximum-prefix NUMBER
 -- BGP Command: no neighbor PEER maximum-prefix NUMBER

Peer filtering
==============

 -- BGP Command: neighbor PEER distribute-list NAME [in|out]
     This command specifies a distribute-list for the peer.  DIRECT is in or out.

 -- BGP command: neighbor PEER prefix-list NAME [in|out]

 -- BGP command: neighbor PEER filter-list NAME [in|out]

 -- BGP Command: neighbor PEER route-map NAME [in|out]
     Apply a route-map on the neighbor.  DIRECT must be in or out.

BGP terminal mode commands
==========================

 -- Command: show ip bgp [NETWORK]
     Lists all BGPd routes.

 -- Command: show ip bgp regexp AS-REGEXP

 -- Command: show ip bgp summary

 -- Command: show ip bgp neighbor [PEER]

 -- Command: clear ip bgp PEER
     Clear peers which have addresses of X.X.X.X

 -- Command: clear ip bgp PEER soft in
     Clear peer using soft reconfiguration.

 -- Command: show debug

 -- Command: debug event

 -- Command: debug update

 -- Command: debug keepalive

 -- Command: no debug event

 -- Command: no debug update

 -- Command: no debug keepalive

BGP Log Format
==============

BGPd outputs logging information to a terminal or to the specified file. It includes routing updates and peer status change information.  It also includes date, time, packet type, the peer's IP address, and other routing information.

     1999/03/29 17:42:18 Update:[202.216.226.1] 130.58.0.0/16 med: 0 lpref: 0 nexthop: 202.216.226.1 aspath: 4691 3561 5119 3576 3782 i

Multiprotocol Extension for BGP
===============================

When adding IPv6 routing information exchange feature to BGP.  There were some proposals.  IETF IDR working group finally take a proposal called Multiprotocol Extension for BGP.  The specification is described in RFC2283.  The protocol does not define new protocols.  It defines new attributes to existing BGP.  When it is used exchanging IPv6 routing information it is called BGP-4+.  When it is used for exchanging multicast routing information it is called MBGP.

bgpd supports Multiprotocol Extension for BGP.  So if remote peer supports the protocol, bgpd can exchange IPv6 and/or multicast routing information.

Traditional BGP does not have the feature to detect remote peer's capability whether it can handle other than IPv4 unicast routes.  This is a big problem using Multiprotocol Extension for BGP to operational network.  draft-ietf-idr-bgp4-cap-neg-04.txt is proposing a feature called Capability Negotiation.  bgpd use this Capability Negotiation to detect remote peer's capabilities.  If the peer is only configured as IPv4 unicast neighbor, bgpd does not send these Capability Negotiation packets.

By default, Zebra will bring up peering with minimal common capability for the both sides.  For example, local router has unicast and multicast capabilitie and remote router has unicast capability.  In this case, the local router will establish the connection with unicast only capability. When there are no common capabilities, Zebra sends Unsupported Capability error and then resets the connection.

If you want to completely match capabilities with remote peer.  Please use strict-capability-match command.

 -- BGP Command: neighbor PEER strict-capability-match
 -- BGP Command: no neighbor PEER strict-capability-match
     Strictly compares remote capabilities and local capabilities.  If capabilities are different, send Unsupported Capability error then reset connection.

You may want to disable sending Capability Negotiation OPEN message optional parameter to the peer when remote peer does not implement Capability Negotiation.  Please use dont-capability-negotiate command to disable the feature.

 -- BGP Command: neighbor PEER dont-capability-negotiate
 -- BGP Command: no neighbor PEER dont-capability-negotiate
     Suppress sending Capability Negotiation as OPEN message optional parameter to the peer.  This command only affects the peer is configured other than IPv4 unicast configuration.

When remote peer does not have capability negotiation feature, remote peer will not send any capabilities at all.  In that case, bgp configures the peer with configured capabilities.

You may prefer locally configured capabilities more than the negotiated capabilities even though remote peer sends capabilities.  If the peer is configured by override-capability, bgpd ignores received capabilities then override negotiated capabilities with configured values.

 -- BGP Command: neighbor PEER override-capability
 -- BGP Command: no neighbor PEER override-capability
     Override the result of Capability Negotiation with local configuration. Ignore remote peer's capability value.

Route Reflector
===============

 -- BGP Command: bgp cluster-id A.B.C.D

 -- BGP Command: neighbor PEER route-reflector-client
 -- BGP Command: no neighbor PEER route-reflector-client

Route Server
============

At an Internet Exchange point, many ISPs are connected to each other by external BGP peering.  Normally these external BGP connection are done by full mesh method.  As with internal BGP full mesh formation, this method has a scaling problem.

This scaling problem is well known.  Route Server is a method to resolve the problem.  Each ISP's BGP router only peers to Route Server.  Route Server serves as BGP information exchange to other BGP routers.  By applying this method, numbers of BGP connections is reduced from O(n*(n-1)/2) to O(n).

Unlike normal BGP router, Route Server must have several routing tables for managing different routing policies for each BGP speaker.  We call the routing tables as different views.  bgpd can work as normal BGP router or Route Server or both at the same time.

Multiple instance
-----------------

To enable multiple view function of bgpd, you must turn on multiple instance feature beforehand.

 -- Command: bgp multiple-instance
     Enable BGP multiple instance feature.  After this feature is enabled, you can make multiple BGP instances or multiple BGP views.

 -- Command: no bgp multiple-instance
     Disable BGP multiple instance feature.  You can not disable this feature when BGP multiple instances or views exist.

BGP instance and view
---------------------

BGP instance is a normal BGP process.  The result of route selection goes to the kernel routing table.  You can setup different AS at the same time when BGP multiple instance feature is enabled.

 -- Command: router bgp AS-NUMBER
     Make a new BGP instance.  You can use arbitrary word for the NAME.

     bgp multiple-instance
     !
     router bgp 1
      neighbor 10.0.0.1 remote-as 2
      neighbor 10.0.0.2 remote-as 3
     !
     router bgp 2
      neighbor 10.0.0.3 remote-as 4
      neighbor 10.0.0.4 remote-as 5

BGP view is almost same as normal BGP process. The result of route selection does not go to the kernel routing table.  BGP view is only for exchanging BGP routing information.

 -- Command: router bgp AS-NUMBER view NAME
     Make a new BGP view.  You can use arbitrary word for the NAME.  This view's route selection result does not go to the kernel routing table.

With this command, you can setup Route Server like below.

     bgp multiple-instance
     !
     router bgp 1 view 1
      neighbor 10.0.0.1 remote-as 2
      neighbor 10.0.0.2 remote-as 3
     !
     router bgp 2 view 2
      neighbor 10.0.0.3 remote-as 4
      neighbor 10.0.0.4 remote-as 5

Routing policy
--------------

You can set different routing policy for a peer.  For example, you can set different filter for a peer.

     bgp multiple-instance
     !
     router bgp 1 view 1
      neighbor 10.0.0.1 remote-as 2
      neighbor 10.0.0.1 distribute-list 1 in
     !
     router bgp 1 view 2
      neighbor 10.0.0.1 remote-as 2
      neighbor 10.0.0.1 distribute-list 2 in

This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view 2.  When the update is inserted into view 1, distribute-list 1 is applied.  On the other hand, when the update is inserted into view 2, distribute-list 2 is applied.

Viewing the view
----------------

To display routing table of BGP view, you must specify view name.

 -- Command: show ip bgp view NAME
     Display routing table of BGP view NAME.

How to set up a 6-Bone connection
=================================

     zebra configuration
     ===================
     !
     ! Actually there is no need to configure zebra
     !

     bgpd configuration
     ==================
     !
     ! This means that routes go through zebra and into the kernel.
     !
     router zebra
     !
     ! BGP-4+ configuration
     !
     router bgp 7675
      bgp router-id 10.0.0.1
     !
     ipv6 bgp network 3ffe:506::/32
     ipv6 bgp neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as AS-NUMBER
     ipv6 bgp neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out
     ipv6 bgp neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as AS-NUMBER
     ipv6 bgp neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out
     !
     ipv6 access-list all permit any
     !
     ! Set output nexthop address.
     !
     route-map set-nexthop permit 10
      match ipv6 address all
      set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225
      set ipv6 nexthop local fe80::2c0:4fff:fe68:a225
     !
     ! logfile FILENAME is obsolete.  Please use log file FILENAME
     !
     log file bgpd.log
     !

Dump BGP packets and table
==========================

 -- Command: dump bgp all PATH
 -- Command: dump bgp all PATH INTERVAL
     Dump all BGP packet and events to PATH file.

 -- Command: dump bgp updates PATH
 -- Command: dump bgp updates PATH INTERVAL
     Dump BGP updates to PATH file.

 -- Command: dump bgp routes PATH
 -- Command: dump bgp routes PATH
     Dump whole BGP routing table to PATH.  This is heavy process.