LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Rename network interface (https://www.linuxquestions.org/questions/linux-newbie-8/rename-network-interface-4175505456/)

linuxmantra 05-19-2014 11:10 AM

Rename network interface
 
I am building a physical server (DL 360 Gen 8). Since, I could not see the interface interface in iLO, HP service was called and they replaced the 4 new NIC card as per the ahu report generated by iLO. Now, I can see the 4 network interface when I type # ifconfig -a, eth4, eth5, eth6 and eth7. But when I type #ifconfig eth0, message appears as eth0:error fetching interface information: Device not found. Now how can I change the eth4 to eth0?

Also, Default things inside /etc/sysconfig/network-scripts/ifcfg-ethX are
DEVICE=
BOOPROTO=
HWADDR=
MTU=1500
UUID= <from where shall I get this>

Thanks in advance.

Shadow_7 05-19-2014 11:51 AM

If you're using udev it generates them at first boot for a given hardware. If you migrate hardware with the same install you can purge the rule(s) from /etc/udev/rules.d/ and it will start counting from zero again. Otherwise you can edit the rule(s). That is IF you're using udev. It's /etc/udev/rules.d/70-persistent-net.rules on my debian system.

linuxmantra 05-19-2014 12:09 PM

Quote:

Originally Posted by Shadow_7 (Post 5173659)
If you're using udev it generates them at first boot for a given hardware. If you migrate hardware with the same install you can purge the rule(s) from /etc/udev/rules.d/ and it will start counting from zero again. Otherwise you can edit the rule(s). That is IF you're using udev. It's /etc/udev/rules.d/70-persistent-net.rules on my debian system.

Yes I am using udev. How to purge the rule from /etc/udev/rules.d/????

Shadow_7 05-19-2014 01:43 PM

For me:

# systemctl stop udev
# rm /etc/udev/rules.d/70-persistent-net.rules
# reboot

You don't have to reboot, but if you don't, you have to modprobe -r the network nic drivers then modprobe them back before you restart udev. It's just simpler to reboot. With the reboot, stopping the udev might be optional. For sysV type systems it would be the "/etc/init.d/udev stop" type syntax.

You could also modify the net.rules and do the reboot. There's stuff in /lib/udev/ that tells udev what guidelines to use for an initial creation and other options.

Edit:
There's also the ifdown type stuff to free up the modules to be unloaded if you don't reboot.

linuxmantra 05-19-2014 03:52 PM

Quote:

Originally Posted by Shadow_7 (Post 5173719)
For me:

# systemctl stop udev
# rm /etc/udev/rules.d/70-persistent-net.rules
# reboot

You don't have to reboot, but if you don't, you have to modprobe -r the network nic drivers then modprobe them back before you restart udev. It's just simpler to reboot. With the reboot, stopping the udev might be optional. For sysV type systems it would be the "/etc/init.d/udev stop" type syntax.

You could also modify the net.rules and do the reboot. There's stuff in /lib/udev/ that tells udev what guidelines to use for an initial creation and other options.

Edit:
There's also the ifdown type stuff to free up the modules to be unloaded if you don't reboot.

Since I was building physical server, there is 4 slots for NIC card, earlier due to issue in NIC card, we called HP service man and replaced all the NIC because problem was in NIC card which was identified by ahs report generated by ILO. So, when the hp's service man changed the NIC card, I see 8 network interface starting from eth0 to eth7. so, finally, what I did is, I rebuild the server again and all problem was solved, Now I can see only 4 network interface eth0 to eth3 and I configured the network in eth0. Rebuilding server leads to resolve my issue.

Shadow_7 05-20-2014 03:33 AM

udev uses the next name when it sees the new network hardware. Since you changed hardware and the previous hardware took the first four slots, it assigned eth4+. A reinstall is one solution of course. Although the differences between the results may only be the contents of one file.

I have this issue often as I run linux from an SDHC card and move that card across multiple hardware options. I do what I previously listed so I don't have to change my firewall script to use a different interface. And otherwise have "ifconfig -a" list 10+ nics that doesn't apply to the current hardware.

$ egrep -r -i "eth0" /etc/udev/*


All times are GMT -5. The time now is 06:30 AM.