Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleInstall your favorite operating system

In our example we will use a genuine debian stable image (buster) installed as a VirtualBox VM.

and we add a bridge network interface to or laptop RJ45 conection.


Expand
titlePrepare VM guest build environmentInstall FreeRouter as per #001 article: "Create freeRouter environment"


Code Block
languagebash
themeMidnight
titleUpdate & Upgrade system
apt-get update
apt-get upgrade
Code Block
languagebash
themeMidnight
titleInstall build tools
apt-get install build-essential
Expand
titleCompile freeRouter binary net-tools
mkdir -p ~/freeRouter/bin ~/freeRouter/lib ~/freeRouter/etc ~/freeRouter/log
cd ~/freeRouter/lib
wget http://freerouter.nop.hu/rtr.jar


mkdir ~/freeRouter-build cd ~/freeRouter-build git clone https://github.com/mc36/freeRouter cd freeRouter/misc/native mkdir ../../binTmp/
Code Block
languagebash
themeMidnight
titleCreate build environment
Update & Upgrade system
╭─[11:11:54]floui@debian ~ 
╰─➤ tree freeRouter
freeRouter
├── bin   # binary files      
├── etc   # configuration files      
├── lib   # library files      
└── log   # log files      



Expand
titlePrepare VM guest build environment


Code Block
languagebash
themeMidnight
titlecompile binary tools
./c.sh
cd ../../binTmp/
mv *.bin ~/freeRouter/bin
Expand
titleCreate configuration files for router: freerouter
Update & Upgrade system
apt-get update
apt-get upgrade


FreeRouter uses 2 configuration files in order to run, let's write these configuration files for R1 in ~/freeRouter/etc

Code Block
languagebash
themeMidnight
titlefreeRouter hardware file: freerouter-hw.txt
int eth1 eth 0000.1111.0001 127.0.0.1 26011 127.0.0.1 26021
tcp2vrf 2323 v1 23
Install build tools
apt-get install build-essential



Expand
titleCompile freeRouter binary net-tools


Code Block
languagebash
themeMidnight
titleCreate build environment
mkdir ~/freeRouter-build
cd ~/freeRouter-build
git clone https://github.com/mc36/freeRouter
cd freeRouter/misc/native
mkdir ../../binTmp/


Code Block
languagebash
themeMidnight
titlecompile binary tools
./c.sh
cd ../../binTmp/
mv *.bin ~/freeRouter/bin



Expand
titleCreate configuration files for router: freerouter

FreeRouter uses 2 configuration files in order to run, let's write these configuration files for R1 in ~/freeRouter/etc

Code Block
languagebash
themeMidnight
titlefreeRouter hardware file: freerouter-hw.txt
int eth1 eth 0000.1111.0001 127.0.0.1 26011 127.0.0.1 26021
tcp2vrf 2323 v1 23


Code Block
languagebash
themeMidnight
titlefreeRouter software configuration file: r1-sw.txt
freerouter#sh run                                                              
hostname freerouter
buggy
!
!
prefix-list p4
 sequence 10 permit 0.0.0.0/0 ge 0 le 0
 exit
!
prefix-list p6
 sequence 10 permit ::/0 ge 0 le 0
 exit
!
vrf definition v1
 exit
!
interface ethernet1
 description freerouter@enp0s9
 vrf forwarding v1
 ipv4 address dynamic 255.255.255.0
 ipv4 gateway-prefix p4
 ipv4 dhcp-client enable
 ipv4 dhcp-client early
 ipv6 address dynamic ffff:ffff:ffff:ffff::
 ipv6 gateway-prefix p6
 ipv6 slaac
 no shutdown
 no log-link-change
 exit
!
!
!
!
!
!
!
!
!
!
!
!
!
!
server telnet tel
 security protocol telnet
 no exec authorization
 no login authentication
 vrf v1
 exit
!
!
end

freerouter# 



Expand
titleLaunch router: freerouter


Code Block
languagebash
themeMidnight
titleR2 launch with supplied r2-hw.txt and r2-sw.txt with a console prompt
╭─[6:06:13]floui@debian[3]  ~/freeRouter  
╰─➤  java -jar lib/rtr.jar routersc etc/freerouter-hw.txt etc/freerouter-sw.txt
Code Block
languagebash
themeMidnight
titlefreeRouter software configuration file: r1-sw.txt
freerouter#sh run                                                              
hostname freerouter
buggy
!
!
prefix-list p4
 sequence 10 permit 0.0.0.0/0 ge 0 le 0
 exit
!
prefix-list p6
 sequence 10 permit ::/0 ge 0 le 0
 exit
!
vrf definition v1
 exit
!
interface ethernet1
 description freerouter@enp0s9
 vrf forwarding v1
 ipv4 address dynamic 255.255.255.0
 ipv4 gateway-prefix p4
 ipv4 dhcp-client enable
 ipv4 dhcp-client early
 ipv6 address3 dynamic ffff:ffff:ffff:ffff::
 ipv6 gateway-prefix p6
 ipv6 slaac
 no shutdown
 no log-link-change
 exit
!
!
!
!
!
!
!
!
!
!
!
!
!
!
server telnet tel
 security protocol telnet
 no exec authorization
 no login authentication
 vrf v1
 exit
!
!
end

freerouter# 
Expand
titleLaunch router: freerouter
↵
info cfg.cfgInit.doInit:cfgInit.java:556 booting
info cfg.cfgInit.doInit:cfgInit.java:680 initializing hardware
info cfg.cfgInit.doInit:cfgInit.java:687 applying defaults
info cfg.cfgInit.doInit:cfgInit.java:695 applying configuration
info cfg.cfgInit.doInit:cfgInit.java:721 done
welcome
line ready
freerouter#                   


Code Block
languagebash
themeMidnight
titleR2 launch with supplied r2-hw.txt and r2-sw.txt with a console promptLaunch pcapInt in order to bind socket localhost:26011 to localhost26021@enp0s9
╭─[6:06:13]floui@debian[31]  ~/freeRouter/bin  
╰─➤  java -jar lib/rtr.jar routersc etc/freerouter-hw.txt etc/freerouter-sw.txtsudo ./pcapInt.bin enp0s9 26021 127.0.0.1 26011 127.0.0.1                                                                                        3 ↵
info cfg.cfgInit.doInit:cfgInit.java:556 booting
info cfg.cfgInit.doInit:cfgInit.java:680 initializing hardware
info cfg.cfgInit.doInit:cfgInit.java:687 applying defaults
info cfg.cfgInit.doInit:cfgInit.java:695 applying configuration
info cfg.cfgInit.doInit:cfgInit.java:721 done
welcome
line ready
freerouter#                     1 ↵
binded to local port 127.0.0.1 26021.
will send to 127.0.0.1 26011.
pcap version: libpcap version 1.8.1
opening interface enp0s9 with pcap1.x api
serving others
> 


Verification

Expand
titleCheck telnet access for freerouter@2323


Code Block
languagebash
themeMidnight
titleR1 telnet access from Virtualbox VM guest via port 1123
╭─[7:07:41]floui@debian[1]  ~/freeRouter/etc  
╰─➤  telnet localhost 2323                                                                                                                                           1 ↵
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
welcome
line ready
freerouter#


...