Looking glass implementations with Python

Internet Exchange Points (IXPs) are the backbones of the internet, as they offer easy connectivity between the Autonomous Systems (ASes) of the internet. The looking glass (lg) implementation is a commonly deployed software in the IXPs. They can be used to trace how an IXP can reach any given IP address on the internet. The lg implementations are made public such that anyone can use it to trace how to connect to a given IP address, thus offering an emulation environment to test the connectivity and performance of an IXP for the service providers before committing to use an IXP for their own connectivity needs.

BIX is an IXP based in Bulgaria. You may access the lg of Bulgarian Internet Exchange (BIX) at http://lg.bix.bg/. For example, see the output of the query from your browser: http://lg.bix.bg/?query=summary&addr=216.146.35.35&router=rs1.bix.bg+%28IPv6%29 for the IP (IPv6) BGP summary of 216.146.35.35 (http://dyn.com/labs/dyn-internet-guide/). The output of this query is shown in the following screenshot:

Looking Glass of BIX.bg

You may also run a traceroute from the lg (using the web service APIs of the browser) to observe how a given IP is connected through the IXP.

It will produce the following output in the browser window:

You may notice that the output is different from the same command run from your console, as it will produce the hops from your local network (while the one from the lg produced the output of traceroute as seen from the routers of BIX).

The lg can be implemented in Python, and py-lookingglass is such an implementation.

You may install py-lookingglass through pip:

$ sudo pip install py-lookingglass

Once installed, you may execute the following command to show the options:

$ python -m lg -h
usage: lg.py [-h] [-n NAME] [-c [COMMANDS [COMMANDS ...]]]
            [-H [HOSTS [HOSTS ...]]] [-b BIND] [-p PORT]
optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  Header name for pages
  -c [COMMANDS [COMMANDS ...]], --commands [COMMANDS [COMMANDS ...]]
Json array for profiles where key is profile name, use %ARG% for substition of IP/hostname argument. Key in command is display friendly version. 
Example: 
{
"cisco": {
"Ping": "ping %ARG%", 
"BGP Advertised _ARGUMENT_ to Neighbor": "sh ip bgp neighbor %ARG% advertised", 
"BGP Summary": "sh ip bgp summary", 
"Traceroute": "traceroute %ARG%"
}, 
"juniper": {
"Ping": "ping -c 4 %ARG%", 
"BGP Advertised _ARGUMENT_ to Neighbor": "cli -c "show route advertising-protocol bgp %ARG%"", 
"BGP Summary": "cli -c "sh bgp sum"", 
"Traceroute": "traceroute %ARG%"
}
}
-H [HOSTS [HOSTS ...]], --hosts [HOSTS [HOSTS ...]]
 Comma separated profile for router 'password','host_address',port_number,type_of_connection(1 for ssh and 0 for telnet),name,command_profile separated by space. 
Example 
                            "password1","192.168.0.1",23,0,"Cisco","cisco" "login:password2","192.168.1.1",22,0,"Juniper","juniper"
-b BIND, --bind BIND  IP to bind
-p PORT, --port PORT  port to bind
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.173.53