[pox-dev] Mininet Script for Pox Router Example

William Emmanuel Yu wyu at ateneo.edu
Sun Sep 30 21:52:09 PDT 2012


Hi,

I am in the process of writing an exercise for creating a simple static
router in POX. I have created the following topology script in Mininet:

from mininet.net import Mininet
from mininet.node import Controller, OVSKernelSwitch, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.util import createLink

    # Create an empty network.
    net = Mininet(controller=RemoteController, switch=OVSKernelSwitch)
    net.addController('c0')

    # Creating nodes in the network.
    h0 = net.addHost('h0')
    s0 = net.addSwitch('s0')
    h1 = net.addHost('h1')
    s1 = net.addSwitch('s1')

    # Creating links between nodes in network.
    h0int, s0int = createLink(h0, s0)
    h1int, s1int = createLink(h1, s1)
    s0pint, s1pint = createLink(s0, s1)

    # Configuration of IP addresses in interfaces
    s0.setIP(s0int, '192.168.1.1', 26)
    h0.setIP(h0int, '192.168.1.2', 26)
    s1.setIP(s1int, '192.168.1.65', 26)
    h1.setIP(h1int, '192.168.1.66', 26)
    s0.setIP(s0pint, '192.168.1.129', 26)
    s1.setIP(s1pint, '192.168.1.130', 26)

    # start stuff and present CLI
    net.start()
    CLI(net)
    net.stop()

Complete script I used with debugging information can be found here:
https://github.com/hip2b2/poxstuff/blob/master/of_router_topo.py

I get the following output:

*** Creating network for Static Router Example
*** Network state:
s0: IP=192.168.1.129 intfs=s0-eth1,s0-eth2 pid=2534
s1: IP=192.168.1.130 intfs=s1-eth1,s1-eth2 pid=2536
h0: IP=192.168.1.2 intfs=h0-eth0 pid=2533
h1: IP=192.168.1.66 intfs=h1-eth0 pid=2535
*** Configuring hosts
h0 h1 
*** Starting controller
*** Starting 2 switches
s0 s1 
*** Starting CLI:

Here are the ifconfig output:

s0-eth1   Link encap:Ethernet  HWaddr 8e:70:01:30:64:4b  
          inet addr:192.168.1.1  Bcast:192.168.1.63
Mask:255.255.255.192
          inet6 addr: fe80::8c70:1ff:fe30:644b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:468 (468.0 B)  TX bytes:1146 (1.1 KB)

s0-eth2   Link encap:Ethernet  HWaddr 3e:e1:15:ce:7b:e2  
          inet addr:192.168.1.129  Bcast:192.168.1.191
Mask:255.255.255.192
          inet6 addr: fe80::3ce1:15ff:fece:7be2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:768 (768.0 B)  TX bytes:768 (768.0 B)

s1-eth1   Link encap:Ethernet  HWaddr 5a:74:03:22:2a:52  
          inet addr:192.168.1.65  Bcast:192.168.1.127
Mask:255.255.255.192
          inet6 addr: fe80::5874:3ff:fe22:2a52/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:468 (468.0 B)  TX bytes:978 (978.0 B)

s1-eth2   Link encap:Ethernet  HWaddr 36:dc:d8:a3:95:a0  
          inet addr:192.168.1.130  Bcast:192.168.1.191
Mask:255.255.255.192
          inet6 addr: fe80::34dc:d8ff:fea3:95a0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:768 (768.0 B)  TX bytes:768 (768.0 B)

h0-eth0   Link encap:Ethernet  HWaddr 52:bb:01:98:23:36  
          inet addr:192.168.1.2  Bcast:192.168.1.63
Mask:255.255.255.192
          inet6 addr: fe80::50bb:1ff:fe98:2336/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1146 (1.1 KB)  TX bytes:468 (468.0 B)

h1-eth0   Link encap:Ethernet  HWaddr d6:8c:bf:f2:fb:f6  
          inet addr:192.168.1.66  Bcast:192.168.1.127
Mask:255.255.255.192
          inet6 addr: fe80::d48c:bfff:fef2:fbf6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:978 (978.0 B)  TX bytes:468 (468.0 B)

I have two (2) hosts and two (2) switches/routers. I have given IP
addresses for each. There are three (3) networks here between s0 and h0,
s1 and h1, s0 and s1 (defined by the createLinks). 

The switch I am using is the IdealPair switch in
of_switch_tutorial_resend.py.

After running this script, I should NOT be able to ping h0 and h1 but I
can. I cannot however ping the s0 and s1 switches. 

Any help would be appreciated. Thank you.
-- 
-------------------------------------------------------
William Emmanuel S. Yu, Ph.D. (杨怀义)
Department of Information Systems and Computer Science
Ateneo de Manila University
email  :  wyu at ateneo dot edu
blog   :  http://hip2b2.yutivo.org/
web    :  http://CNG.ateneo.edu/cng/wyu/
phone  :  +63(2)4266001 loc. 4186
GPG    :  http://CNG.ateneo.net/cng/wyu/wyy.pgp

Confidentiality Issue:  This message is intended only for the use of the
addressee and may contain information that is privileged and
confidential. If you are not the intended recipient, you are hereby
notified that any use or dissemination of this communication is strictly
prohibited.  If you have received this communication in error, please
notify us immediately by reply and delete this message from your system.



More information about the pox-dev mailing list