29
|
1 These scripts can be used to graph the BGP peering connections in a network using the BGP protocol.
|
|
2
|
|
3 Some of the scripts will communicate with the BGP software, another script can be used to export the obtained information to a .dot file, which can then be converted to a graph file using graphviz. The scripts can run on different machines, and it is recommended to use routing information from multiple routes, to obtain an accurate view of the network.
|
|
4
|
|
5 Depending on the BGP software, one of the following scripts must be used to acquire the data:
|
|
6 - bgp_path_list_birg.sh (or .php) for the bird routing daemon
|
|
7 - bgp_path_list_quagga.sh (or .php) for the quagga/zebra routing daemon
|
|
8 - bgp_path_list_xml.php to convert existing dn42/diac42 .xml data
|
|
9
|
|
10 All these scripts will send their output to the stdout, so you either have to pipe them to another script, or redirect their output to a file (examples below).
|
|
11
|
|
12 Inside the scripts are a few configuration options. You should configure your local AS number (mynode/LOCALNODE variable) for proper operation. You may also change authentication parameters, for the quagga script.
|
|
13
|
|
14 To create the graph, you will need the path_list_to_dot.php script, this script expects the collected path data on STDIN, and will send the DOT-data to STDOUT (examples below). The DOT-data can be sent to one of the graphviz utilities (the dot command often performs best).
|
|
15
|
|
16 EXAMPLES
|
|
17
|
|
18 Graphing one single local bird instance
|
|
19 $ ./bgp_path_list_bird.sh | ./path_list_to_dot.php | dot -T png -o graph.png
|
|
20
|
|
21 Graphing one single quagga instance
|
|
22 $ ./bgp_path_list_quagga.sh | ./path_list_to_dot.php | dot -T png -o graph.png
|
|
23
|
|
24 Graphing data from one local bird instance and one quagga instance
|
|
25 $ ./bgp_path_list_bird.sh > /tmp/paths.txt
|
|
26 $ ./bgp_path_list_quagga.sh >> /tmp/paths.txt
|
|
27 $ ./path_list_to_dot.php < /tmp/paths.txt | dot -T png -o graph.png
|
|
28
|
|
29 You can combine data from as many routers as you like. More is better, because it will make the graph more accurate.
|
|
30
|
|
31 Or, in one single line:
|
|
32 $ (./bgp_path_list_bird.sh; ./bgp_path_list_quagga.sh) | ./path_list_to_dot.php < /tmp/paths.txt | dot -T png -o graph.png
|
|
33
|
|
34 Graphing a remote quagga instance using http:
|
|
35 $ wget http://remotehost/bgp_path_list_quagga.php -O - | ./path_list_to_dot.php < /tmp/paths.txt | dot -T png -o graph.png
|
|
36
|
|
37 Alternatively, you can use a cron job on the server to periodically update a static data file.
|
|
38
|
|
39 Graphing a remote instance using netcat:
|
|
40 server$ ./bgp_path_list_bird.sh | nc -l -p 9876
|
|
41 client$ nc remotehost 9876 | ./path_list_to_dot.php < /tmp/paths.txt | dot -T png -o graph.png
|
|
42
|
|
43 You can also use inetd/xinetd on the server side for a more permanent solution.
|
|
44
|
|
45
|
|
46 Be creative! |