Follow up on ETH'es not seen

Come on, help me.... If this helped you in any way and you have some spare BitCoins, you may donate them to me - 16tb2Rgn4uDptrEuR94BkhQAZNgfoMj3ug

This is a follow up on the post Problem with eth hardware not seen

This was causing my SLES build not to work, below is a script that will sort the entries in the udev rules out. Remember to reboot as soon as the script is done, make the script executable with chmod +x /opt/temp/sanity.sh
#!/bin/bash

# Hashing out entries for backup purposes
sed -i -e 's/SUBSYSTEM/#SUBSYSTEM/g' /etc/udev/rules.d/70-persistent-net.rules
echo "" >> /etc/udev/rules.d/70-persistent-net.rules
echo "# Added by the ETH MAC address sanity checker - King Rat" >> /etc/udev/rules.d/70-persistent-net.rules
echo "Adding the following entries into the udev rules 70-persistent-net.rules"

qq=`lspci -v | grep -i ethernet | wc -l`
for ((c=0; c<qq; c++ )); 
 do 
  macc=`ethtool -P eth$c | awk '{print $NF}'`
  echo "eth$c, $macc" >> /opt/temp/ETH_MAC_ADDRESSES
  echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$macc'", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth'$c'"'
  echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$macc'", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth'$c'"' >> /etc/udev/rules.d/70-persistent-net.rules
 done

Check the rules before rebooting as below

Ninja141:/opt/temp # 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.

# PCI device 0x14e4:0x1657 (tg3)
#####SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:f9", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x14e4:0x1657 (tg3)
#####SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:fa", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x14e4:0x1657 (tg3)
#####SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:f8", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x14e4:0x1657 (tg3)
#####SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:fb", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# Added by the ETH MAC address sanity checker - King Rat
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:f8", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:f9", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:fa", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="d8:9d:67:2a:10:fb", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
Ninja141:/opt/temp # 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.