2006 November


 How to get local routing(BGP) info for South Africa

November 19, 2006

I recently went on a mission to discover, which subnets are “local” to South African networks, whether by ISP peering arrangements, or direct connection. I wanted this information, so that I could setup my home linux router to use Telkom’s ADSL connection for local traffic, and to use Sentech’s MyWireless connection for international traffic. Reason: Sentech pings aren’t really good for local gaming, but international speeds are great.

BGP (Border Gateway Protocol) 

All route information is published, and synchronized between ISP peers, via the BGP protocol, which is a dynamic routing protocol.

Unfortunately, it’s not as simple as install something like Zebra (a routing daemon for linux that does BGP, set it up on a Linux machine, receiving a BGP feend and have it make clever routing decisions.

No ISP will let you connect to their routers’ BGP port. Easily, or without a fight, or without paying them money for transit. This kind of public routing information, is unfortunately only available to the end-user via a series of public route-servers, and there aren’t any that I know that will allow you to receive the feed via BGP either.

So, I looked at alternative methods. I went from writing scripts to dig through the ripe, arin, and radb databases, to turning to lists of IP ranges arrange by geographic location. All the time, using whois queries to resolve the AS (AutonomousSystem) numbers, and then querying them for their official public routes. The problem is, that these routing databases aren’t always up to date, and that it’s quite difficult to figure out which AS numbers are actually local ISPs.

AS Numbers

An AS number is a  unique number, assigned by ARIN, or RIPE, that defines a BGP routing “area” or an ISP. Internet Solutions’ AS number is 3471. To see the details in the registry for an AS, go to http://www.radb.net/cgi-bin/radb/whois.cgi?obj=AS3741

To see the routes published by this AS, go to http://www.radb.net/cgi-bin/radb/whois.cgi?obj=!gAS3741

There is a set of RESERVED AS numbers, similar to “reserved” IP ranges that is supposed to be used for people that don’t have AS’s to obtain BGP information, or used for private or interior routing. Again, good luck in finding someone that’s prepared to configure a feed for you using a private AS, on a dynamic IP such as ADSL.

In the end, Gregory Massel, of http://www.ispmap.org.za/ fame, helped me to get hold of directly accessible BGP route information, courtesy of telnet://route-server.is.co.za, a public service by Internet Solutions. SAIX also runs a route-server at telnet://tpr-route-server.saix.net/
I wrote a small script that would telnet to this router, and dump the BGP routing table. This table contains local subnets, which is exactly what I was after.

From here on, it’s pretty simple to modify the script to add routes on my linux machine for these subnets on a specific interface. The net result in my scenario: ADSL gets used for local traffic, and Sentech for international.

Example script:


use Net::Telnet;

$prompt = '/public-route-server>/';

print "Connecting to $servern";
my $session = Net::Telnet->new(Host => $server,Prompt => $prompt,Timeout=>30);


#turn off paging
$session->cmd("terminal length 0");

#get list of local routes
print "Retrieving BGP routes\n";
my @output = $session->cmd("show ip bgp\n");
print @output;
print "Route list received\n";
Internet | 4 comments
4 responses to “How to get local routing(BGP) info for South Africa”
  1. rodch says:

    Thanks for this.

    BTW. Some of the \n nl chars in your perl script lost their \.(As seen by me in FFox)

    To reduce the size, I tried running the list through a couple of cidr subnet aggregators, which fail variously.

    I am cisco-illiterate, Any idea what a subnet like , (without mask bits) means? One aggregator tries another barfs with “line too long”

    A quick ping scan tells me there are live hosts within the space.

    • roelf says:

      Hi Rod. A subnet without a mask means that it’s a “standard” class prefix. E.g. you can assume /24 for the subnet, or /8 for a subnet. It’s a bit schizophrenic I must admit.

  2. xarion says:

    Awesome, I found that the server now reports a: “local-route-server” prompt so for whoever wants to use the script just needs to change $prompt = ‘/public-route-server>/’; to $prompt = ‘/local-route-server>/’; How do I spew out just the address not all the other columns?

  3. Jaco says:

    Mod on Script:
    1) Use Saix server
    2) Display only destination subnet
    3) Add standard prefix where required


    use Net::Telnet;



    $saix_cmd=”show ip bgp community 5713:56225\n”;

    print “Connecting to $server\n”;
    my $session = Net::Telnet->new(Host => $server,Prompt => $prompt,Timeout=>30);
    $session->login(“saix”, “saix”);

    #turn off paging
    $session->cmd(“terminal length 0”);

    #get list of local routes
    print “Retrieving BGP routes\n”;
    my @output = $session->cmd($saix_cmd);
    foreach (@output) {
    @fields = split(/\s+/);
    $fields[1] =~ s/^i//;
    @parts = split(/\./, $fields[1]);
    if ($parts[3] =~ /\//) {
    print $fields[1] . “\n”;
    } elsif ($parts[0] < 128) {
    print $fields[1] . "/8\n";
    } elsif ($parts[0] < 192) {
    print $fields[1] . "/16\n";
    } elsif ($parts[0] close;

Tags: , , ,


 Tribes:Vengeance Infinite Spawn Tool

o, I have to run a T:V server at a service provider that’ll only let me use FTP to administer my T:V server. This is a problem, because it becomes difficult to restart the server using FTP only 🙂

So I pulled out the good old Borland C++ compiler and started coding.

“Hah”, I said after a day or two to the service provider. “Please install this executable.”

TVSpawn is similar to the ISpawn of T1, and T2 except it’s a bit more clever. It will restart the Tribes server, and itsself (TVSpawn) if it detects a change in it’s “.ini” file. This means that you can restart a T:V server running remotely by simply uploading a new .ini file with a new date/timestamp.

TVSpawn will also apply the settings inside the new .ini file upon restart, allowing you to change the server’s startup commandline on-the-fly. That’s the neat part.

The mediocre part is that it basically does the normal stuff that T1/T2’s ISpawn did, which is monitoring the server on it’s query port (typically port 7778) to see if it’s still responding. If the polls to port 7778 fails a predetermined number of times (maxfailures in the .ini) it will assume that the server died and respawn it.

The program and and an example ini file is available  here: http://rodent.za.net/files/tribes/tvspawn/


  • Drop the .ini, and .exe into our tvprogrambin directory.
  • Edit the .ini and fix all the paths/settings to your liking.
  • Run it.

What it does:

  • Uses a .ini to read it’s configuration
  • Will restart the T:V server, and itsself if the configuration file changes (date,size, etc…)
  •  Polls the T:V server on it’s GaySpy port, to ensure it’s alive.
  • Restarts the T:V server if it stops responding to polls (maximum failures configurable in the .ini)
  • Restart the T:V server if it exits
  • Applies a “startup delay” (spawnwait in .ini) whenever the process is restarted to prevent insane respawning.
  • Has mostly all options configurable in the .ini file


  • tvspawn.exe will take a single commandline argument. The name of the .ini file. Thus, if you want to run multiple servers, with different configurations, run “tvspawn.exe myserver.ini” to have it use a different .ini file. By default (if no commandline arguments are specified) it will look for tvspawn.ini in the current directory.
  •  Set “hidelog=1” in the .ini file to have a “slim” version, minus the log window started up. You can always review the log by clicking on the “Show Log” button.

 To Do:

  • Make it a configurable, and installable service, with a service name for each .ini
  • Get an icon that isn’t a Llama.
  •  Include a small socket server that’ll accept remote commands, such as “reset”, “status”, and “booyah!”.

Mail me at rodent at rodent dot za dot net, if you have tips, suggestions etc…

Uncategorized | Leave a comment


 Tribes:Vengeance Scripting tips, and gotchas

Tribes:Vengeance is based on the Unreal Tournament Engine.

Here’s how it differs from normal UT scripting:

  •  When extending other base classes you have to specify the fully qualified name of the base class, e.g. instead of doing class Foo extends Object; you HAVE to do class Foo extends Core.Object; – this is naturally braindead but I guess IG may have had their reasons.
  •  C-Style comments are broken. Don’t use /* or */ to delimit comments, or blocks of code. It breaks if there are any other slashes inside. This  is pretty dumb.
  • When attempting to use structs defined inside other classes in your own derived classes, you may have to use the dependson() directive like so: class Foo extends Engine.Object dependson(~SomeClassWithStructsInIt);

Things you will need to do to make UCC work (For Beta/Demo)

Edit your UCC.ini, and ensure that you have the packages that you’re working on listed like in this following example:

~EditPackages=~Core ~EditPackages=~Engine ~EditPackages=~IGEffectsSystem ~EditPackages=~IGVisualEffectsSubsystem ~EditPackages=~IGSoundEffectsSubsystem ~EditPackages=~Editor ~EditPackages=~UWindow ~EditPackages=~GUI ~EditPackages=~UnrealEd ~EditPackages=~IpDrv ~EditPackages=~UWeb ~EditPackages=~UDebugMenu ~EditPackages=~MojoCore ~EditPackages=~MojoActions ~EditPackages=~PathFinding ~EditPackages=~Scripting ~EditPackages=~AICommon ~EditPackages=~Movement ~EditPackages=~Gameplay ;~EditPackages=~TribesGui ; these have to be commented out, crashes otherwise. ;~EditPackages=~Tyrion ; these have to be commented out, crashes otherwise. ~EditPackages=~Physics ~EditPackages=~TribesAdmin ~EditPackages=~TribesWebAdmin ~EditPackages=~TribesVoting ~EditPackages=~TribesTVClient ~EditPackages=~TribesTVServer ; my packages ~EditPackages=~FooPackage ; Add your packages at the bottom of the list, othwerise you’ll get undefined()s

  •  When compiling, you need to use “ucc make -NoBind” otherwise all the core packages will look for their associated headers/and dll’s to bind.
  • You will need to edit StartupUCC.ini and include the path to the script source code.
Game Development | Leave a comment
Tags: ,


 Tribes:Vengeance Master Server Polling

I wrote a bit of code, using Luigi’s code for GameSpy in PHP, that allows you to query the gamespy master server and retrieve the list of IP and port’s for any of the GameSpy supported games.

This handy image –> [http://vengeance.za.net/servers/serverpng.png]
for example, is generated using the code, and is updated dynamically every 3 minutes.

The query code isn’t really cleaned up enough or ready for release yet, but you can mail me  if you’re interested in obtaining a copy in the meantime.

Game Development | Leave a comment
Tags: ,


 Tribes:Vengance Server Lister

I wrote a small PHP script that uses QStat, and XML/XSL to display a Tribes:Vengeance servers’ server state. If you can’t make it work please don’t bug me for support. There is NO support for this thing and I don’t have the time to answer everyone’s queries, even though I’d like to.

It’s available here under a GPL license.

Uncategorized | Leave a comment