Manually trigger creation of /etc/udev/rules.d/70-persistent-net.rules file
Hello,
We are looking to trigger the recreation of the /etc/udev/rules.d/70-persistent-net.rules file under RHEL 6.5 (current patches)
We tried the Red Hat Solution ID# 495013, but it did not work
QUOTE FROM ARTICLE ABOVE:
Resolution
•You can manually force udev to create the rules file by running the following command:
This command is recommended to trigger the rules file:
# udevadm trigger --subsystem-match=net
Does anyone else know how to trigger the recreation of that file? Sadly the command did not invoke the file... The article mentions nothing of a need to reboot the system, yet this and some of other related rhel 6.5 servers have been rebooted numerous times recently.
Typically, I've seen that file created by default, and is typically automagically created if it is deleted and rebooted. Yet in the case of these servers, it has not been created, even with numerous reboots. We have some servers (rhel 6.5) that apparently have never had that file created.
Thanks
Responses
Hey Cecil,
Here's the rpms we have on a rhel 6.5 server that actually does create the 70-persistent-net.rules file (looks like the same rpms):
udev-147-2.51.el6.x86_64
libgudev1-147-2.51.el6.x86_64
libudev-147-2.51.el6.x86_64
python-gudev-147.1-4.el6_0.1.x86_64
One of my rhel 6.5 workstations had just one more package to the above list:
system-config-printer-udev-1.1.16-23.el6.x86_64
Here you go .
udevadm trigger --type=devices --action=change
or
udevadm control --reload-rules
Let us know how it went.
Thanks
Arrey
Let me guess, you removed the file /etc/udev/rules.d/70-persistent-net.rules and you want the udev to recreate it? Not gonna work. You can remove the file and reboot so udev makes a new one. If you want to make changes in the file and have the changes take effect with rebooting? Then use the above commands I provided.
Thanks
Cecil, can you reboot your system?
Arrey, I looked into an existing /etc/udev/rules.d/70-persistent-net.rules file I had and noticed apparently the file can be invoked without a reboot, I've been trying different things, but have not had it make it properly yet.
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator-rules rules file
I got one to write (adjusting a copy of the file) without a reboot, but it did not have the expected MAC address.
Then you can add the MAC address in the file manually.
At least in the copy of the script I created and executed... measure twice cut once :)
Although, if one knew the definitive PCI slot and used that, if the NIC was changed later, it wouldn't care about the MAC address. I suppose the PCI slot is the value "MATCHID" based on line 17 of the unaltered script
One work-around I found...
I made a copy of the /lib/udev/write_net_rules file and added this, ran it and it worked without a reboot.
# line 25, line 26 is next
INTERFACE=eth0 # provided this is your interface
MATCHADDR="d4:AE:52:AB:AC:AD" # add your real mac address, not this fake one of course
However, there has to be some method to make this run as anticipated --without-- altering the file.
Update, the /etc/udev/rules.d/70-persistent-net.rules file I created added the wrong interface; I had to adjust the /etc/udev/rules.d/70-persistent-net.rules file to match the interface.
I have read with other Linux distros, that this is supposed to read and create a 70-persisten-net.rules file with the following with does not work on RHEL.
/lib/udev/write_net_rules all_interfaces
Within the /etc/udev/rules.d/70-persistent-net.rules file, it says that the 70-persisten-net.rules file is (somehow) created by the /lib/udev/write_net_rules program, run by the /lib/udev/rules.d/75-persistent-net-generator-rules rules file.
Hello, that works for me:
[root@rhel6 ~]# rm /etc/udev/rules.d/70-persistent-net.rules
rm: remove regular file `/etc/udev/rules.d/70-persistent-net.rules'? y
[root@rhel6 ~]# ls -la /etc/udev/rules.d/70-persistent-net.rules
ls: cannot access /etc/udev/rules.d/70-persistent-net.rules: No such file or directory
[root@rhel6 ~]# /lib/udev/write_net_rules all_interfaces
[root@rhel6 ~]# ls -la /etc/udev/rules.d/70-persistent-net.rules
-rw-r--r--. 1 root root 368 Nov 3 14:07 /etc/udev/rules.d/70-persistent-net.rules
[root@rhel6 ~]#
UPDATE:
Seems it worked on a Workstation VM with one interface, but not on a server VM with three interfaces. But in the latter case, # udevadm trigger --subsystem-match=net did work.
Hello Cecil
If you try:
~]# export INTERFACE=eth0
export MATCHADDR="ip addr show $INTERFACE | grep ether | awk '{print $2}'"
~]# /lib/udev/write_net_rules
~]# less /etc/udev/rules.d/70-persistent-net.rules
Do you see anything in that file?
Hi Stephen, I found that exporting "INTERFACE_NAME" to the current active interface worked.
export INTERFACE_NAME=eth0
echo "this is useful if you happen to know in advance that eth0 above is the active functioning NIC with no other NICs"
- This seems to work fine for a single interface system,
- But sadly, (just as you pointed out) if I had a multiple amount of interfaces (such as bonded network interfaces, or just extra NICs leading to another subnet; then it did not work).
- It would not include other NICS that exist that are not currently in use that could be configured later if the need arose.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
