[CentOS] Using eth0 on desktops with single network interface

Fri Apr 20 13:51:21 UTC 2012
Alfred von Campe <alfred at von-campe.com>

On Apr 19, 2012, at 14:14, Scott Robbins wrote:

> What I do is this for an existing one.  
> 
> I change /etc/sysconfig/network-scripts/ifcfg-whatever to ifcfg-eth0 (or
> whatever it might be, e.g., eth0 and eth1).  

I ended up writing a script to automate this on my CentOS 6 systems which looks like this:

    #/bin/sh
    rpm -q biosdevname && yum erase -y biosdevname
    if [ -e /etc/sysconfig/network-scripts/ifcfg-em1 ]; then
        mv /etc/sysconfig/network-scripts/ifcfg-em1 /etc/sysconfig/network-scripts/ifcfg-eth0
        sed -i -e '/DEVICE=/s/em1/eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
    fi

I've tested it on one system and it appeared to work fine, so I will deploy it to all my other systems over the weekend.

Alfred