Mininet (Rapid Prototyping for Software Defined Networks)-2-

In this tutorial,i will show you how to create different topology by using mininet.

when you type sudo mn -h in your terminal, you can see this information:

--topo=TOPO           linear|minimal|reversed|single|torus|tree[,param=value                        ...] linear=LinearTopo torus=TorusTopo tree=TreeTopo                        single=SingleSwitchTopo                        reversed=SingleSwitchReversedTopo minimal=MinimalTopo

1.Create a Single network topology(Only one Switch, number of hosts can define by yourself):
http://img2.58codes.com/2024/20126989EvsVpXGWAx.png

root@parallels-vm:~# mn --topo=single,3*** Creating network*** Adding controller*** Adding hosts:h1 h2 h3 *** Adding switches:s1 *** Adding links:(h1, s1) (h2, s1) (h3, s1) *** Configuring hostsh1 h2 h3 *** Starting controllerc0 *** Starting 1 switchess1 ...*** Starting CLI:mininet> neth1 h1-eth0:s1-eth1h2 h2-eth0:s1-eth2h3 h3-eth0:s1-eth3s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0 s1-eth3:h3-eth0c0

2.Create a linear network topology(Linear refers to a linear line, one switch with one host, and the number of hosts and switches can be specified at will. The topology is linear):
http://img2.58codes.com/2024/2012698946YL794dUS.png

root@parallels-vm:~# mn --topo=linear,3*** Creating network*** Adding controller*** Adding hosts:h1 h2 h3 *** Adding switches:s1 s2 s3 *** Adding links:(h1, s1) (h2, s2) (h3, s3) (s2, s1) (s3, s2) *** Configuring hostsh1 h2 h3 *** Starting controllerc0 *** Starting 3 switchess1 s2 s3 ...*** Starting CLI:mininet> neth1 h1-eth0:s1-eth1h2 h2-eth0:s2-eth1h3 h3-eth0:s3-eth1s1 lo:  s1-eth1:h1-eth0 s1-eth2:s2-eth2s2 lo:  s2-eth1:h2-eth0 s2-eth2:s1-eth2 s2-eth3:s3-eth2s3 lo:  s3-eth1:h3-eth0 s3-eth2:s2-eth3c0

3.Create a tree network topology:
http://img2.58codes.com/2024/20126989GObcPnrMFs.png

root@parallels-vm:~# mn --topo=tree,3*** Creating network*** Adding controller*** Adding hosts:h1 h2 h3 h4 h5 h6 h7 h8 *** Adding switches:s1 s2 s3 s4 s5 s6 s7 *** Adding links:(s1, s2) (s1, s5) (s2, s3) (s2, s4) (s3, h1) (s3, h2) (s4, h3) (s4, h4) (s5, s6) (s5, s7) (s6, h5) (s6, h6) (s7, h7) (s7, h8) *** Configuring hostsh1 h2 h3 h4 h5 h6 h7 h8 *** Starting controllerc0 *** Starting 7 switchess1 s2 s3 s4 s5 s6 s7 ...*** Starting CLI:mininet> neth1 h1-eth0:s3-eth1h2 h2-eth0:s3-eth2h3 h3-eth0:s4-eth1h4 h4-eth0:s4-eth2h5 h5-eth0:s6-eth1h6 h6-eth0:s6-eth2h7 h7-eth0:s7-eth1h8 h8-eth0:s7-eth2s1 lo:  s1-eth1:s2-eth3 s1-eth2:s5-eth3s2 lo:  s2-eth1:s3-eth3 s2-eth2:s4-eth3 s2-eth3:s1-eth1s3 lo:  s3-eth1:h1-eth0 s3-eth2:h2-eth0 s3-eth3:s2-eth1s4 lo:  s4-eth1:h3-eth0 s4-eth2:h4-eth0 s4-eth3:s2-eth2s5 lo:  s5-eth1:s6-eth3 s5-eth2:s7-eth3 s5-eth3:s1-eth2s6 lo:  s6-eth1:h5-eth0 s6-eth2:h6-eth0 s6-eth3:s5-eth1s7 lo:  s7-eth1:h7-eth0 s7-eth2:h8-eth0 s7-eth3:s5-eth2c0

4.create a minimal network topology:

root@parallels-vm:~# mn --topo=minimal*** Creating network*** Adding controller*** Adding hosts:h1 h2 *** Adding switches:s1 *** Adding links:(h1, s1) (h2, s1) *** Configuring hostsh1 h2 *** Starting controllerc0 *** Starting 1 switchess1 ...*** Starting CLI:mininet> neth1 h1-eth0:s1-eth1h2 h2-eth0:s1-eth2s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0c0

**When creating mininet, each device (host,switch, etc.) will be given by default. Assign a MAC address, but the MAC location will change with each assignment, making it difficult to adjust.

unadjusted:

mininet> h1 ifconfig | grep HWaddrh1-eth0   Link encap:Ethernet  HWaddr 8e:43:77:2e:47:c9 

Solution:
when you create a network topology, you can add --mac after the command which you typed.

mininet> h1 ifconfig | grep HWaddrh1-eth0   Link encap:Ethernet  HWaddr 00:00:00:00:00:01

关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章