Network Layer Routing Algorithms
Introduction
Routing GUI is an interactive application for exploring network layer routing algorithms. Source is available at Routing GUI.
Currently only supports Link State Routing, although a new type need only satisfy the following interface to be utilised by the application.
1
2
3
4
5
6
7
8
9
type Router interface {
RoutePacket(int) (int, error)
Broadcast() map[int]int
Recieve(int, map[int]int)
Info() []Path
AddRouter(int, int)
RemoveRouter(int)
Copy() Router
}
Routing
Link State routing works on local information shared globally to route packets. Routers periodically broadcast a list of neighbouring routers and the distance to each neighbour. Routers forward these broadcast messages to neighbours, in a flooding manner, to share this local information globally. Each router maintains a graph of the network, which is updated when these packets are received. When a packet is to be routed, the router utilised its current knowledge of the network and Dijkstra’s algorithm to route the packet.
The UI allows the user fine control over the routing process, deciding when to
- detect distance to neighbours,
- broadcast new neighbour packets,
- forward a packet to the next router.
Features
The initial network layout can be loaded from a text file. The following example shows a layout with two routers, named A
and B
, with IP addresses 10.0.0.1
and 10.0.0.2
respectively. We also have a connection of weight 2 between A
and B
.
# Routers
A, 10.0.0.1
B, 10.0.0.2
# Connections
A, B, 2
Comments begin with #
. Router declarations, of the form <name>, <ip_addr>
, can occur in any order with edge declarations, of the form <router_1>, <router_2>, <weight>
, so long as routers are declared before they are used in an edge declaration.