User's Guide

Version 1.3 Alpha


MRT consists of a powerful collection of Unix programs and C-library routines that separate routing into its key component pieces of routing protocol, routing engine, and routing policy services. Here is a short list of some of the the functionality that MRT provides. You can use MRT tools to:

  • Capture a BGP peering session and monitor it in real time
  • Input a binary file to the routing stream to replicate a problem or create any desired routing condition
  • Use a real-time dump to perform statistical analyses, prototype a new protocol, or test a routing engine
  • Record and replay sequences of events, in order to reproduce scenarios such as routing failures
  • Collect routing statistics and analyze route flapping

  • Table of Contents

    1. MRT: A routing daemon supporting RIPNG, BGP4, multiple ribs (route server), and RIP1/2. Reads Cisco configuration files and supports a Cisco-like telnet interface.
    2. SBGP: A simple BGP4 speaker and listener
    3. Route_BtoA: Convert binary MRT messages to ASCII
    4. Route_AtoB: Convert ASCII descriptions of MRT messages to binary
    5. CiscoBGP: Check cisco routing tables against IRR
    6. Route_Flap: Perform route flap analysis and statistics collection
    7. PortMapper: Allow multiple process to listen on the same port. Run mutliple test instances of a protocol on one machine
    8. MSGServer: Library daemon that handles message queues
    9. BGPSimulate: Think you have a stable BGP protocol implentation? Confident your BGP can handle route flapping with ease? Use BGPSimulate to generate streams of BGP traffic and find out! BGPSimulate randomly generates BGP packets within specified parameters.


    [ MRT | Merit ]


    1. MRT

    MRT is a multi-threaded routing daemon with support for BGP4, RIP1/2, RIPNG and multiple ribs (i.e. route server). MRT reads Cisco configuration files and includes a Cisco-like interactive telnet interface.

    At the moment, only RIPNG and BGP route server are completely supported. RIP1/2 and BGP4 mostly work -- just a little matter of finishing up the code.

    Synopsis

    mrt [-v] [-n] [-f configuration file]

    Options

    -f configuration_file
    Read the specified configuration file. By default, MRT tries to read /etc/mrt.config and then ./mrt.config. (** ./config is also tried for backward compatibility)

    -v
    Turn on verbose logging to standard output. This is useful to turn on logging before the debug commands are read in the configuration file.

    -n
    Specify MRT does not modify the kernel routing table. This is used for testing MRT configurations with actual routing data.

    Description

    MRT first reads its configuration file (by default /etc/mrt.config) to configure routing protocols, route peerings and routing policy. The configuration file strongly resembles the files used by Cisco Systems. See the Cisco manual for a more detailed description of configuration commands.

    After reading the configuration file, MRT scans the kernel for existing routes, scans the kernel interface list, and then initiates routing protocol communication. MRT and also begins listening on the mrt service port (specificied in /etc/services) for user telnet connections.

    Sample Configuration File

    password	cairn
    !
    debug rip     all stdout
    debug ripng   all stdout
    debug bgp     all stdout
    !
    !access-list 1 permit 198 255.0.0.0
    !access-list 2 permit 192 255.0.0.0
    !access-list 3 permit 191 255.0.0.0
    !
    router bgp 185
    network 198.108.60.0
    network 192.168.10.0
    !neighbor 198.108.60.244 remote-as 65 view 0
    neighbor 192.168.10.1 remote-as 65 view 0
    !neighbor 198.108.60.244 transparent-as 
    !neighbor 198.108.60.61 remote-as 66 
    !neighbor 192.168.10.2 remote-as 21 view 1
    !neighbor 198.108.60.23 remote-as 12
    !neighbor 198.108.60.28 remote-as 82 view 1
    !neighbor 198.108.60.23 weight 50
    !neighbor 192.168.10.3 remote-as 1002
    !neighbor 192.168.10.2 distribute-list 1 in
    !neighbor 192.168.10.2 distribute-list 3 in view 1
    !neighbor 192.168.10.2 distribute-list 2 out
    !neighbor 198.108.60.244 view 1
    !neighbor 198.108.60.244 transparent
    redistribute static
    !
    router rip
    network 192.168.10.0
    network 198.108.60.0
    redistribute static
    !
    interface tunnel0
    tunnel source sit0
    tunnel destination 192.168.10.103
    tunnel destination fe80::c051:6042
    tunnel destination 5fff:ff00:c0a8:0a00::103
    !
    access-list 9 permit 5f00:ed00:c66c:3c00::/80
    access-list 9 permit 5fff:ff00:c0a8:0a00::/80
    access-list 9 permit 5fff:ff00:c0a8:0b00::/80
    access-list 9 permit 5fff:ff00:c0a8:0c00::/80
    !
    router ripng
    network 5f00:ed00:c66c:3c00::/80 !lnc0
    network 5fff:ff00:c0a8:0a00::/80
    network 5fff:ff00:c0a8:0b00::/80
    network 5fff:ff00:c0a8:0c00::/80 !ep0
    network tunnel0
    redistribute static
    distribute-list 9 in
    distribute-list 9 out
    !
    !ip route 83.0.0.0 192.168.10.100
    !ip route 84.0.0.0 192.168.10.100
    !ip route 17.0.0.1 192.168.10.100
    ip route 200.0.0.1 192.168.10.100
    !
    ip route 5f25:5400::/32 ::38.245.76.17 !isi
    ip route 5f00:6d00::/32 ::192.31.7.41 !cisco
    ip route 5f00::/8 ::192.31.7.41 !others
    !
    

    2. SBGP

    SBGP is a simple BGP4 speaker and listener. SBGP does not apply policy to routes, nor does it maintain a routing information base (RIB) of routes it has previously learned. Rather, SBGP provides a mechanism for monitoring routing information sent from a peer, and for injecting routing information into a peering session.

    Synopsis

    sbgp [-av] [-i binary_data_in_file] [-o binary_data_out_file] [-l log_file] [-f config_file] [-c port] [-d port] [my AS] [peer_IP peer_AS]...

    Options

    -a
    Accept peering BGP connection from all peers.

    -v
    Turn on verbose logging to standard output.

    -i binary_data_in_file
    Inject routes from this file into every peering session. Use the file name 'stdin' to read input from standard in.

    -o binary_data_out_file
    Save route updates from all peering sessions into this file. Use the file name 'stdout' to write output to standard out.

    -l log_file
    Write logging information to this file. By default, SBGP logs to /tmp/bgp.log.pid, where pid is the process ID number of the SBGP process.

    -f config_file
    Not supported yet
    -p
    Not supported yet

    -c port
    Connect to this port on all BGP peers.

    -d port
    Listen on this port for BGP peering connections.

    [my AS] [peer_IP peer_AS]...
    Use my AS for my Autonymous System number and open peering sessions with each peer_IP address.

    Description

    As arguments, SBGP takes the local AS number followed by the IP address and AS number of the BGP4 peer. Multiple peer IP addresses and AS pairs may be specified. For example:

        sbgp AS2011 enss131.t3.ans.net AS690
    attempts to initiate a BGP4 peering session with the old NSFNET backone on enss131. By default, SBGP writes logging information to /tmp/bgp.log.

    The following command directs tracing information to stdout (the -v option) and will save MRT messages containing the contents of BPG4 update packets to /tmp/data (the -o option).

        sbgp -vo data AS2011 enss131.t3.ans.net AS690
    Note that the remote peer must be configured to accept a BGP4 peering session from the machine on which SBGP is running.

    The following command will inject routes stored in the binary MRT message file data into the peering sessions with enss131:

        sbgp -vi data AS185 enss131.t3.and.net AS690


    3. ROUTE_BTOA

    ROUTE_BTOA converts binary MRT messages to ASCII. By default, the program writes human-readable ASCII descriptions of MRT message streams or files to standard out.

    Route_btoa includes a perl version of the program. In general, the perl version is probably the most robust and uptodate.

    Synopsis

    route_btoa [-m] [-i input_binary_file]

    Options

    -i binary_data_in_file
    Read routes from this file binary MRT file. Using a file name of 'stdin' will read input from standard in.

    -m
    Create machine-parseable output.

    Description

    The following command writes a formatted, ASCII description of BGP4 update packets from a peering session with the NSFNET backbone to standard output:
      sbgp -bo stdout | route_btoa -i stdin
    The above command produces the following
    output.


    4. ROUTE_ATOB

    Route_AtoB converts ASCII descriptions of MRT messages to binary. By default, the program writes binary MRT message streams or files to standard out.

    Route_atob includes a perl version of the program. In general, the perl version is probably the most robust and uptodate.

    Synopsis

    route_atob -i ASCII_input_file

    Options

    -i ascii_input_file
    Read ASCII descriptions of MRT messages from this file. Using a file name of 'stdin' will read input from standard in.

    Description

    The following command sequence will inject the routes described in in the input file into the BGP peersing session with enss131.

    route_atob -i /tmp/input | sbgp -i stdin enss131 AS690

    See the output of route_btoa for the grammer required by route_atob.


    4. CiscoBGP

    CiscoBGP obtains and analyzes routing information from production Ciscos, and compares the data with routes in the Routing Arbiter Database. The software also flags prefixes that are reserved by RFC1597.

    Three scripts are provided with CiscoBGP. Cisco_fetch takes the Cisco's IP address and password as input, automatically sets up a telnet session to the router, issues a 'show ip bgp' command, and dumps the BGP routing tables to a file on the local workstation. Usage is as follows:

      cisco_fetch hostname password > sample_output
    
    The cisco_check script then processes the 'show ip bgp' output and lists prefixes with AS origins different than those registered in the IRR. Usage is as follows:
      cisco_check sample_output [AS_Number]
    

    The optional [AS_Number] argument is the AS number that is used for local routes originating, or going from IGP to EGP on the Cisco.

    This command produces output in this format:

      0.0.0.0 [????] 6503 185 i
      12.0.0.0 [????] 6503 185 3561 701 i
      35.42.1.0/24 [237] 6503 185 i
      39.2.254.0 [????] 6503 185 3561 1133 1128 2043 766 i
      39.7.8.0 [????] 6503 185 3561 1800 i
      39.7.88.0 [????] 6503 185 3561 1800 1883 1880 i
      39.7.90.0 [????] 6503 185 3561 1800 1883 1880 1882 i
      39.11.6.0 [????] 6503 185 3561 1849 2822 i
    * 39.7.8.0/24 [1800] 6503 185 3561 1800 i
      39.13.135.0 [????] 6503 185 3561 1239 1795 3463 i
      39.13.229.0 [????] 6503 185 3561 701 3557 i
      128.35.0.0 [560] 6503 185 3561 560 701 6 i
      128.60.0.0 [86] 6503 185 3561 86 48 i
      128.91.0.0 [3576] 6503 185 3561 690 1324 1336 55 i
      128.122.0.0 [1785] 6503 185 3561 1239 1785 3973 12 i
      128.140.0.0 [279] 6503 185 3561 279 3591 i
      128.151.0.0 [1785] 6503 185 3561 1239 1785 20 i
    
    If the origin AS differs from the origin registered in the RADB, the correct origin is given in brackets. '?????' indicates that the route object for a given prefix is not registered in the IRR.

    A starred entry ('*') means that an exact match was NOT found for the prefix in the list of prefixes registered as originating in the given AS, but that the prefix falls under a less specific prefix that does originate in the AS.

    CiscoBGP also includes the aggstats script by Randy Bush <randy@psg.com>. Aggstats is a filter which accepts the output of the command 'show ip bg' on a Cisco and produces a small table showing for each prefix length the count of routes which explicitly declared that prefix length and the total count of routes of that prefix length. Usage is as follows:

      agg.pl < sample_output 
    

    5. RouteFlap

    RouteFlap performs route flap analysis and stastics collection on the machine parseable output generated by route_btoa.

    Synopsis

    routeflap ascii_input_file

    Description

    Steps to performing toute flap analysis:

    1. sbgp -vo /tmp/binary_data enss131.t3.ans.net AS690
    2. wait a for 24 hours, or whatever
    3. route_btoa -mi /tmp/binary_data > /tmp/data
    4. routeflap /tmp/data

    RouteFlap produces generates output of the form:

    192.135.172/24 
      reachability= [up 21:41:15, down 0:0:0]
      transitions= [up 0, down 0, change 0]
       (185 3561 286 1836) reachability= [up 21:41:15, down 0:0:0], transitions= 0
    192.136.109/24 
      reachability= [up 21:39:32, down 0:1:32]
      transitions= [up 0, down 2, change 0]
       (185 3561 1239 1792 2899) reachability= [up 9:51:38, down 0:0:0], transitions= 0
    202.37/16 
      reachability= [up 21:41:2, down 0:0:0]
      transitions= [up 0, down 0, change 0]
       (185 3561 297 681) reachability= [up 21:41:2, down 0:0:0], transitions= 0
    199.251.241/24 
      reachability= [up 0:0:30, down 20:46:56]
      transitions= [up 0, down 1, change 1]
       (185 3561 568) reachability= [up 20:46:56, down 0:0:0], transitions= 0
    204.142.34/24 
      reachability= [up 21:40:39, down 0:0:34]
      transitions= [up 0, down 1, change 0]
       (185 3561 97) reachability= [up 6:56:57, down 0:0:0], transitions= 0
    

    9. BGPSimulate

    BGPSimulate is simulates complex BGP4 routing environments with possibly high levels of routing instability/change.

    BGPSim includes a perl program, bgpsim.pl used to generate ASCII descriptions of BGP traffic for use with route_btoa, and sbgp. This is pretty much a rough hack.

    Synopsis

    bgpsim [-f configuration_file]

    Description

    By default, bgpsim looks for "./bgpsim.conf". The format of the configuration file is described below.BGPSim also has an interactive (cisco-like) interface. Telnet to port 5674 on the machine running bgpsim.

    Sample Configuration File

    !
    network-list 1 range 10.0.0.0 11.0.0.0
    network-list 1 nexthop 1 198.108.60.8
    network-list 1 aspath 1 123 23 23 12 
    !network-list 1 stability 10 1000
    !
    network-list 2 range 129.0.0.0 129.20.0.0
    network-list 2 nexthop 1 198.108.60.18
    network-list 2 aspath 1 56 78 34 89
    network-list 2 community 1 56:123 78:234 3670139
    network-list 2 dpa 1 as 56 121
    network-list 2 aspath 2 100 10 102 
    network-list 2 community 2 100:345 10:456
    network-list 2 dpa 2 3 23
    network-list 2 localpref 1 23
    network-list 2 localpref 2 83
    !network-list 2 stability 9
    network-list 2 change 12
    !
    router bgp 185
    neighbor 198.108.60.244 remote-as 65
    neighbor 198.108.60.244 announce 1 
    neighbor 198.108.60.112 remote-as 165
    neighbor 198.108.60.112 announce 1 2
    
    network-list 2 range 10.0.0.0 10.0.255.0
    network-list 2 aspath 1 
    network-list 2 stability 10 60
    !
    neighbor 198.108.60.244 remote-as 65
    neighbor 198.108.60.244 announce 1 
    !
    neighbor 198.108.60.112 remote-as 165
    neighbor 198.108.60.112 announce 1 
    neighbor 198.108.60.112 announce 2
    !
    
    This file describes a simulation of two BGP peers (AS 65 and AS165).

    The first peer (AS 65) announces routes using network list one. Network list 1 has a series of attributes of the form network-list

    The attribute-num value allows users to specify multiple attribute paths for a given network list. Initially, all the prefixes in a network-list are announced with path attributes attribute-num=1. If "change " field is specified, then path attrbutes will change to the next higher attribute-num every attribute-num seconds.

    This network list describes the range of routes from 192.32.0 to 192.32.255 (i.e. 192.32.1.0, 192.32.2.0, etc.) All of these routes have an inital aspath of (123 23 23 12) and a next-hop of 198.108.60.244. The stability-random means the routes flap between announce and withdraw every interval seconds. The change means the routing path attributes change every interval seconds.

    Note that network-lists cannot overlap.