[CentOS] eth1 - Centos 6.2 - changing names of network interfaces

Thu May 10 17:27:49 UTC 2012
Les Mikesell <lesmikesell at gmail.com>

On Thu, May 10, 2012 at 11:50 AM, Gregory P. Ennis <PoMec at pomec.net> wrote:
>
> Can anyone refer me to a tutorial as to how to rename the network cards,
> ie I have one that ended up being system-eth3, that I want to be
> system-eth1?
>
> I am setting up a new CentOS 6.2 system that I plan to use as a gateway
> and e-mail server.  The original machine had only one nic card, and to
> my surprise the vendor did not have a 1000/100/10 card that would fit in
> the pci-e slot.  I ordered a pci-e network card, and while waiting for
> it to arrive I purchased a Sabrent usb 1000/100/10 to finish my
> development.  I was able to get CentOS 6.2 to recognize the usb ethernet
> adapter which had been assigned system-eth1, but I could not get data to
> go through it (in or out).
>
> The pci-e network card came in, and after it was installed, and upon the
> next boot it was assigned system-eth2.  I tried to delete the usb eth1
> and reassign the pci-e to eth1, but have managed to really mess things
> up.  I deleted references to eth1 and eth2 in :
>
> /etc/sysconfig/networking
> /etc/sysconfig/network-scripts
>
> hoping that the next boot would reassign the pci-e network card as eth1,
> but now the system will not even recognize the new card.
>
> Is there any way to reset the numbering sequences of network cards so
> that I can have the the desired names.  I wish now I would have left it
> alone, and just changed references to eth1 to eth2 in my iptables
> firewall.
>

The kernel sets the names of the devices according to the rules in
/etc/udev/rules.d/70-persistent-net.rules (which will be recreated at
reboot if you delete it after a change).   The
/etc/sysconfig/networking-scripts/ifcfg-xxx files have to match the
DEVICE= and HWADDR= entries to work.  Sometimes the old ifcfg-xxx
files will be renamed with a .bak extension and new ones created. When
that happens I keep the new HWADDR= entry but all of the other content
from the .bak file to make it work again.

-- 
   Les Mikesell
    lesmikesell at gmail.com