Hello freeRtr !¶
1 Overview¶
As freeRtr's author mentions: "freeRouter is a free, open source router OS process, it speaks routing protocols, and (re)encapsulates packets on interfaces. it receives and sends packets through udp sockets".
Basically freeRtr is a control plane software that natively relies on UNIX UDP socket. Concretely, you can spawn an unlimited amount of router processes on the same host, and interconnect them via UNIX UDP sockets in order to implement a topology and simulate an entire network.
This is freeRtr in its simplest form running in default mode.
Note
Please note that this installation is meant to demonstrate freeRtr UNIX socket forwarding capability. If you are considering switching high traffic rate such as 10G, it is advised to run freeRtr alongside a DPDK or P4 hardware dataplane.
2 Installation¶
2.1 Operating system¶
Any Operating System architecture (amd64, x86, arm etc.) supporting Java platform. In the example below we will use Debian "buster".
1 2 3 4 5 6 |
|
2.2 Software dependency¶
freeRtr has been tested and working starting from Java 8. Of course it is recommended to use the latest and greatest Java runtime.
1 |
|
2.4 Create freeRtr directory¶
For simplicity's sake we will use /rtr
folder.
1 |
|
2.3 Download freeRtr binary¶
The freeRtr homepage is at freertr.net
. Starting from this page, you'll find various resources such as source code (there is also a GitHub mirror), binaries, and other images that might be of your interest. From there we just download the freeRtr jar
files.
1 2 |
|
3 Configuration¶
freeRtr needs two files in order to run properly:
- A hardware definition file
- A software configuration file
3.1 Hardware configuration file¶
This file encompasses definition of the router:
- platform information
- interfaces definition
- external port translation to freeRtr port namespace
- external process launched and watched by freeRtr
- ...
Let's give it the name $hostname-hw.txt
(It can be of course any name)
- The router we will create is
r1
so the hardware file is:r1-hw.txt
- declare 2 interfaces for
r1
.
The format of interface declaration is:
1 |
|
r1-hw.txt
is declaring 2 interfaces (eth1
,eth2
) of type ethernet
1 2 |
|
eth1
is identified by socket127.0.0.1 1001
and remote end is127.0.0.1 2001
eth2
is identified by socket127.0.0.1 1001
and remote end is127.0.0.1 3002
3.2 Software configuration file¶
This is basically r1
freeRtr configuration similar to Cisco IOS startup-config
file.
In the example below:
- you notice
eth1
andeth2
that have been declared in the hardware file. - These interface have
lldp
and anipv4
andipv6
addresses configured. - In addition to that, we added a
lo0
that is of course not included inr1-hw.txt
file as it is a logical interface. - One peculiarity is that freeRtr enforces VRF usage. (in the example
vrf v1
) There is therefore no ambiguity related to the default VRF or VRF-aware features.
Let's give it the name $hostname-sw.txt
(It can be of course any name)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
3.3 Let's run our first freeRtr process !¶
Let's first try to launch freeRtr without any parameters:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
r1-hw.txt
and r1-sw.txt
and we also would like to have a CLI console access:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
ri
running-configuration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
!!!+ info
In the example above we spawned a freeRtr process with sudo
, the reason for using it here is that freeRtr base directory is in /rtr
and port below reserved port range. Other than that, freeRtr can be launched as a regular Unix user.
4 Conclusion¶
This section demonstrated:
- How to install and configure freeRtr on any OS able to run JVM
-
How to create a freeRtr router process that has:
- two interfaces (
eth1
andeth2
) eth1
is UDP sockets127.0.0.1 1001
, remote end is127.0.0.1 2001
eth2
is UDP sockets127.0.0.1 1002
, remote end is127.0.0.1 3002
- two interfaces (
-
How to start freeRtr
Note
Most of you have probaly noticed that r1
has both eth1
and eth2
interfaces connected to nowhere. And you are right ! We will see in the next "getting started" article how to implement a entire local topology by interconnecting through UDP sockets 4 freeRtr router processes.