Use Quagga to generate BGP routes

From CT3

Jump to: navigation, search

By Ivan Pepelnjak

The BGP daemon included in the Quagga suite provides an easy-to-configure source of BGP routes that you can use in your lab. Quagga BGP daemon has the following advantages over extra routers:

  • It uses text configuration files that can be easily prepared and modified with external programs.
  • The IP prefixes configured with the network command are advertised to the neighbors regardless of their presence in the IP routing table (Cisco IOS requires a matching entry in the IP routing table that you have to insert with an extra static route or interface IP address).
  • Route-maps applied to the network command can set most BGP attributes, including AS path, extended communities and aggregator attributes.

The Quagga BGP daemon configuration is stored in the bgpd.conf configuration file in the Quagga configuration directory (/usr/local/quagga if you've followed the installation instructions in this wiki). The configuration file uses a format very similar to Cisco IOS configuration format. A sample configuration that originates IP prefix with a variety of BGP attributes is shown below:

hostname BGP_Seed
password test
router bgp 65000
 bgp router-id
 network route-map SetAttr
 neighbor remote-as 65001
route-map SetAttr permit 10
 set community 65000:1 additive
 set extcommunity rt 65000:1
 set aggregator as 65002
 set as-path prepend 1 2 3 4
 set atomic-aggregate
 set metric 20
 set originator-id
line vty
 no login
The password global configuration command specifies the VTY password (which is not needed in this scenario due to the no login line configuration command).
Quagga daemons are not tied to physical interfaces or IP routing table. They cannot pick their router ID from the interface IP addresses, so you have to specify the bgp router-id in the configuration.

Quagga BGP daemon appears as a regular BGP router to other routers. The following configuration can be used on a Cisco IOS router to establish BGP peering with it:

version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
hostname rtr
interface Loopback0
 ip address
interface FastEthernet0/0
 ip address
 duplex auto
 speed auto
router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network mask
 neighbor remote-as 65000
 no auto-summary

After the BGP session between the router and the Quagga BGP daemon has been established, you can inspect the IP prefix advertised to the router with the show ip bgp prefix command. As you can see, the IP prefix carries all the attributes you’ve configured in the route-map in the Quagga BGP daemon.

%BGP-5-ADJCHANGE: neighbor Up
rtr#show ip bgp
BGP routing table entry for, version 7
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  65000 1 2 3 4, (aggregated by 65002 from (
      Origin IGP, metric 20, localpref 100, valid, external, atomic-aggregate, best
      Community: 65000:1
      Extended Community: RT:65000:1 

Additional Resources  

Configuring BGP on Cisco Routers (BGP) course
Other links
Personal tools


Main menu