Thursday, July 25, 2013

Python Routing Toolkit - Setup

A very interesting tool to capture, save and parse routing packets for BGPv4, IS-IS and OSPF protocols, I found to be PyRT. For the purpose of my GSoC project I will setup and run the toolkit for IS-IS protocol.

Prerequisites: Python 2.5 (so far, the code hasn't been updated to the latest version of Python).
So first of all I got the right version installed on the virtual machine:
  1. wget http://www.python.org/ftp/python/2.5/Python-2.5.tgz
  2. tar -xvf Python-2.5.tgz  (to extract the files)
  3. cd Python-2.5
  4. sudo ./configure
  5. make
  6. make install
  7. which python2.5 --> /usr/local/bin/python2.5 (to verify that it has been installed correctly in the environment path)
After this, get the pyrt code:
  1. git clone https://github.com/mor1/pyrt.git
  2. sudo python isis.py -d -a 49.00.01 -z $((1024*1024*5)) -f isis-dump -i 192.168.9.129
To run the code you need to set all the parameters as above, with the meaning:

python isis.py
Usage: isis.py [ options ] where options are ([*] required):
        -h|--help       : Help
        -v|--verbose    : Be verbose
        -q|--quiet      : Be quiet
       
        -a|--area-addr  : set the area address to which this IS belongs
        -i|--ip-addr    : *** HACK *** set the IP address to advertise
        -s|--src-id     : set the source ID of this IS
        -l|--lan-id     : set the LAN ID of this IS (def: "<srcid>:01")

        --device        : Set the device to receive on (def: eth0)

        -d|--dump       : Dump MRTd::PROTOCOL_ISIS format
        -y|--dump-isis2 : Dump MRTd::PROTOCOL_ISIS2 format
        -f|--file       : Set file prefix for MRTd dump (def: mrtd.mrtd)
        -z|--size       : Size of output file(s) (min: 51200)

And the output is:

L1LANHello (len=1500):
    src mac: 00.0c.29.47.e4.a1, dst mac: 01.80.c2.00.00.14
    len: 1500, LLC: 0xfe.fe.03
    hdr_len: 27, protocol id: 1, version: 1, eco: 0, user eco: 0
    circuit type: L1Circuit, holdtimer: 50, PDU len: 1497, priority: 64
    src id: 22.22.22.22.22.22, LAN id: 11.11.11.11.11.11.82
    field: AreaAddress, length: 4
        area addresses: 0x49.00.01,
    field: IIHIISNeighbor, length: 6
        IS Neighbour 1: 00.50.56.29.0b.88
    field: ProtoSupported, length: 1
        protocols supported: ['IP']
    field: IPIfAddr, length: 4
        interface IP addresses: ['192.168.9.129']

The packets are stored in a file called:
isis-dump.2013-07-25_08.47.39, which is a .mrtd format file and can be later used to manipulate the data.



1 comment:

  1. Thanks for this post. I was pondering over whether this can be used for creating a routing table from an external ISIS dump that I have from another network?

    ReplyDelete