# 安装依赖
yum install popt-devel automake gcc -y
yum install -y python3-pip
yum install numactl-devel -y
yum install openssl-devel -y
# 安装python 3.7.0和meson以及ninja
tar -xvf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure --prefix=/usr/local/python3
./configure --enable-optimizations
make && make install
rm -f /usr/bin/python3
ln -s /usr/local/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
python3 -m pip install meson
python3 -m pip install ninja
# 下载dpvs和dpdk
git clone https://github.com/iqiyi/dpvs.git
cd dpvs
wget https://fast.dpdk.org/rel/dpdk-20.11.1.tar.xz
tar xf dpdk-20.11.1.tar.xz
# 打patch
cp patch/dpdk-stable-20.11.1/*.patch dpdk-stable-20.11.1/
cd dpdk-stable-20.11.1/
patch -p1 < 0001-kni-use-netlink-event-for-multicast-driver-part.patch
patch -p1 < 0002-pdump-change-dpdk-pdump-tool-for-dpvs.patch
patch -p1 < 0003-debug-enable-dpdk-eal-memory-debug.patch
patch -p1 < 0004-ixgbe_flow-patch-ixgbe-fdir-rte_flow-for-dpvs.patch
patch -p1 < 0005-bonding-allow-slaves-from-different-numa-nodes.patch
patch -p1 < 0006-bonding-fix-bonding-mode-4-problems.patch
# 安装dpdk依赖和加载kni模块
mkdir dpdklib
mkdir dpdkbuild
meson -Denable_kmods=true -Dprefix=/root/dpvs/dpdk-stable-20.11.1/dpdklib dpdkbuild
ninja -C dpdkbuild
cd dpdkbuild; ninja install
export PKG_CONFIG_PATH=$(pwd)/../dpdklib/lib64/pkgconfig/
insmod ~/dpdk-stable-20.11.1/dpdkbuild/kernel/linux/kni/rte_kni.ko carrier=on
# 配置大页
echo 2048 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
cat /proc/meminfo | grep Huge
# 升级pkg-config
wget http://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz --no-check-certificate
tar -zxvf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2/
./configure --with-internal-glib
make
make install
# 绑vfio
# 1 开启iommu
vim /etc/default/grub
在GRUB_CMDLINE_LINUX行添加intel_iommu=on iommu=pt后保存退出
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot
# 2 加载vfio驱动
modprobe vfio-pci
/usr/bin/chmod a+x /dev/vfio
/usr/bin/chmod 0666 /dev/vfio/*
echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
# 3 网卡绑驱动
ifconfig ens34 down
./dpdk-devbind.py -b vfio-pci 0000:01:00.0
# 编译dpvs并运行
export LIBDPDKPC_PATH=/root/dpvs/dpdk-stable-20.11.1/dpdklib/lib64/pkgconfig/
cd ~/dpvs
make
make install
cp conf/dpvs.conf.single-nic.sample /etc/dpvs.conf
vim /etc/dpvs.conf
打开conn/redirect,关闭flow_enable
cd bin
./dpvs &
# 验证
VIP=192.168.0.100
LIP=192.168.0.222
RS=192.168.0.103
./dpip addr add ${VIP}/24 dev dpdk0
./ipvsadm -A -t ${VIP}:80 -s rr
./ipvsadm -a -t ${VIP}:80 -r ${RS}:80 -b
./ipvsadm --add-laddr -z ${LIP} -t ${VIP}:80 -F dpdk0
docker run --network host --name a1 -itd nginx:1.7.9
./dpip addr show
./ipvsadm -ln
# 清空规则
./ipvsadm -C
标签:bin,patch,dpvs,install,安装,python3,dpdk From: https://www.cnblogs.com/WJQ2017/p/17675267.html