LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 06-22-2010, 05:00 AM   #1
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Rep: Reputation: 43
change eth1 to eth0 ?


Hello Red Hat users!
I'd like to ask you all for a simple thing on Slackware that I dont know how to do under RHEL 5.4.

Under Slackware 12.2 it is easy to change eth0 to eth1.
This should be done in file: /etc/udev/rules.d/75-network-devices.rules:
Code:
KERNEL=="eth?", ATTR{address}=="00:0c:29:a3:ed:27", NAME="eth1"
KERNEL=="eth?", ATTR{address}=="00:0c:29:a3:ed:31", NAME="eth0"
KERNEL=="eth?", ATTR{address}=="00:0c:29:a3:ed:3b", NAME="eth2"
KERNEL=="eth?", ATTR{address}=="00:0c:29:2b:7c:a0", NAME="eth3"
KERNEL=="eth?", ATTR{address}=="00:0c:29:2b:7c:aa", NAME="eth4"
KERNEL=="eth?", ATTR{address}=="00:0c:29:2b:7c:b4", NAME="eth5"
and execute:
Code:
# /etc/rc.d/rc.udev restart
... to restart udev.

Well, under Red Hat it looks slight diffrent. It looks like RHEL does not use udev ( correct me if i am wrong but there is no simillar file in /etc/udev/rules.d and cant see any script in /etc/init.d/).

I have found that all NIC configuration is stored in /etc/sysconfig/netwotk-scripts/ifcfg-ethx.
On this file it is possible to place varible: HARDWARE=
However after reboot it doesnt work.
So, my question is - how to assign eth[number] to specified MAC-addr ?
 
Old 06-22-2010, 11:15 AM   #2
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
You need to change "X" in ethX both on the file itself AND inside. The "DEVICE=ethX" is actually used to identify what file is for what interface.

So if you change ifcfg-eth0 with:
Code:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=xxx.ccc.vvv.95
HWADDR=40:61:86:63:EB:37
IPADDR=xxx.ccc.vvv.92
NETMASK=255.255.255.248
NETWORK=xxx.ccc.vvv.88
ONBOOT=yes
GATEWAY=xxx.ccc.vvv.94
TYPE=Ethernet
USERCTL=yes
IPV6INIT=no
PEERDNS=yes
to ifcfg-eth1 with :

Code:
DEVICE=eth1
BOOTPROTO=STATIC
BROADCAST=xxx.ccc.vvv.95
HWADDR=70:61:86:63:CD:54
IPADDR=xxx.ccc.vvv.92
NETMASK=255.255.255.248
NETWORK=xxx.ccc.vvv.88
ONBOOT=yes
GATEWAY=xxx.ccc.vvv.94
TYPE=Ethernet
USERCTL=yes
IPV6INIT=no
PEERDNS=yes
you are good to go.
 
Old 06-22-2010, 11:24 AM   #3
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Redhat does use udev, but not for this purpose AFAIK.
Also, see this howto.
 
Old 06-23-2010, 01:55 AM   #4
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Original Poster
Rep: Reputation: 43
DrLove73... come on!
I have just written that ifcfg-ethX (where X = 1,2,3,4,5,6,7,8,9...n).
The scripts ifcfg-ethX doesnt work well after reboot.

I have machine with 20 network interfaces (eth0 to eth19).
Its a real problem to me.

I have also find that MAC addr are set in /etc/sysconfig/hwconf file which is managed by kudzu. Is this good idea to make changes there ?

Come on Red Hat users! On Slackware it's a pice of cake
 
Old 06-23-2010, 03:13 AM   #5
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
You can always create a bash script to change them. And you only really need to change the DEVICE=ethX line (2 letters max) and file name ( also 2 letters max).

Those files can carry MUCH more informations then meets the eye, and they do not require HWADDR line. You can place it in only 1-2 files and the rest will get them in order kernel finds them and enumerates them.

Combined with ifcfg-ethX files are route-ethX where you can set your entire static routing.

Since you can also have ifcfg-br0 files, you can create bridges from files and by only changing insides of the ifcfg-eth0 you can make them members of those bridges.

Another good thing is that you can (for laptops mostly) many different ifcfg-XXXXXXXX files all with similar but different contents and activate them as you see fit. File names are not important for deciding the interface name, just are handy for human recognition. For example, if you are in your office, run "ifup ifcfg-eth0_office". When you reach your home, run "ifdown ifcfg-eth0_office; ifup ifcfg_eth0_home". Since GATEWAY=xxx.xxx.xxx.xxx can also be the part of the ifcfg-ethX file, you effectively should change your default route also (Most of us use NetworkManager and network profiles to do this for us (/etc/sysconfig/networking/profiles).

Virtual IP's are also easy to create. You just create/copy file ifcfg-ethX:0(1,2,...), change IP information and remove all the necessary lines and activate those interfaces or entire network service and that is it.

I also bet they it is much harder to change MAC address on the Windows you are writing from then from the Linux-es we are writing from

Last edited by DrLove73; 06-23-2010 at 03:20 AM.
 
Old 06-23-2010, 01:15 PM   #6
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Original Poster
Rep: Reputation: 43
DrLove73 - why u r still writing about ifcfg-eth scripts ?
I have answered u that it doesnt work after reboot. AI have also written that at beginning of this topis.

Please stop repeating what ifcfg scripts can do.
Im looking for a file where I can assign MAC addr to ethX.
That is why I have shown example with Slackware.
 
Old 06-23-2010, 06:10 PM   #7
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
You wrote:
Quote:
Originally Posted by czezz View Post
On this file it is possible to place varible: HARDWARE=
However after reboot it doesnt work.
Variable is HWADDR, not HARDWARE. Check my examples.

Quote:
Originally Posted by czezz View Post
DrLove73 - why u r still writing about ifcfg-eth scripts ?
I have answered u that it doesnt work after reboot. AI have also written that at beginning of this topis.

Please stop repeating what ifcfg scripts can do.
Im looking for a file where I can assign MAC addr to ethX.
That is why I have shown example with Slackware.
I successfully changed the order of the eth interfaces by changing the HWADDR line in ifcfg-ethX many times. That is why I am still writing about it. As far as I know, this is the ONLY way to pair up MAC address to a speific ethX interface on RHEL/CentOS/Fedora.

Last edited by DrLove73; 06-23-2010 at 06:16 PM.
 
Old 06-24-2010, 02:15 AM   #8
czezz
Member
 
Registered: Nov 2004
Distribution: Slackware/Solaris
Posts: 924

Original Poster
Rep: Reputation: 43
DrLove73 - once again. Please stop repeating about ifcfg scripts. I told u many times above that it DOESNT WORK AFTER REBOOT (for sure - not for 20 int.). Also please note - Im not asking about ifcfg syntax.

I am looking for working solution.
Anyone know it ?

I also asked for /etc/sysconfig/hwconf which is for kudzu - is this good way ?

Does anyone is Red-Hat expert here ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change eth0 to eth1 during the first boot us901 Red Hat 8 01-12-2010 05:51 PM
change eth0 and eth1 time out values...??? stevesutt89 Linux - Laptop and Netbook 1 11-01-2007 07:21 AM
cannot find ALIASES to change eth0 to eth1 utnalove Slackware 2 07-20-2007 03:51 PM
eth0 and eth1 change with each other: why? pusrob Linux - Hardware 10 02-16-2007 01:38 PM
eth1 cannot change it to eth0 jonnyhashem Linux - Hardware 2 01-05-2006 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration