• 在容器环境中容器内部部署ovs



    宿主机ubuntu18.04,编译安装ovs2.11.1,
    apt install python build-essiential
    configure--with-linux=/lib/modules/(uname -r)/build
    make
    sudo make install
    sudo make modules_install
    sudo lsmod |grep openvswitch
    export PATH=$PATH:/usr/local/share/openvswitch/scripts
    sudo ovs-ctl start

    docker pull ubuntu:18.04

    sudo docker create -it -v/etc/apt/sources.list:/etc/apt/sources.list --name vswitch -h vswitch --cap-add NET_ADMIN --cap-add SYS_NICE ubuntu:18.04 /bin/bash
    sudo docker start vswitch
    sudo docker exec -it vswitch /bin/bash

    进入容器-这里参考:https://aozsky.com/virtuallize/docker_openvswitch
    apt install -y iproute2 net-tools iputils-ping
    apt install -y build-essiential fakeroot
    apt install -y debhelper autoconf automake automake1.10 libssl-dev graphviz python-all python-qt4 python-zopeinterface python-twisted-conch libtool

    tar zxvf openvswitch-2.11.1.tar.gz

    DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary

    cd ../
    dpkg -i ./libopenvswitch_2.11.1-1_amd64.deb
    dpkg -i ./openvswitch-common_2.11.1-1_amd64.deb
    dpkg -i ./openvswitch-switch_2.11.1-1_amd64.deb
    dpkg -i ./python-openvswitch_2.11.1-1_all.deb
    dpkg -i openvswitch-vtep_2.11.1-1_amd64.deb
    出现如下错误:
    invoke-rc.d: could not determine current runlevel
    invoke-rc.d: policy-rc.d denied execution of start.

    cd ./openvswitch-2.11.1/utilities
    ./ovs-ctl start

    ovs-vsctl show

    保存为镜像
    sudo docker commit vswitch dablyo/ubuntu1804:ovs-2.11.1
    sudo docker save -o ubuntu1804-ovs2.11.1.img dablyo/ubuntu1804:ovs-2.11.1


    宿主机@ovs2.11.1
    sudo docker create -it --privileged=true --name cpe1 --net=none dablyo/ubuntu1804:ovs-2.11.1 /bin/bash

    sudo ovs-vsctl add-br br_inside
    sudo ovs-vsctl add-br br_outside
    sudo ovs-vsctl add-br br_wan1

    ~/openvswitch-2.11.1/utilities$ sudo ./ovs-docker add-port br_wan1 eth0 cpe1 --ipaddress=10.0.0.1/24
    ~/openvswitch-2.11.1/utilities$ sudo ./ovs-docker add-port br_outside eth1 cpe1 --ipaddress=172.1.0.2/24
    ~/openvswitch-2.11.1/utilities$ sudo ./ovs-docker add-port br_inside eth2 cpe1 --ipaddress=192.168.100.2/24


    =================以上2.11.1版本失败===以下2.9.2版本可行====================

    宿主机
    sudo apt install -y openvswitch-common openvswitch-switch
    sudo docker pull rastasheep/ubuntu-sshd:18.04
    sudo docker create -it -v/etc/apt/sources.list:/etc/apt/sources.list -v/etc/docker/daemon.json:/etc/docker/daemon.json --name vswitch -h vswitch
    --cap-add NET_ADMIN --cap-add SYS_NICE rastasheep/ubuntu-sshd:18.04

    容器内:
    cd openvswitch-2.9.2
    apt install -y iproute2 net-tools iputils-ping
    apt install -y build-essential fakeroot
    apt install -y debhelper autoconf automake automake1.10 libssl-dev graphviz python-all python-qt4 python-zopeinterface python-twisted-conch libtool
    DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
    dpkg -i .deb
    apt install -y uuid-runtime
    uuidd start
    cd openvswitch-2.9.2/utilities
    ./ovs-ctl start
    ovs-vsctl add-br br-wan1

    apt install m4 -y
    tar xvf gmp-6.1.2.tar
    cd gmp-6.1.2
    ./configure
    make
    make check
    make install

    tar xvf strongswan-5.8.0.tar
    ./configure
    make
    make install

  • 相关阅读:
    jenkins免密添加SSH Servers
    Workman启动失败的解决方法 stream_socket_server() has been disabled for security reasons
    jenkins主从从服务器发布脚本执行成功但总提示失败 FATAL: Remote call on XXXX failed
    mac OS配置用户全局环境变量(设置字符集为UTF8)
    使用 Application Loader提交IPA文件到苹果市场
    IOS使用批处理打包
    Java进阶知识24 Spring对JDBC的支持
    Java进阶知识23 Spring execution 切入点表达式
    Java进阶知识22 Spring的AOP编程
    Java进阶知识21 Spring的代理模式
  • 原文地址:https://www.cnblogs.com/dablyo/p/11617888.html
Copyright © 2020-2023  润新知