How to map eth0 to a different interface

C. Linus Hicks lhicks at nc.rr.com
Tue Apr 12 01:06:33 UTC 2005


On Wed, 2005-04-06 at 19:28 -0700, Suraj Chandrasekaran wrote:
> I am having a pc with 5 interface cards, 4 of which are gigi and one is 100mbps.
> 
> the gigis are eth0 to eth3 and the other is eth4. I want to map eth0
> to eth3 in the reverse, so that eth3 is called eth0 and eth2 is eth1,
> eth1 is eth2 and eth0 is eth3.
> 
> I tried the ~/network-scripts/ifcfg-eth*, but am not successful. I am
> using kernl version 2.4.18.
> 
> Please help me.

You didn't say what version of Red Hat you are running, but here is the
general procedure...

Some versions of Red Hat support an HWADDR parameter in your ifcfg-
eth<n> files in /etc/sysconfig/network-scripts. Use this parameter to
choose the physical device you want to assign a particular name. The way
of doing this is by way of the ifup script in network-scripts. It should
test for the existence of the HWADDR parameter, and match up the
devices. It calls a function defined in network-functions that does the
rename using "ip link set dev ${1} name eth${new}". It's a little more
complicated than that, because you have to worry about the new name
existing, but you get the idea.

The thing is, all you may have to do is to set HWADDR in ifcfg-eth<n>.
But if that doesn't work, you will have to alter your network-scripts
files to do the renames.

The rename isn't persistent over booting, which is why it has to be in
the scripts that start your network. So look in your network-functions
and see if it has the code to do the renames, and check your ifup script
to see if it tests for the presence of HWADDR.

By the way, here is a good man page for ip:

http://voidmain.is-a-geek.net/man/?parameter=ip&mode=man

-- 
C. Linus Hicks <lhicks at nc dot rr dot com>




More information about the redhat-list mailing list