Created
September 4, 2017 10:00
-
-
Save shreyakupadhyay/b43f9c3829dbf4e2603244e891a536a5 to your computer and use it in GitHub Desktop.
Simple network topology using mininet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A custom topology consisting 6 hosts and 3 switches. Where main switch is connected to other two switches. | |
And 3-3 hosts connected to these 2 switches. Your system should have mininet installed. | |
''' | |
from mininet.topo import Topo | |
class MyTopo( Topo ): | |
def __init__( self ): | |
Topo.__init__(self) | |
# add hosts | |
h1 = self.addHost('h1') | |
h2 = self.addHost('h2') | |
h3 = self.addHost('h3') | |
h4 = self.addHost('h4') | |
h5 = self.addHost('h5') | |
h6 = self.addHost('h6') | |
# add switches | |
s1 = self.addSwitch('s1') | |
s2 = self.addSwitch('s2') | |
s3 = self.addSwitch('s3') | |
# add links | |
self.addLink(h1,s2) | |
self.addLink(h2,s2) | |
self.addLink(h3,s2) | |
self.addLink(h4,s3) | |
self.addLink(h5,s3) | |
self.addLink(h6,s3) | |
self.addLink(s2,s1) | |
self.addLink(s3,s1) | |
topos = { 'mytopo': ( lambda: MyTopo() ) } | |
# Use sudo mn --custom <simpleNetworkTopo.py> --topo mytopo | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment