Operating System - Linux
1823959 Members
5144 Online
109667 Solutions
New Discussion юеВ

how to Rename a NIC, in rhel 3/4/5

 
SOLVED
Go to solution
Maaz
Valued Contributor

how to Rename a NIC, in rhel 3/4/5

we can change the nic name from ethX to any_reasonable_name in SuSE Ent 10...
here is the howto
http://www.novell.com/coolsolutions/tip/19154.html
[ PLZ RATE THIS TIP .. thanx in anticipation ;) ]

is there anything equivalent in rhel 3/4/5
i.e eg i have two nics(eth0, eth1).. and I dont want to access these nics as eth0, and eth1... but I want to access eth0 as wan0, and eth1 as lan0
i.e
# ifdown lan0.. instead of eth1
# ifup lan0.. instead of eth1
# ifdown wan0.. instead of eth0
# ifup wan0.. instead of eth0

Regards
Maaz
4 REPLIES 4
Don Vanco - Linux Ninja
Regular Advisor
Solution

Re: how to Rename a NIC, in rhel 3/4/5

The theory is not much different under RHEL, only the actual filename determines verbiage used to manipulate the device.

You can:
Use the GUI tool (system-config-network) and manipulate the device -vs- network "nickname"

Or just rename the files as desired and "service network restart"

You will now be able to manipulate the device via that name - HOWEVER - the output of ifconfig/ip will always show the actual eht* hardware data.

If you want the output of ifconfig/ip to show "lan0" or "wan0" you have to edit the ifcfg-"filename" and do 2 things:
1) change the DEVICE line
2) include the HWADDR
[root@cluster1 network-scripts]# cat ifcfg-lan0
DEVICE=lan0
HWADDR=00:19:BB:3B:DA:1C



E.G.:
(my output is slightly manipulated because of remote connectivity, the the idea is the same)
[root@cluster1 sysreport]# cd /etc/sysconfig/network-scripts/
[root@cluster1 network-scripts]# ls ifcfg-eth*
ifcfg-eth0 ifcfg-eth3
[root@cluster1 network-scripts]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:17:A4:77:00:08
eth1 Link encap:Ethernet HWaddr 00:17:A4:77:00:0A
eth2 Link encap:Ethernet HWaddr 00:19:BB:3B:DA:1B
eth3 Link encap:Ethernet HWaddr 00:19:BB:3B:DA:1C


[root@cluster1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth3: [ OK ]

[root@cluster1 network-scripts]#
[root@cluster1 network-scripts]# mv ifcfg-eth3 ifcfg-wan0
[root@cluster1 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Setting network parameters: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface wan0: [ OK ]


Now if I edit the file and change the device data:
[root@cluster1 network-scripts]# ls ifcfg-*
ifcfg-eth0 ifcfg-lan0

(vi file here)

[root@cluster1 network-scripts]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:17:A4:77:00:08
lan0 Link encap:Ethernet HWaddr 00:19:BB:3B:DA:1C
Van den Broeck Tijl
Valued Contributor

Re: how to Rename a NIC, in rhel 3/4/5

I don't know about RHEL 3/4 but at least 5 uses udev for device management & naming. You can change your network device's identifier via udev rules, you'll have to configure it as a totally new card as well then (unless you use mac-address based ifcfg's which is default in ie. SLES).

You can find the rules in /etc/udev/rules.d

just "grep eth0 *" in there (name of the file containing the network rulesets could be different, I've seen it been called 30-net_persistent_names.rules and others. If you do not have a match there, you can create a file yourself, ie: 30-net_persistent_names.rules with the following lines in there:
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:18:fe:dd:b1:a1", IMPORT="/lib/udev/rename_netiface %k eth0"
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:18:fe:dd:b1:a2", IMPORT="/lib/udev/rename_netiface %k wan0"

When rebooting (or restarting udev & networking) the devices will be permanently renamed (for as long as you keep that entry in the udev rulesets)
Van den Broeck Tijl
Valued Contributor

Re: how to Rename a NIC, in rhel 3/4/5

Oops, misread, ignore my previous post. I didn't see the Novell tip itself, that is exactly what I said about udev.

The same applies in RHEL5. You can add similar udev rules.
Maaz
Valued Contributor

Re: how to Rename a NIC, in rhel 3/4/5

Thanks for the help/replies ;)
one of my friend has report me the following, will also work in rhel 5.

No of NIC: 1
Default Device Alias: eth0
New Device Alias: lan0

STEPS:
-----

1. Open /etc/sysconfig/hwconf

And Change "device: eth0" to as given bellow
------------------------
class: NETWORK
bus: PCI
detached: 0
device: lan0 ### here
driver: 3c59x
desc: "3Com Corporation 3c905B 100BaseTX [Cyclone]"
network.hwaddr: 00:50:04:99:c4:1d
.
.
.

----------------------------------

2. open /etc/modprobe.conf

And Change eth0 to lan0

Change from
alias eth0 3c59x
To
alias lan0 3c59x

Save and Exit.

3. Change the name of
/etc/sysconfig/network-scripts/ifcfg-eth0 file to
/etc/sysconfig/network-scripts/ifcfg-lan0

mv /etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-lan0

4. Reboot System.

and its DONE
(yet I haven't check the above steps)

Regards

Maaz