Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode


Can a Host act as OVSwitches?

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

hghalwash gravatar image

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

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

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

runamuck gravatar image

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

image description


# Topology with router by John Sobanski

from mininet.topo import Topo
from 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='' )
    s3 = self.addSwitch( 's3' )

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

        ext = self.addHost( 'ext', ip='',
                           defaultRoute='via' )
        dmz = self.addHost( 'dmz', ip='',
                       defaultRoute='via' )

        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='' ) )
    info( '*** Routing Table on Router:\n' )
    print net[ 'fw' ].cmd( 'route' )
    CLI( net )

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


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 -0800 )edit
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 105 times

Last updated: Jan 20 '16