Mininet topology

Mininet provides a convenient way for building multi-device linear topologies with the
--topo linear option:

 $ sudo mn --topo linear,2 --mac --controller remote --switch ovsk
...
mininet> links
h1-eth0<->s1-eth1 (OK OK)
h2-eth0<->s2-eth1 (OK OK)
s2-eth2<->s1-eth2 (OK OK)

By default, the hosts were assigned the same IP addresses sequentially, similar to a single-switch topology:

 mininet> dump
<Host h1: h1-eth0:10.0.0.1 pid=29367>
<Host h2: h2-eth0:10.0.0.2 pid=29375>
<OVSSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None pid=29383>
<OVSSwitch s2: lo:127.0.0.1,s2-eth1:None,s2-eth2:None pid=29386>
<RemoteController c0: 127.0.0.1:6633 pid=29361>

We can easily change the IP addresses of the hosts according to our diagram:

 mininet> h1 ip addr del 10.0.0.1/8 dev h1-eth0
mininet> h1 ip addr add 192.168.1.10/24 dev h1-eth0
mininet> h2 ip addr del 10.0.0.2/8 dev h2-eth0
mininet> h2 ip addr add 192.168.2.10/24 dev h2-eth0
mininet> h1 ip route add default via 192.168.1.1
mininet> h2 ip route add default via 192.168.2.1

We can verify the configuration as follows:

 mininet> h1 ifconfig | grep inet
inet addr:192.168.1.10 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:1/64 Scope:Link
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
...
mininet> h2 ifconfig | grep inet
inet addr:192.168.2.10 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:2/64 Scope:Link
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
...
mininet> h1 route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 h1-eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 h1-eth0
...
mininet> h2 route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 h2-eth0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 h2-eth0
mininet>

Great! We've built the topology we needed in less than 5 minutes. Keep these steps handy, as we will start and restart Mininet a few times during our build. Let's take a look at the code that we will be using.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.134.17