-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Kevin Cyu edited this page Aug 30, 2020
·
2 revisions
Welcome to the virtual-router wiki!
- Build the program:
make
- 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/
namedcreate_topo.sh
, runsudo ./.scripts/create_topo.sh
to create topology we needed. - 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>
- 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.
* exit:
exit: Exit virtual router.
myRouter>
- 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)[0014] dmac: 42.30.9e.19.e2.84, smac: 4e.72.f9.93.4d.d6, ethertype: IP
(0)[0014] saddr: 10.0.0.1, daddr: 10.0.1.1. proto: ICMP
-----------------------------------------------
(1)[0007] dmac: 86.dc.73.a0.bf.52, smac: 36.78.79.d0.95.96, ethertype: IP
(1)[0007] saddr: 10.0.1.1, daddr: 10.0.0.1. proto: ICMP
-----------------------------------------------
(1)[0008] dmac: 86.dc.73.a0.bf.52, smac: 36.78.79.d0.95.96, ethertype: ARP
(1)[0008] arp request, who has 10.0.1.2 tell 10.0.1.1 (36.78.79.d0.95.96)
(1)[0008] Send ARP reply back to 10.0.1.1
(1)[0008] Send packet to port:1 (42 bytes)
-----------------------------------------------
(0)[0015] dmac: 42.30.9e.19.e2.84, smac: 4e.72.f9.93.4d.d6, ethertype: IP
(0)[0015] saddr: 10.0.0.1, daddr: 10.0.1.1. proto: ICMP
-----------------------------------------------
(1)[0009] dmac: 86.dc.73.a0.bf.52, smac: 36.78.79.d0.95.96, ethertype: IP
(1)[0009] saddr: 10.0.1.1, daddr: 10.0.0.1. proto: ICMP
^C
myRouter>