Mininet (lightweight software defined network and test platform) four

Source: Internet
Author: User

Mininet-4

In our last blog, we added a new H4 and opened the hub function
s0.cmd("brctl setageing br0 0")

#!/usr/bin/env pythonfrom mininet.cli Import clifrom mininet.net import mininetfrom mininet.link import Link,TCLinkif ' __ main__ ' = = __name__: Net = mininet (link=tclink) h1 = Net.addhost (' H1 ', ip= "192.168.10.1/24", mac= "00:00:00:00:00:01") H2 = Net.addhost (' H2 ', ip= "192.168.10.2/24", mac= "00:00:00:00:00:02") h3 = Net.addhost (' h3 ', ip= "192.168.20.1/24", mac= " 00:00:00:00:00:03 ") h4 = Net.addhost (' h4 ', ip=" 192.168.10.3/24 ", mac=" 00:00:00:00:00:04 ") R0 = Net.addhost (' r0 ') S0 = Net . Addhost (' S0 ') Net.addlink (H1, S0) Net.addlink (H2, S0) Net.addlink (S0, R0) Net.addlink (R0, H3) Net.addlink (S0, H4) Net.bu ILD () R0.cmd ("Echo 1 >/proc/sys/net/ipv4/ip_forward") r0.cmd (' ifconfig r0-eth0 192.168.10.254 netmask 255.255.255.0 ') r0.cmd (' ifconfig r0-eth1 192.168.20.254 netmask 255.255.255.0 ') h1.cmd ("IP route add default via 192.168.10.254 Dev h1- Eth0 ") h2.cmd (" IP rotue add default via 192.168.10.254 dev H2-eth0 ") h3.cmd (" IP route add default via 192.168.20.254 Dev H 3-eth0 ") h4.cmd (" IP route add defauLt via 192.168.10.254 Dev H4-eth0 ") s0.cmd (" Brctl addbr br0 ") s0.cmd (" Brctl addif br0 s0-eth0 ") s0.cmd (" Brctl addif br0 S0 -eth1 ") s0.cmd (" Brctl addif br0 s0-eth2 ") s0.cmd (" Brctl addif br0 s0-eth3 ") s0.cmd (" Brctl setageing br0 0 ") s0.cmd (" ifconf IG br0 up ") CLI (NET) net.stop ()


Mininet (lightweight software defined network and test platform) four

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.