Route Collector

Barry O'Donovan edited this page May 19, 2017 · 12 revisions

DEPRECATED IN V4: please use the new framework for this - see here

Route collectors are an important member setup, diagnostic and metric tool for IXPs. IXP Manager will generate the relevant bits of a route collector configuration for you. In the example below, we use Quagga. A Bird target is also included in the code.

At INEX we use a Cisco IOS router with VRFs for our collector - please open a ticket if you'd like us to document that configuration also. We use Bird for the quarantine LAN collectors. This is included.

Configuration Options in application.ini

The following configuration options are optional for basic route collector configuration generation:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Route Collector Details
router.collector.conf.target = "quagga"
router.collector.conf.dstpath = APPLICATION_PATH "/../var/spool"

These can be passed when calling the API also.

The target option above is only used to specify the template directory to use in the generation of the configuration - specifically: application/views/router-cli/collector/{$target}/index.cfg. There is a full Quagga example available in the default templates at application/views/router-cli/collector/quagga/index.cfg and a Bird example at application/views/router-cli/collector/bird/index.cfg. NB: Note that the target can also be specified on the command line - see below.

For CLI invocation only: If dstpath is not set, the configuration will be generated to stdout. Otherwise, the configuration will be placed in the specified path in a file called rc-{$vlanid}.conf where $vlanid is the database ID of the VLAN for which we are generating the configuration.

Configuration Files

Key / value pairs can be defined in standard Smarty configuration files for use in your templates. Our sample templates expect certain parameters to be defined and you can see an example file here.

Writing / Altering Configuration Templates

Remember - use skinning to make changes to this or add your own. For example, if you set target above to bird and had you skin configured as myixpskin, then the configuration would be generated from application/views/_skins/myixpskin/router-cli/collector/bird/index.cfg.

Contribute back - if you write a config generator for another router, please open a pull request and contribute it back to the project.

The follow variables are available for each member's IPv4 / IPv6 VLAN interface in the $v[46]ints array:

 * `cid` - customer ID;
 * `cname` - full customer name;
 * `cshortname` - customer shortname;
 * `autsys` - customer AS number;
 * `peeringmacro` - customer's appropriate peering macro (if V6 interface then the V6 macro if defined, else the v4 macro. If no macro, it will be `AS65500` where 65500 is their AS number);
 * `vliid` - VLAN interface ID
 * `address` - IPv4/6 address
 * `bgpmd5secret` - their configured BGP MD5 secret (or false if not defined)
 * `maxprefixes` - the configured maximum prefix setting.

As mentioned above, there are complete examples provided in application/views/router-cli/collector/[quagga/bird] which should give you all the details you need.

Generating the Configuration via the CLI

Once you have set the application.ini settings, all you need is the database ID of the VLAN you wish to generate the configuration for. You'll get this by hovering over any of the actions in the VLAN section of IXP Manager and examining the URL.

Then, by executing the following, all active VLAN interfaces will have a BGP configuration generated for them via:

${APPLICATION_PATH}/bin/ixptool.php -a router-cli.gen-collector-conf -p vlanid=X --config=/full/path/to/config.conf

You can also pass additional options - do this using comma separated option=value pairs on the -p switch above - e.g. -p vlanid=X,proto=4.

The available additional options are:

  • proto=[4|6] - limit configuration to the given protocol. For example, Quagga can only listen on all interfaces or a single given interface. You may need to separate Quagga into specific protocols if you have a route collector for more than a single peering LAN.
  • target=qwerty - the target directory (in router-cli/collector/) from which to load theindex.cfg` template file.

Generating the Configuration via the API

You can generate a route collector configuration via the API by using a URL such as:

https://www.ixp.net/ixp/apiv1/router/collector-conf             
    /key/${KEY}/target/bird/vlanid/${vlanid}/proto/${proto} 
    /config/${configname}

the {$configname} variable refers to a configuration file in applications/config. The default configuration shipped with IXP Manager is called route-collector-example.conf. For production use, it is best to copy this file and edit/use the copy. For example if your IXP wants a route collector for ipv4 running on vlanid 1, create a new copy of this example file called rc-vlanid1-ipv4.conf, then edit the contents of that file to reflect your IXP. You can then pull a copy of the customised configuration using:

#!/bin/sh
KEY=MYSECRETIXPMANAGERAPIKEY
vlanid=1
proto=4

wget https://www.ixp.net/ixp/apiv1/router/collector-conf             
    /key/${KEY}/target/bird/vlanid/${vlanid}/proto/${proto} 
    /config/rc-vlanid${vlanid}-ipv${proto}

Sample Startup / Reconfigure Script

See the following Gist for how we in INEX spin up route collectors on our quarantine VLAN (which uses the public IP addressing): https://gist.github.com/barryo/7529951

Syncing the Configuration with the Router

Note that the provided Quagga example does not generate a complete router configuration - rather it just generates the necessary BGP clauses (and a few other bits). This is because, unfortunately, Quagga does not have a reload method for it's BGP daemon - updating a complete configuration would require a daemon restart which is unacceptable.

Instead, we start with a [base Quagga configuration](Route Collector - Sample Quagga Base Config) and then use RANCID to push the generated changes to it. For example, if /tmp/rc-X.conf is the generated configuration, we push that via:

/path/to/clogin -x /tmp/rc-X.conf rc.example.com 

Other BGP daemons such as OpenBGPd and Bird do have a reload function and, for these, your templates could easily contain a complete configuration.

Please note - due to the way these changes are pushed to Quagga / Cisco IOS, you will need to manually remove sessions for departed members until we develop a way of automating that.

Future Enhancements

The code is currently written assuming a dedicated Quagga / other router server per VLAN (and possibly protocol) and so, a run of router-cli.gen-collector-conf will only generate BGP sessions for a single VLAN. Future work should include allowing multiple VLANs to be generated at once (using the VRF paramater from the VLAN database).

Please feel free to poke me - @barryo - about these enhancements.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.