카테고리 없음

SR-IOV blacklist into a kernel module and Set Persistent NIC devices

NATONY 2020. 4. 5. 06:30

 

[root@compute1 ~]# cat /etc/default/grub 
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="console=tty0 crashkernel=auto no_timer_check net.ifnames=0 console=ttyS0,115200n8 i40evf.blacklist=1 rd.driver.blacklist=i40evf"
GRUB_DISABLE_RECOVERY="true"

https://access.redhat.com/solutions/41278

 

How do I blacklist a kernel module to prevent it from loading automatically? - Red Hat Customer Portal

How do I blacklist a kernel module to prevent it from loading automatically? How to disable a kernel module? How to disable a specific device driver?

access.redhat.com

[root@compute1 ~]# modprobe -r i40evf
[root@compute1 ~]# echo "blacklist i40evf" >> /etc/modprobe.d/local-blacklist.conf
[root@compute1 ~]# echo "install i40evf /bin/false" >> /etc/modprobe.d/local-blacklist.conf
[root@compute1 ~]# cp -rp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak 
[root@compute1 ~]# dracut --omit-drivers i40evf -f
[root@compute1 ~]# sed -i '/^GRUB_CMDLINE_LINUX=/s/"$/ i40evf.blacklist=1 rd.driver.blacklist=i40evf"/' /etc/default/grub
[root@compute1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@compute1 ~]# cp -rp /boot/initramfs-$(uname -r)kdump.img /boot/initramfs-$(uname -r)kdump.img.$(date +%m-%d-%H%M%S).bak
[root@compute1 ~]# sed -i '/^KDUMP_COMMANDLINE_APPEND=/s/"$/ rd.driver.blacklist=i40evf"/' /etc/sysconfig/kdump
[root@compute1 ~]# kdumpctl restart
[root@compute1 ~]# mkdumprd -f /boot/initramfs-$(uname -r)kdump.img

 

 


[root@compute1 ~]# ls -lh /sys/class/net
total 0
lrwxrwxrwx 1 root root    0 Apr  3 14:18 bond0 -> ../../devices/virtual/net/bond0
lrwxrwxrwx 1 root root    0 Apr  3 14:18 bond1 -> ../../devices/virtual/net/bond1
-rw-r--r-- 1 root root 4.0K Apr  3 14:18 bonding_masters
lrwxrwxrwx 1 root root    0 Apr  3 14:18 eth0 -> ../../devices/pci0000:00/0000:00:03.0/virtio0/net/eth0
lrwxrwxrwx 1 root root    0 Apr  3 14:18 eth1 -> ../../devices/pci0000:00/0000:00:05.0/net/eth1
lrwxrwxrwx 1 root root    0 Apr  3 14:18 eth2 -> ../../devices/pci0000:00/0000:00:06.0/net/eth2
lrwxrwxrwx 1 root root    0 Apr  3 14:18 eth3 -> ../../devices/pci0000:00/0000:00:07.0/net/eth3
lrwxrwxrwx 1 root root    0 Apr  3 14:18 eth4 -> ../../devices/pci0000:00/0000:00:08.0/net/eth4
lrwxrwxrwx 1 root root    0 Apr  3 14:18 lo -> ../../devices/virtual/net/lo

https://access.redhat.com/solutions/112643

 

How to set persistent NIC device name with PCI slot via udev instead of MAC address in Red Hat Enterprise Linux 6 - Red Hat Cust

Is it possible to create custom udev rules to use the PCI address of network card for persistent naming instead of the MAC address?

access.redhat.com

[root@compute1 ~]# cat /etc/udev/rules.d/60-persistent-net.rules 
# 0000:00:03.0 Ethernet controller: Red Hat, Inc. Virtio network device was eth0
 ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:03.0", NAME:="eth0"

# 0000:00:05.0 Ethernet controller: Intel Corporation Ethernet Virtual Function 700 Series (rev 02) was eth1
 ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:05.0", NAME:="eth1"

# 0000:00:06.0 Ethernet controller: Intel Corporation Ethernet Virtual Function 700 Series (rev 02) was eth2
 ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:06.0", NAME:="eth2"

# 0000:00:07.0 Ethernet controller: Intel Corporation Ethernet Virtual Function 700 Series (rev 02) was eth3
 ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:07.0", NAME:="eth3"

# 0000:00:08.0 Ethernet controller: Intel Corporation Ethernet Virtual Function 700 Series (rev 02) was eth4
 ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:00:08.0", NAME:="eth4"

 


[root@compute1 ~]# cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:3c:7d:9b", KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:c8:15:be", KERNEL=="eth*", NAME="eth1"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:06:b4:c8", KERNEL=="eth*", NAME="eth2"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:f3:c9:cf", KERNEL=="eth*", NAME="eth3"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="fa:16:3e:93:98:cd", KERNEL=="eth*", NAME="eth4"

 

 

[root@compute1 ~]# lspci -nn | grep Ethernet
00:03.0 Ethernet controller [0200]: Red Hat, Inc. Virtio network device [1af4:1000]
00:05.0 Ethernet controller [0200]: Intel Corporation Ethernet Virtual Function 700 Series [8086:154c] (rev 02)
00:06.0 Ethernet controller [0200]: Intel Corporation Ethernet Virtual Function 700 Series [8086:154c] (rev 02)
00:07.0 Ethernet controller [0200]: Intel Corporation Ethernet Virtual Function 700 Series [8086:154c] (rev 02)
00:08.0 Ethernet controller [0200]: Intel Corporation Ethernet Virtual Function 700 Series [8086:154c] (rev 02)

[root@compute1 ~]# ethtool -i eth0
driver: virtio_net
version: 1.0.0
firmware-version: 
expansion-rom-version: 
bus-info: 0000:00:03.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

[root@compute1 ~]# ethtool -i eth1
driver: i40evf
version: 3.5.13
firmware-version: N/A
expansion-rom-version: 
bus-info: 0000:00:05.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no