Ask Your Question
0

Can a Host act as OVSwitches?

asked 2016-01-11 19:58:47 -0700

hghalwash gravatar image

updated 2016-01-19 19:09:18 -0700

I am using Mininet and Opendaylight to test a network. I tested a scenario of two networks connected through a host with two interfaces. The Opendaylight seems to see these networks as disconnected networks.

I believe the problem is having the host in-between, that is not having any forwarding rules. Is it possible to configure such host to act as a switch in order to be considered in Opendaylight rule updates as a connecting element?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-20 05:55:58 -0700

runamuck gravatar image

See the Python script below to execute the following topology (with a host as a router).

image description

#!/usr/bin/python

# Topology with router by John Sobanski

from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import Node, RemoteController
from mininet.log import setLogLevel, info
from mininet.cli import CLI

class LinuxRouter( Node ):
    "A Node with IP forwarding enabled."

    def config( self, **params ):
        super( LinuxRouter, self).config( **params )
        # Enable forwarding on the router
        self.cmd( 'sysctl net.ipv4.ip_forward=1' )

    def terminate( self ):
        self.cmd( 'sysctl net.ipv4.ip_forward=0' )
        super( LinuxRouter, self ).terminate()


class NetworkTopo( Topo ):
    "The SDN DataCenter"

    def build( self, **_opts ):


        routefw = self.addNode( 'fw', cls=LinuxRouter, ip='10.0.1.1/24' )
    s3 = self.addSwitch( 's3' )

        self.addLink( s3, routefw, intfName2='fw-eth1',
                      params2={ 'ip' : '10.0.1.1/24' } )
        self.addLink( s3, routefw, intfName2='fw-eth2',
                      params2={ 'ip' : '10.0.2.1/24' } )

        ext = self.addHost( 'ext', ip='10.0.1.102/24',
                           defaultRoute='via 10.0.1.1' )
        dmz = self.addHost( 'dmz', ip='10.0.2.101/24',
                       defaultRoute='via 10.0.2.1' )

        for h, s in [ (ext, s3), (dmz, s3) ]:
            self.addLink( h, s )
def run():
    "Test linux router"
    topo = NetworkTopo()
    net = Mininet( topo, controller=RemoteController( 'c0', ip='127.0.0.1' ) )
    net.start()
    info( '*** Routing Table on Router:\n' )
    print net[ 'fw' ].cmd( 'route' )
    CLI( net )
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )
    run()
edit flag offensive delete publish link more

Comments

thanks a lot,your answer really help,I uderstand that we are enabling IP forwarding on the linux host. I'm confused wether this would help the controller considering hosts in toplogy I'm trying to reconfigure hosts to be able to use openflow protocols and construct rules similar to that in switches

hghalwash ( 2016-01-23 17:39:10 -0700 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
1 follower

Stats

Asked: 2016-01-11 19:58:47 -0700

Seen: 75 times

Last updated: Jan 20 '16