In this example we use a router with a NAT. In particular we have:
- 2 switches
- a router connected to a NAT
configuration:
- ns1 (ip 10.0.1.1/24 dg 10.0.1.254)
- ns2 (ip 10.0.2.1/24 dg 10.0.2.254)
- ns3 (ip 10.10.1.1/24 dg 10.10.1.100)
topology
ns1 <--> Switch1
|
|
(10.0.1.254/24)
|
Router <--> Nat (10.10.1.100) <--> ns3
|
(10.0.2.254/24)
|
|
ns2 <--> Switch2
Execute the setup.sh script:
sudo ./setup.sh
Before deploying the router, it is necessary to launch the hover daemon. Please note to kill other instances of hover previously running.
export GOPATH=$HOME/go
sudo $GOPATH/bin/hoverd -listen 127.0.0.1:5002
The nat_router.yaml file contains the configuration script. To launch the example please execute:
export GOPATH=$HOME/go
cd $GOPATH/src/github.com/iovisor/iovisor-ovn/examples/switch
$GOPATH/bin/iovisorovnd -file nat_router.yaml -hover http://127.0.0.1:5002
In order to allow the arp tables to be correctly completed, please run arp.sh script:
sudo ./arp.sh
Now you are able to test the connectivity TCP and UDP using netcat (nc). Example:
# Launch netcat server in ns3
sudo ip netns exec ns3 nc -l 8000
# Launch netcat client in ns1
sudo ip netns exec ns1 nc 10.10.1.1 8000
# Launch netcat client in ns2
sudo ip netns exec ns2 nc 10.10.1.1 8000
In order to see the debug output generated by the IOModule we suggest to see the result of the print on the trace_pipe.
sudo su
cd /sys/kernel/debug/tracing/
cat trace_pipe