zoukankan      html  css  js  c++  java
  • (OK) running CORE—Common Open Research Emulator—docker

    -----------------------INSTALL quagga
    http://blog.chinaunix.net/uid-14735472-id-5595972.html

    core-manual.pdf

    [root@localhost quagga-0.99.24]# pwd
    /opt/tools/network_simulators/quagga-0.99.24

    [root@localhost quagga-0.99.24]#
    cp pimd/pimd.conf.sample  /usr/local/etc/quagga/pimd.conf
    cp isisd/isisd.conf.sample  /usr/local/etc/quagga/isisd.conf
    cp babeld/babeld.conf.sample  /usr/local/etc/quagga/babeld.conf
    cp ospf6d/ospf6d.conf.sample  /usr/local/etc/quagga/ospf6d.conf
    cp ospfd/ospfd.conf.sample  /usr/local/etc/quagga/ospfd.conf
    cp ripngd/ripngd.conf.sample  /usr/local/etc/quagga/ripngd.conf
    cp ripd/ripd.conf.sample  /usr/local/etc/quagga/ripd.conf
    cp bgpd/bgpd.conf.sample  /usr/local/etc/quagga/bgpd.conf
    cp zebra/zebra.conf.sample  /usr/local/etc/quagga/zebra.conf
    cp vtysh/vtysh.conf.sample  /usr/local/etc/quagga/vtysh.conf

    ln -s /usr/local/etc/quagga/pimd.conf /etc/quagga/pimd.conf
    ln -s /usr/local/etc/quagga/isisd.conf /etc/quagga/isisd.conf
    ln -s /usr/local/etc/quagga/babeld.conf /etc/quagga/babeld.conf
    ln -s /usr/local/etc/quagga/ospf6d.conf /etc/quagga/ospf6d.conf
    ln -s /usr/local/etc/quagga/ospfd.conf /etc/quagga/ospfd.conf
    ln -s /usr/local/etc/quagga/ripngd.conf /etc/quagga/ripngd.conf
    ln -s /usr/local/etc/quagga/ripd.conf /etc/quagga/ripd.conf
    ln -s /usr/local/etc/quagga/bgpd.conf /etc/quagga/bgpd.conf
    ln -s /usr/local/etc/quagga/zebra.conf /etc/quagga/zebra.conf
    ln -s /usr/local/etc/quagga/vtysh.conf /etc/quagga/vtysh.conf

    [root@localhost core-4.8]# cp /usr/local/etc/quagga/zebra.conf /usr/local/etc/quagga/Quagga.conf

    +++++++++++++++++++++++++ install docker etc.

    # Fedora 23

        # dnf install openvswitch docker-io xterm wireshark-gnome ImageMagick tcl tcllib tk kernel-modules-extra util-linux

        # echo 'DOCKER_STORAGE_OPTIONS="-s overlay"' >> /etc/sysconfig/docker-storage
        # systemctl restart docker

    ----------
    如果出现如下问题:
    # systemctl start docker
    Job for docker.service failed. See 'systemctl status docker.service' and 'journalctl -xn' for details.
    解决方法:
    # rm /var/lib/docker -rf
    # systemctl daemon-reload
    # systemctl start docker

    //下面两条命令不用
    # dnf remove docker
    # dnf install docker
    ----------

    ----------
        Arch:
        # cp /usr/lib/systemd/system/docker.service /etc/systemd/system/docker.service
        ### add overlay to ExecStart
        ExecStart=/usr/bin/docker daemon -s overlay -H fd://
        ### reload systemd files and restart docker.service
        # systemctl daemon-reload
        # systemctl restart docker

        Check status with docker info:
        # docker info | grep Storage
        Storage Driver: overlay
    ----------

    http://stackoverflow.com/questions/20994863/how-to-use-docker-or-linux-containers-for-network-emulation

    <span style="font-size:18px;">
        CORE Network Emulator does have a Docker Service that I contributed and wrote an article about. The initial version that is in 4.8 is mostly broken but I have fixed and improved it. A pull request is on GitHub.
    
        The service allows you to tag Docker Images with 'core' and then they appear as an option in the services settings. You must select the Docker image which starts the docker service in the container. You then select the container or containers that you want to run in that node. It scales quite well and I have had over 2000 nodes on my 16Gb machine.
    
        You mentioned OVS as well. This is not yet built in to CORE but can be used manually. I just answered a question on the CORE mailing list on this. It gives a brief overview of switching out a standard CORE switch(bridge) with OVS. Text reproduced below if it is useful:
    
    </span>

    +++++++++++++++++++++++++++++
    [root@localhost quagga]# ll
    总用量 6612
    -rw-r--r--.  1 root root 2471193 1月  13 21:57 quagga-0.99.21mr2.2.tar.gz
    -rw-r--r--.  1 root root 1680796 1月  12 15:36 quagga-0.99.24.tar.xz
    -rw-r--r--.  1 root root 2560375 1月  14 14:27 quagga-svnsnap.tgz  // 最新版
    [root@localhost quagga]#


    -------------------Fedora 23, Installing Quagga

    # tar xzf quagga-svnsnap.tgz
    # cd quagga
    [root@localhost quagga]# ./bootstrap.sh
    [root@localhost quagga]# ./configure --enable-user=root --enable-group=root --with-cflags=-ggdb --sysconfdir=/usr/local/etc/quagga --enable-vtysh --localstatedir=/var/run/quagga

    // copy basic.texi, ipv6.texi in quagga-0.99.24/doc   to   quagga-0.99.21mr2.2/doc
    [root@localhost quagga]# cp ../quagga-0.99.24/doc/basic.texi ../quagga-0.99.24/doc/ipv6.texi doc/

    [root@localhost quagga]# make -j4
    [root@localhost quagga]# make install
    [root@localhost quagga]# systemctl cat zebra.service

    [root@localhost quagga]# systemctl start zebra.service
    Job for zebra.service failed because a configured resource limit was exceeded. See "systemctl status zebra.service" and "journalctl -xe" for details.
    [root@localhost quagga]# mkdir /run/quagga/

    [root@localhost quagga]# systemctl start zebra.service
    [root@localhost quagga]# systemctl status zebra.service
    [root@localhost quagga]# systemctl stop zebra.service

    [root@localhost quagga]# vtysh
    [root@localhost quagga]# telnet localhost 2601

    +++++++++++++++++++++++++++++

    [root@localhost core]# systemctl start squid.service
    [root@localhost core]# systemctl status squid.service

    +++++++++++++++++++++++++++++

    # tar xzf core-network_4.8.orig.tar.gz
    # cd core-4.8

    -----------------------INSTALL CORE --- OK OK

    Fedora 23:

    dnf install bash bridge-utils ebtables iproute libev python procps-ng net-tools tcl tk tkimg autoconf automake make libev-devel python-devel ImageMagick help2man


    //重要,在CORE中,执行 /root/.core/configs/m-MPE-manet.imn,不能正常初始化。需要执行如下命令。

    //  http://blog.csdn.net/ztguang/article/details/51262543

    dnf install kernel-modules-extra-`uname -r`

    CentOS 7:
    yum install bash bridge-utils ebtables iproute libev python procps-ng net-tools tcl tk tkimg autoconf automake make libev-devel python-devel ImageMagick help2man


    You can obtain the CORE source from the CORE source page. Choose either a stable release version orthe development snapshot available in thenightly_snapshots directory.The -j8 argument tomake will run eight simultaneous jobs, to speed upbuilds on multi-core systems. Notice theconfigure flag to tell the buildsystem that a systemd service file should be installed under Fedora.

    [root@localhost core-4.8]# ./bootstrap.sh
    [root@localhost core-4.8]# ./configure --with-startup=systemd
    [root@localhost core-4.8]# make -j4
    [root@localhost core-4.8]# make install

    Note that the Linux RPM and Debian packages do not use the/usr/local prefix, and files are instead installed to /usr/sbin, and /usr/lib. This difference is a result of aligning with the directorystructure of Linux packaging systems and FreeBSD ports packaging.

    Another note is that the Python distutils in Fedora Linux will install the COREPython modules to/usr/lib/python2.7/site-packages/core, instead ofusing thedist-packages directory.

    The CORE Manual documentation is built separately from thedoc/ sub-directory in the source. It requires Sphinx:

    sudo yum install python-sphinx
    cd core-4.8/doc
    make html
    make latexpdf
    -----------------------INSTALL CORE --- OK OK



    -----------------------Test CORE

    To test that the CORE Network Emulator is working, start the CORE daemon and the GUI.

    [root@localhost core-4.8]# pwd
    /opt/tools/network_simulators/core/core-4.8

    [root@localhost core-4.8]# /etc/init.d/core-daemon start
    [root@localhost core-4.8]# core-gui

    [root@localhost core-4.8]# ls /tmp/pycore.56386/
    n1                    n1.xy                 n3.pid                n5.log                n7.conf/              n9
    n10                   n2                    n3.xy                 n5.pid                n7.log                n9.conf/
    n10.conf/             n2.conf/              n4                    n5.xy                 n7.pid                n9.log
    n10.log               n2.log                n4.conf/              n6                    n7.xy                 n9.pid
    n10.pid               n2.pid                n4.log                n6.conf/              n8                    n9.xy
    n10.xy                n2.xy                 n4.pid                n6.log                n8.conf/              nodes
    n1.conf/              n3                    n4.xy                 n6.pid                n8.log                servers
    n1.log                n3.conf/              n5                    n6.xy                 n8.pid                session-deployed.xml
    n1.pid                n3.log                n5.conf/              n7                    n8.xy                 state

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    关键点
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    core-svnsnap.tgz

    [root@localhost core]# pwd
    /opt/tools/network_simulators/core/core

    [root@localhost core]# gedit ./daemon/core/mobility.py
    -------------------------------------设置节点移动的时间间隔
        def runround(self):
            ''' Advance script time and move nodes.
            '''
            #ztg add
            time.sleep(6)
    -------------------------------------设置节点移动的间距
            #ztg add
            #wp = self.WayPoint(time, nodenum, coords=(x,y,z), speed=speed)
            wp = self.WayPoint(time, nodenum, coords=(x,y,z), speed=3)
    -------------------------------------
    [root@localhost core]# systemctl start squid.service
    [root@localhost core]# systemctl start docker

    [root@localhost core]# /etc/init.d/core-daemon stop
    [root@localhost core]# make uninstall ;  make clean
    [root@localhost core]# make -j4
    [root@localhost core]# make install
    [root@localhost core]# systemctl enable core-daemon
    Created symlink from /etc/systemd/system/multi-user.target.wants/core-daemon.service to /etc/systemd/system/core-daemon.service.

    problem:
    [root@n6 n6.conf]# docker info
    WARNING: bridge-nf-call-iptables is disabled
    WARNING: bridge-nf-call-ip6tables is disabled
    resolve:
    [root@localhost core]# iptables -F
    [root@localhost core]# ip6tables -F

    [root@localhost 桌面]# service core-daemon status
    Redirecting to /bin/systemctl status  core-daemon.service
    core-daemon.service - Common Open Research Emulator Service
       Loaded: loaded (/etc/systemd/system/core-daemon.service; disabled)
       Active: inactive (dead)

    [root@localhost 桌面]# cat /etc/systemd/system/core-daemon.service
    <span style="font-size:18px;">
        [Unit]
        Description=Common Open Research Emulator Service
        After=network.target
    
        [Service]
        Type=forking
        PIDFile=/var/run/core-daemon.pid
        ExecStart=/usr/bin/python /usr/local/sbin/core-daemon -d
    
        [Install]
        WantedBy=multi-user.target
    
    </span>

    Here maybe what is installed with 'make install':

    <span style="font-size:18px;">
        /usr/local/bin/core-gui
        /usr/local/sbin/core-daemon
        /usr/local/sbin/[vcmd, vnoded, coresendmsg, core-cleanup.sh]
        /usr/local/lib/core/*
        /usr/local/share/core/*
        /usr/local/lib/python2.6/dist-packages/core/*
        /usr/local/lib/python2.6/dist-packages/[netns,vcmd].so
        /etc/core/*
        /etc/init.d/core
    
    </span>

    [root@localhost core]# /usr/share/openvswitch/scripts/ovs-ctl --system-id=random start
    Starting ovsdb-server                                      [  OK  ]
    Configuring Open vSwitch system IDs                        [  OK  ]
    Starting ovs-vswitchd                                      [  OK  ]
    Enabling remote OVSDB managers                             [  OK  ]


    //Fedora 23 & CentOS 7

    [root@localhost core]# systemctl daemon-reload
    [root@localhost core]# systemctl start core-daemon.service
    [root@localhost core]# core-gui



    ----------------
    NOTE: first to run the following command if using docker.
    # systemctl start docker.service
    ----------------

    NOTE: /root/.core/configs/m-MPE-manet.imn


    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ----------------
    error:
    ----------------
      File "/usr/lib/python2.7/site-packages/docker/client.py", line 142, in _raise_for_status
        raise errors.APIError(e, response, explanation=explanation)
    APIError: 400 Client Error: Bad Request ("client version 1.10 is too old. Minimum supported API version is 1.21, please upgrade your client to a newer version")
    ----------------

    solution:
    ----------------
    # gedit /opt/tools/network_simulators/core/core/daemon/core/services/dockersvc.py
    ----------------
    if 'Client' in globals():
        client = Client(version='1.21')
    ----------------
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    docker.sh

    #!/bin/sh
    # auto-generated by Docker (docker.py)
    echo "nameserver 8.8.8.8" > /run/resolvconf/resolv.conf
    service docker start
    # you could add a command to start a image here eg:
    # docker run -d --net host --name coreDock

    [root@localhost 桌面]# ls /var/lib/docker/containers/
    [root@localhost 桌面]# ls /run/shm
    [root@localhost 桌面]# ls /run/resolvconf

    ---------------------------
    [root@n6 n6.conf]# ls /run/shm
    [root@n6 n6.conf]# cat /run/resolvconf/resolv.conf
    nameserver 8.8.8.8
    [root@n6 n6.conf]# ls /var/lib/docker/containers/
    [root@n6 n6.conf]#


    +++++++++++++++++++++++++++++
    http://www.segurancaremota.com.br/2014/01/simular-roteamentos-no-linux-com-core.html

    If you are looking for an environment light, practical and efficient to simulate networks, this environment is the core.

    Best of all is that if all goes well, it 's just save the configuration files (default quagga) and up to its routers.

    With this system, you can train your skills with networks in an environment totally safe.

    So we go to the "hands - on" and install the system. I made a "compiled" after reading the documentation in the official site -http://www.nrl.navy.mil/itd/ncs/products/core

    The instructions will follow shortly after the video, but remember, I did this article in a Linux Kali (Debian), so if you'll do in other distribution there may be some variation. In the Fedora also worked perfectly.

    -------------------Downloads:

    Core - http://downloads.pf.itd.nrl.navy.mil/core/source/core-4.6.tar.gz  

    Quagga - http://downloads.sourceforge.net/project/quagga/quagga-0.99.20.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fquagga%2F&ts=1390603600&use_mirror=ufpr

    Installing pre requirements # apt-get install bash bridge-utils ebtables iproute  libev-dev python tcl8.5 tk8.5 libtk-img autoconf  automake gcc libev-dev make python-dev  libreadline-dev pkg-config imagemagick help2man node gawk quagga  

    -------------------Install CORE
    # tar xzf core-4.6.tar.gz
    # cd core-4.6
    # ./bootstrap.sh
    # ./configure
    # make -j8
    # make install

    -------------------Installing Quagga
    # yum group install 'Development Tools'        [on CentOS/RHEL 7/6]
    # dnf group install 'Development Tools'        [on Fedora 22+ Versions]

    /opt/tools/network_simulators/quagga/quagga-svnsnap.tgz
    -rw-r--r--. 1 root root 2560375 1月  14 14:27 ../quagga-svnsnap.tgz

    # tar xzf quagga-0.99.21mr2.2.tar.gz
    # cd quagga-0.99.21mr2.2


    configure.ac:217: error: possibly undefined macro: AC_PROG_LIBTOOL
    [root@localhost quagga]# dnf install libtool
    [root@localhost quagga]# dnf install autoconf-archive

    //automake: You are advised to start using 'subdir-objects' option throughout your
    [root@localhost quagga]# gedit configure.ac
    dnl AM_INIT_AUTOMAKE(1.6)
    AM_INIT_AUTOMAKE([subdir-objects])

    [root@localhost quagga]# ./bootstrap.sh

    [root@localhost quagga]# dnf install gcc-c++

    [root@localhost quagga]# ./configure --enable-user=root --enable-group=root --with-cflags=-ggdb --sysconfdir=/usr/local/etc/quagga --enable-vtysh --localstatedir=/var/run/quagga

    //下面一行暂不需要
    // copy basic.texi, ipv6.texi in quagga-0.99.24/doc   to   quagga-0.99.21mr2.2/doc

    // makeinfo: command not found
    [root@localhost quagga]# dnf install texinfo


    # make -j4
    # make install

    -------------------Testing the environment
    # core-gui


  • 相关阅读:
    深入理解PHP原理之变量作用域
    深入理解PHP原理之变量分离/引用
    关于哈希表
    foreach 相关
    Scrapyd-Client的安装
    Scrapyd API的安装
    scrapyd的安装
    快手的小视频爬取
    实现单例模式的几种方式
    京东图书分布式爬虫
  • 原文地址:https://www.cnblogs.com/ztguang/p/12646998.html
Copyright © 2011-2022 走看看