Environment Build Step:

these packages are needed for building dpdk+ovs:

yum install -y make gcc glibc.i686 libgcc.i686 libstdc++.i686 glibc-devel.i686 glibc-devel.i686 libc6-dev-i386 glibc-devel.x86_64 libc6-dev clang autoconf automake libtool cmake python m4 openssl git libpcap-devel pciutils numactl-devel kernel-devel

First download latest dpdk & ovs :http://dpdk.org/download

git clone https://github.com/openvswitch/ovs

unzip these files.

then configure & compile dpdk. in config/common_linux add the following lines:

CONFIG_RTE_LIBRTE_PMD_PCAP=y
CONFIG_RTE_LIBRTE_PMD_RING=y

DPDK:

first need to know, if ovs-vsctl add-port, then the port is automatically binded to the NIC, by order.. so the name dpdk0 shouldn't be changed.. the dpdk[n]'s n is its order of the NICs..

also dpdkvhostuser[n], dpdkr[n].. and so on.

  1. before startup, computer must met: VT-d, (svm, vmx),  add following line to /etc/fstab (if wondering why 1GB rather than 2mb.. this pageexplains all)

    nodev /mnt/huge_1GB hugetlbfs pagesize=1GB  
  2. add startup-config: default_hugepagesz=1GB hugepagesz=1GB hugepages=5 (5GB RAM), modify /boot/grub2/grub.cfg and reboot
  3. make sure these pre-requirements are met: make, gcc, gcc-multilib( glibc.i686, libgcc.i686, libstdc++.i686 and glibc-devel.i686 / glibc-devel.i686 / libc6-dev-i386; glibc-devel.x86_64 / libc6-dev )
  4. ( it's quite possible that this problem is not solved, it's v16.04 and still need this patch. the patch no. is 945 ) patch usage: patch -p1 < *.patch ( for more, see man patch )
  5. using its ./tools/setup.sh to compile at a suitable version of dpdk.  (not suggested, this step is too simple.. is divided as follows:
    1. make install T=x86_64-native-linuxapp-gcc
    2. cd x86_64-native-linuxapp-gcc
    3. vi .config (note this step can modify the output of the libs to static libs. otherwise the .so files are needed  to set the paths. seems..
    4. make (if need to reset .config, just make clean && make will done)
    5. done.
  6. then to set environmental vars:
  7.  export RTE_SDK=/root/dpdk-16.04
    export RTE_TARGET=x86_64-....
  8. use ./tools/setup.sh again to insmod igb_uio kernel module. then create hugepages. then add the additional nic to igb_uio.
  9. *test with test programs
  10. ready to use

OVS installation:

  1. set the PATH for ovs:

    export DPDK_DIR=$HOME/dpdk-16.04
    export DPDK_TARGET=x86_64-native-linuxapp-gcc
    export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET
    export OVS_DIR=$HOME/ovs
    export VM_NAME=Centos-vm
    export GUEST_MEM=1024M
    export QCOW2_IMAGE=/root/CentOS7_x86_64.qcow2
    export VHOST_SOCK_DIR=/usr/local/var/run/openvswitch
    export DB_SOCK=/usr/local/var/run/openvswitch/db.sock
  2. yum install clang autoconf automake libtool
  3. ./boot.sh
  4. ./configure --with-dpdk=%DPDK_BUILD
  5. make install
  6. installation finished

OVS startup:

  1. *if started before..

    rm -f /usr/local/etc/openvswitch/conf.db /usr/local/var/run/openvswitch/db.sock
    ovs-appctl -t ovsdb-server exit
    ovs-appctl -t ovs-vswitchd exit
  2. source ./setup.sh content as follows: (start server, ovs and add port for qemu usage).  note sometimes there are 2 nodes of NUMA, so if dpdk ports are on the 2nd node, the socket mem should be set larger than 0, usually 1024.
    ovsdb-tool create /usr/local/etc/openvswitch/conf.db  \
    /usr/local/share/openvswitch/vswitch.ovsschema
    ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
    --remote=db:Open_vSwitch,Open_vSwitch,manager_options \
    --pidfile --detach
    ovs-vsctl --no-wait init
    ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
    ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-hugepage-dir=/mnt/huge_1GB
    ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem="1024,0"
    ovs-vswitchd unix:$DB_SOCK --pidfile --detach
    ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=
    ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
    ovs-vsctl add-bond br0 dpdkbond dpdk0 dpdk1 -- set Interface dpdk0 type=dpdk -- set Interface dpdk1 type=dpdk
    ovs-vsctl add-port br0 dpdkvhostuser0 -- set Interface dpdkvhostuser0 type=dpdkvhostuser
    ovs-vsctl add-port br0 dpdkvhostuser1 -- set Interface dpdkvhostuser1 type=dpdkvhostuser
  3. done

QEMU:

  1. before starting Qemu, need to create a virtual tap/tun device, and bind it with NIC: reference the steps

    yum install brctl " a bridge creating pkg
    ip link set eno16777736 down " a nic, which is connected to outer web
    brctl addbr br1 " create a bridge where the outer web and the inner nic running on, letting the inner system get on web
    brctl addif eno16777736
    ip link set dev br1 promisc on " promisc mode on, in this mode, tap/nic both working..
    ip link set dev eno16777736 promisc on
    dhclient br1 " to give ip addr to every un-allocated [v]nics.. and if something goes wrong, make sure dhclient is not already running in the background..
    ip link set dev br1 up
    ip link set dev eno16777736 up
    ip tuntap add mode tap tap0
    ip link set dev tap0 promisc on
  2. start qemu vm by:
    qemu-system-x86_64 -name $VM_NAME -cpu host -enable-kvm -m $GUEST_MEM -object memory-backend-file,id=mem,size=$GUEST_MEM,mem-path=/mnt/huge_1GB,share=on -numa node,memdev=mem -mem-prealloc -smp sockets=,cores= -drive file=$QCOW2_IMAGE -chardev socket,id=char0,path=$VHOST_SOCK_DIR/dpdkvhostuser0 -netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce -device virtio-net-pci,mac=:::::,netdev=mynet1,mrg_rxbuf=off -chardev socket,id=char1,path=$VHOST_SOCK_DIR/dpdkvhostuser1 -netdev type=vhost-user,id=mynet2,chardev=char1,vhostforce -device virtio-net-pci,mac=:::::,netdev=mynet2,mrg_rxbuf=off -net nic,macaddr=00:00:00:00:00:21 -net tap,ifname=tap0,script=no,downscript=no -nographic -snapshot
  3. to enable connection between dpdkvhostuser ports, first need to set bridge br0 up by: (必要はない
    ip link set dev br0 up
  4. set the ip inside the VMs, by:
    ip addr add dev eth0 192.168..xx[n]
    ip link set eth0 up
    ip route add default via 192.168.6.1 " this gw should be found by traceroute www.baidu.com in the outer machine.. the first jump router is the gw..
  5. done, now host & guest is ping-free.. but still not able to ssh(securecrt) into the inside vm.. fixed by modifying the ssh configure settings and restart sshd service..

note: viewing logs created by any ovs program, using journalctl..

journalctl -t ovs-vswitchd

done

Setting DPDK+OVS+QEMU on CentOS的更多相关文章

  1. [qemu][cloud][centos][ovs][sdn] centos7安装高版本的qemu 以及 virtio/vhost/vhost-user咋回事

    因为要搭建ovs-dpdk,所以需要vhost-user的qemu centos默认的qemu与qemu-kvm都不支持vhost-user,qemu最高版本是2.0.0, qemu-kvm最高版本是 ...

  2. [dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境)

    搭建实验环境: troubleshoot 第一步加载驱动 第二步切换驱动 使用了所有qemu支持的卡 [tong@T7:~/VM/dpdk] % cat start.sh sudo qemu-syst ...

  3. ovs加dpdk在日志中查看更多运行细节的方法

    想查看更多dpdk+ovs的更多运行细节,可以采用以下方法,增加更多运行日志. 在终端输入: ovs-appctl vlog/set dpdk:file:dbg ovs-appctl vlog/set ...

  4. [qemu] qemu从源码编译安装

    环境:CentOS7-1804 下载最新的源码: ┬─[tong@T7:~/Src/thirdparty/PACKAGES]─[:: AM] ╰─>$ axel https://download ...

  5. [dpdk] 读开发指南(2)(内容长期整理中)

    接续前节. 7 PMD (Poll Mode Driver) A Poll Mode Driver (PMD) consists of APIs, provided through the BSD d ...

  6. [qemu] 挂载qcow2文件,qcow2里边还有个lvm

    环境:archlinux 背景:在虚拟机里玩dpdk,把挂载HugePage(hugetlbfs)的命令写入fstab的时候,写错了,无法启动,需要把qcow2挂起来改一下. 方法:使用qemu-nb ...

  7. [redhat][centos] 让不同小版本的CentOS7使用相同的内核版本

    背景: CentOS7有定期的小版本发布,即官网释出的ISO,是带着小版本号的.CentOS7可以使用平滑升级,从这些小版本号中升上去. 但是并不是每一次的更新,都在释出的ISO中,这样的话,一台既有 ...

  8. 路由器逆向分析------QEMU的下载和安装(Linux平台)

    本文博客地址:http://blog.csdn.net/qq1084283172/article/details/68953160 一.QEMU源码的下载和编译 QEMU源码的github下载地址:h ...

  9. rust-vmm 学习

    V0.1.0 feature base knowledge: Architecture of the Kernel-based Virtual Machine (KVM) 用rust-vmm打造未来的 ...

随机推荐

  1. STL学习:STL库vector、string、set、map用法

    本文仅介绍了如何使用它们常用的方法. vector 1.可随机访问,可在尾部插入元素:2.内存自动管理:3.头文件#include <vector> 1.创建vector对象 一维: (1 ...

  2. javascript 中的console.log的作用

    主要是方便你调式javascript用的.你可以看到你在页面中输出的内容. 相比alert他的优点是: 他能看到结构话的东西,如果是alert,淡出一个对象就是[object object],但是co ...

  3. Arch声卡配置

    ALSA Utilities Install the alsa-utils package. This contains (among other utilities) the alsamixer a ...

  4. 【python问题系列--2】脚本运行出现语法错误:IndentationError: unindent does not match any outer indentation level

    缩进错误,此错误,最常见的原因是行之间没有对齐. 参考:http://www.crifan.com/python_syntax_error_indentationerror/comment-page- ...

  5. CVE-2014-1767 漏洞分析(2015.1)

    CVE-2014-1767 漏洞分析 1. 简介 该漏洞是由于Windows的afd.sys驱动在对系统内存的管理操作中,存在着悬垂指针的问题.在特定情况下攻击者可以通过该悬垂指针造成内存的doubl ...

  6. Deep Learning(深度学习)网络资源

    Deep Learning(深度学习) ufldl的2个教程(这个没得说,入门绝对的好教程,Ng的,逻辑清晰有练习):一 ufldl的2个教程(这个没得说,入门绝对的好教程,Ng的,逻辑清晰有练习): ...

  7. C# List 扩展排序

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Comm ...

  8. 移动端Click300毫秒点击延迟的来龙去脉(转)

    原文地址:What Exactly Is….. The 300ms Click Delay 快速响应是所有 UI 实现的重中之重.研究表明,当延迟超过 100 毫秒,用户就能感受到界面的卡顿. 然而, ...

  9. PureMVC 框架总结收录

    PureMVC框架的目标很明确,就是把程序分为低耦合的三层:Model.View和Controller. 通过使用PureMVC后,我们的代码将集中分为以下几个部分:Façade.Command.Me ...

  10. 我的C笔记

    最近更新: 1,父进程fork一个子进程,当向父进程发送一个SIGINT或其它信号时,子进程是否会接受到该信号? 2,父进程调用system执行一个程序时,向父进程发送一个信号时,system运行中的 ...