RSS

Equal-Cost Multipath (ECMP) routing

A very quick example of ECMP

As promised, I added equal cost multipath routing to the Ouroboros unicast IPCP. I will add some more explanations later when it’s fully tested and merge into the master branch, but you can already try it. You will need to pull the be branch. You will also need to have fuse installed to monitor the flows from /tmp/ouroboros/. The following script will bootstrap a 4-node unicast network on your machine that routes using ECMP:

#!/bin/bash

# create a local IPCP. This emulates the "Internet"
irm i b t local n local l local

#create the first unicast IPCP with ecmp
irm i b t unicast n uni.a l net routing ecmp

#bind the unicast IPCP to the names net and uni.a
irm b i uni.a n net
irm b i uni.a n uni.a

#register these 2 names in the local IPCP
irm n r net l local
irm n r uni.a l local

#create 3 more unicast IPCPs, and enroll them with the first
irm i e t unicast n uni.b l net
irm b i uni.b n net
irm b i uni.b n uni.b
irm n r uni.b l local

irm i e t unicast n uni.c l net
irm b i uni.c n net
irm b i uni.c n uni.c
irm n r uni.c l local

irm i e t unicast n uni.d l net
irm b i uni.d n net
irm b i uni.d n uni.d
irm n r uni.d l local

#connect uni.b to uni.a this creates a DT flow and a mgmt flow
irm i conn name uni.b dst uni.a

#now do the same for the others, creating a square
irm i conn name uni.c dst uni.b
irm i conn name uni.d dst uni.c
irm i conn name uni.d dst uni.a

#register the oping application at 4 different locations
#this allows us to check the multipath implementation
irm n r oping.a i uni.a
irm n r oping.b i uni.b
irm n r oping.c i uni.c
irm n r oping.d i uni.d

#bind oping program to oping names
irm b prog oping n oping.a
irm b prog oping n oping.b
irm b prog oping n oping.c
irm b prog oping n oping.d

#good to go!

In order to test the setup, start an irmd (preferably in a terminal so you can see what’s going on). In another terminal, run the above script and then start an oping server:

$ ./ecmpscript
$ oping -l
Ouroboros ping server started.

This single server program will accept all flows for oping from any of the unicast IPCPs. Ouroboros multi-homing in action.

Open another terminal, and type the following command:

$ watch -n 1 'grep "sent (packets)" /tmp/ouroboros/uni.a/dt.*/6* | sed -n -e 1p -e 7p'

This will show you the packet statistics from the 2 data transfer flows from the first IPCP (uni.a).

On my machine it looks like this:

Every 1,0s: grep "sent (packets)" /tmp/ouroboros/uni.a/dt.*/6* | sed -n -e 1p -e 7p

/tmp/ouroboros/uni.a/dt.1896199821/65: sent (packets):                            10
/tmp/ouroboros/uni.a/dt.1896199821/67: sent (packets):                             6

Now, from yet another terminal, run connect an oping client to oping.c (the client should attach to the first IPCP, so oping.c should be the one with 2 equal cost paths) and watch both counters increase:

oping -n oping.c -i 100ms

When you do this to the other destinations (oping.b and oping.d) you should see only one of the flow counters increasing.

Hope you enjoyed this little demo!

Dimitri