centos如何实现SR-IOV功能

SR-IOV特性:能减少宿主机的CPU使用率,需要物理网卡支持该功能,并且有的主板需要开启VT-d功能,有的主板有单独的开启开关,如下图Dell R630

基础环境准备:物理网卡:intel I350 ,系统环境:centos7.5

基础环境验证,是否支持SR-IOV

查看物理网卡是否支持SR-IOV(单根虚拟化),说明支持SR-IOV   (lspci -vv 查看更为明细的内容,关注网卡方面的即可)
[root@localhost ~]# lspci -v| grep SR-IOV
  Capabilities: [160] Single Root I/O Virtualization (SR-IOV)
  Capabilities: [160] Single Root I/O Virtualization (SR-IOV)

查看当前内核
[root@localhost ~]# uname -r
  3.10.0-862.el7.x86_64

实施SR-IOV

#第一:开启IOMMUO功能,添加 intel_iommu=on
[root@localhost ~]# cat /etc/default/grub
  GRUB_TIMEOUT=5
  GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
  GRUB_DEFAULT=saved
  GRUB_DISABLE_SUBMENU=true
  GRUB_TERMINAL_OUTPUT="console"
  GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on"
  GRUB_DISABLE_RECOVERY="true"

#第二:确认驱动类型(igb),创建该文件,并指定虚拟vf的数量为4
  #先确定是那种类型的驱动(igb,e100e,ixgb)
  [root@localhost ~]# ethtool -i enp3s0f1
    driver: igb
    version: 5.4.0-k
    firmware-version: 1.63, 0x800009fa
    expansion-rom-version: 
    bus-info: 0000:03:00.1
    supports-statistics: yes
    supports-test: yes
    supports-eeprom-access: yes
    supports-register-dump: yes
    supports-priv-flags: yes

  #您可以查看某个物理网卡支持多少VF   "lspci -vv" 这个命令可以看
  [root@localhost ~]# cat /etc/modprobe.d/igb.conf
    options igb max_vfs=4

#第三:重新生成grub
  /sbin/grub2-mkconfig -o /boot/grub2/grub.cfg

#第四:升级内核
  yum update kernel -y

#第五:重载igb驱动,并重启系统
  modprobe -r igb && reboot

#第六:验证是否生效,下图表示网卡vf已经生效

centos6如何实现SR-IOV

#第一:在grub文件里的kernel行里增加“intel_iommu=on”
[root@localhost ~]# cat /boot/grub/grub.conf | grep intel_iommu=on
    kernel /vmlinuz-2.6.32-754.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet intel_iommu=on

#第二:指定需要创建的vf数量(该文件需要主动创建)
[root@localhost ~]# cat  /etc/modprobe.d/igb.conf 
options igb max_vfs=4

#第三:重启系统

#第四:验证,说明已经创建成功
[root@localhost ~]# lspci | grep Et
03:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
03:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
03:10.0 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:10.1 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:10.4 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:10.5 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:11.0 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:11.1 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:11.4 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)
03:11.5 Ethernet controller: Intel Corporation I350 Ethernet Controller Virtual Function (rev 01)

诺基亚项目中NFV的配置参考_NOKIA_20VSR安装配置手册_v1.0_2020160605

openstack 社区的SRIOV介绍文档

红帽配置 SR-IOV 网络

其他相关介绍

声明:本文为原创,作者为 辣条①号,转载时请保留本声明及附带文章链接:https://boke.wsfnk.com/archives/238.html
谢谢你请我吃辣条谢谢你请我吃辣条

如果文章对你有帮助,欢迎点击上方按钮打赏作者

最后编辑于:2022/12/3作者: 辣条①号

现在在做什么? 接下来打算做什么? 你的目标什么? 期限还有多少? 进度如何? 不负遇见,不谈亏欠!

暂无评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

arrow grin ! ? cool roll eek evil razz mrgreen smile oops lol mad twisted wink idea cry shock neutral sad ???

文章目录