Mininet install and use



Ubuntu上安装Mininet详细:
1、更新软件
# apt-get update
# apt-get upgrade
2、从github上获取Mininet源码。
#git clone git://github.com/mininet/mininet
3、获取完以后,查看当前获取的Mininet版本
#cd mininet
#cat INSTALL
说明:在~/mininet目录下,我们可以通过git tag命令列出所有可用的Mininet版本,Mininet2.1.0p1及以后的版本可以原生支持OpenFlow1.3,所以我们这次安装的Mininet2.2.1版本支持OpenFlow1.3协议。
4、源码树获取成功以后,安装Mininet。
#mininet/util/install.sh[options]
这里典型的[options]主要有下面几种:
“-a”:完整安装包括Mininet VM,还包括如Open vSwitch的依赖关系,以及像的OpenFlow Wireshark分离器和POX。默认情况下,这些工具将被安装在你的home目录中。
“-nfv”:安装Mininet、基于OpenFlow的交换机和Open vSwitch。
“-s mydir” :在其他选项使用前使用此选项可将源代码建立在一个指定的目录中,而不是在你的home目录。
所以,你可能会用到下面的某一个命令来安装Mininet:
# install.sh –a ##完整安装(默认安装在home目录下)
# install.sh -s mydir –a ##完整安装(安装在其他目录) 
# install.sh –nfv ##安装Mininet+用户交换机+OVS(安装在home目录下)
# install.sh -s mydir –nfv ##安装Mininet+用户交换机+OVS(安装在其他目录下)
这里选择的安装命令是:
# mininet/util/install.sh –a
5、安装完成以后,通过简单的命令测试Mininet的基本功能。
#sudo mn --test pingall
(From:http://www.linuxdiyf.com/linux/24234.html)

    Mininet is a network emulation software that works with Open vSwitch to create a set of     OpenFlow switches connected to virtual hosts and interconnected in varying topologies.     The tutorial VM has mininet installed already and can be kicked off in a new terminal    

    with  the following command:

     ubuntu@sdnhubvm:~$ sudo mn --topo single,3 --mac --switch                   

     ovsk,protocols=OpenFlow13 --controller remote


You will now see a mininet CLI prompt after starting 3 hosts and 1 switch. The switch also attempts connect to a remote controller. Since we started OpenDaylight, you should also see several lines written to the karaf console once the switch connects to it.
You can begin a ping between two of the hosts. However, the ping will fail because there is no intelligence in the switch to learn the MAC addresses of each host and forward traffic to the correct switch ports.

    mininet> h1 ping h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable
...


Let us add that intelligence by installing the sdnhub-tutorial-learning-switch feature. You will notice that after doing this the ping will start succeeding.

opendaylight-user@root> feature:install sdnhub-tutorial-learning-switch


mininet> h1 ping h2
From 10.0.0.1 icmp_seq=1 Destination Host Unreachable
From 10.0.0.1 icmp_seq=2 Destination Host Unreachable

ping still fails because there is no default rule in the switch to send packet-in messages to the controller. Let's add that and verify the ping


mininet> s1 ovs-ofctl add-flow tcp:127.0.0.1:6634 -OOpenFlow13 priority=1,action=output:controller
mininet> h1 ping h2
64 bytes from 10.0.0.2: icmp_req=1 ttl=64 time=94.1 ms
64 bytes from 10.0.0.2: icmp_req=2 ttl=64 time=21.2 ms
64 bytes from 10.0.0.2: icmp_req=3 ttl=64 time=21.9 ms

You will have noticed that the pings are actually taking longer than they should for a switch (typically sub-1ms) for such a simple single-switch topology. This is because the controller is currently functioning in “Hub” mode and flooding every packet in the software.
In the next few sections, we will learn enough programming aspects to convert the hub into a switch and also build other functionality in the platform.

评论

此博客中的热门博文

openflow switch(I)

YANG Tools:YANG to Java Mapping

OpenDaylight架构简介