Mininet Host talking to the NCTUNS hosts

[Introduction]

       Based on Mininet host talking to Internet and NCTUNS Distributed Network Emulator, this technical report was written. With combination of Mininet and NCTUNS, the Mininet host can talk to NCTUNNS host.

 

[Step]

Mininet on VM1:

1.       Add an additional interface to the VM and set it to NAT.

 

 

2.           Bring up this additional interface, i.e. eth1 in my case.

 

3.          Prepare the following script (hostInternet.py)

#!/usr/bin/python

from mininet.net import Mininet

from mininet.node import Controller

from mininet.cli import CLI

from mininet.link import Intf

from mininet.log import setLogLevel, info

 

def myNetwork():

 

    net = Mininet( topo=None,

                   build=False)

 

    info( '*** Adding controller\n' )

    net.addController(name='c0')

 

    info( '*** Add switches\n')

    s1 = net.addSwitch('s1')

    Intf( 'eth1', node=s1 )

 

    info( '*** Add hosts\n')

    h1 = net.addHost('h1', ip='0.0.0.0')

 

    info( '*** Add links\n')

    net.addLink(h1, s1)

 

    info( '*** Starting network\n')

    net.start()

    #h1.cmdPrint('dhclient '+h1.defaultIntf().name)

    CLI(net)

    net.stop()

 

if __name__ == '__main__':

    setLogLevel( 'info' )

    myNetwork()

 

 

4.         Run the script.

 

5.       Open xterm for h1 and get a IP with dhclient command.

 

NCTUNS on VM2:

6.       We have to know the external IP address for eth1 interface. So I ping NCTUNS VM2 ip address from h1 and use wireshark to capture packets.

(on VM2)

 

(on VM1: ping 192.168.0.195)

 

(on VM2: external ip is 192.168.0.199)

 

7.       Create an emulation topology in NCTUNS.

 

 

 

Clock has to set as fast as the real-world clock.

 

 

8.       Do some settings on VM2.

 

9.       Set the route on VM1.

 

 

10.   Run the NCTUNS.

 

11.   On VM1: h1 ping 1.0.2.2 (host 4 on NCTUNS) It works. (Mininet host can talk to the host on NCTUNS)

 

Dr. Chih-Heng Ke

Department of Computer Science and Information Engineering, National Quemoy University, Kinmen, Taiwan

Email: smallko@gmail.com