Skip to content
Kevin Cyu edited this page Jul 13, 2020 · 2 revisions

Welcome to the virtual-router wiki!

Run basic scenario

  1. Build the program: make
  2. If building process run successfully, then we can create the virtual network topology for this scenario. In current scenario, we provide a shell script under .scripts/ named create_topo.sh, run sudo ./.scripts/create_topo.sh to create topology we needed.
  3. Now we can execute our main program with specified interfaces; In current scenario, we create two interfaces: tap0, tap1 as two ports on our virtual router. We can run our program with those interfaces: ./router.exe -i tap0 tap1, then it will enter virtual router's CLI:
$ ./router.exe -i tap0 tap1
Number of ports: 2
 - tap0
Connect to 'tap0' successfully.
 - tap1
Connect to 'tap1' successfully.
Port(0) create successfully, tid = ... .
Port(1) create successfully, tid = ... .
===============================================
myRouter>
  1. Type help to check supported commands:
myRouter> help
List all support CLI command:
* debug: 
	debug packet : Enable all debug message from all ports.
	debug no : Disable all debug message from all ports.
* show: 
	show stats : Show all statistics collected by virtual router.
	show ports : Show all ports/interfaces information.
* help: 
	help : Print this help message.
myRouter>
  1. Type debug packet to see the traffic log (ping scenario, sudo ip netns exec h1 ping 10.0.1.1):
myRouter> debug packet
Enable all ports' debug mode
myRouter> =========================================================
(0) DMAC: b2.e7.7d.35.f9.fd , SMAC: 1e.14.ff.68.b7.40
(0) ethertype: ETH_IP
---------------------------------------------------------
(0) saddr: 10.0.0.1, daddr: 10.0.1.1. IPPROTO: ICMP
(0) Router send ARP request
(0) Send packet to port:1 (42 bytes)
=========================================================
(1) DMAC: 3e.45.e0.b5.dc.3a , SMAC: 1a.61.74.c9.98.1a
(1) ethertype: ETH_ARP
---------------------------------------------------------
(1) arp reply, 10.0.1.1 is-at 1a.61.74.c9.98.1a
(1) Resolved an ARP entry, idx = 0
...
Clone this wiki locally