Re: New network device causes 'jump' from eth0 to eth1

2008-07-04 Thread Oron Peled
Since people pointed to distribution specific files, let's
consolidate the knowledge:
 * Renaming interfaces used to be done by the nameif(8) command.
 * Although this command is still carried by modern distributions
   (e.g: my Fedora-8 and Fedora-9) its usage was deprecated in favor
   of the modern ip(8) command.
 * To rename an interface:
/sbin/ip link set  name 

As is common in Unix/Linux systems, there are scripts that run these
commands for us (e.g: during boot), and these scripts read their
configuration information from other files.

The relevant script in Fedora/Centos/Red Hat is
  /etc/sysconfig/network-scripts/ifup-eth
and it calls the shell function rename_device defined
in /etc/sysconfig/network-scripts/network-functions.

Ehud Karni correctly pointed that these scripts read from:
> On Fedora/Centos the file /etc/sysconfig/network-scripts/ifcfg-eth
> can have the line:   HWADDR=xx:xx:xx:xx:xx:xx  (mac address)
> to assign the eth to specific network card.

As pointed by others, Debian has different scripts which read
the configuration in interfaces(5).

Yet, other distributions have their own scripts/configs. However
if we search for the nameif(8) or ip(8) commands in the right
directories (under /etc of course) we would find the correct
scripts to configure and from there the config files they use.

And we haven't talked about NetworkManager yet...

Cheers,

-- 
Oron Peled Voice/Fax: +972-4-8228492
[EMAIL PROTECTED]  http://www.actcom.co.il/~oron
"In theory, there is no difference between theory and practice.
 In practice, there is."
-- Yogi Berra

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: New network device causes 'jump' from eth0 to eth1

2008-07-03 Thread Ehud Karni
On Thu, 3 Jul 2008 16:41:20 Baruch Siach wrote:
>
> On Thu, Jul 03, 2008 at 04:27:29PM +0300, Noam Rathaus wrote:
> > Hi,
> > Or basically, where is it written that eth0 is 'thismodule' while eth1 is
> > 'thisothermodule'?
>
> udev takes care of this. On Debian machines the relevant configuration file is
> /etc/udev/rules.d/z25_persistent-net.rules. I guess there is something similar
> for other distributions.

On Fedora/Centos the file /etc/sysconfig/network-scripts/ifcfg-eth
can have the line:   HWADDR=xx:xx:xx:xx:xx:xx  (mac address)
to assign the eth to specific network card.

Ehud.


--
 Ehud Karni   Tel: +972-3-7966-561  /"\
 Mivtach - Simon  Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D Better Safe Than Sorry

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: New network device causes 'jump' from eth0 to eth1

2008-07-03 Thread Baruch Siach
Hi Noam,

On Thu, Jul 03, 2008 at 04:27:29PM +0300, Noam Rathaus wrote:
> Hi,
> Or basically, where is it written that eth0 is 'thismodule' while eth1 is 
> 'thisothermodule'?

udev takes care of this. On Debian machines the relevant configuration file is 
/etc/udev/rules.d/z25_persistent-net.rules. I guess there is something similar 
for other distributions.

baruch

-- 
 ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - [EMAIL PROTECTED] - tel: +972.2.679.5364, http://www.tkos.co.il -

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: New network device causes 'jump' from eth0 to eth1

2008-07-03 Thread Omer Zak

--=-norL4QRk5t43W51udD8G
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

The relevant file is /etc/network/interfaces - see man 5 interfaces.


On Thu, 2008-07-03 at 16:27 +0300, Noam Rathaus wrote:
> Hi,
> 
> I moved an HD from one computer to another (not related to the grub issue 
> :D), 
> and because there is a different network card, eth0 is not longer present and 
> now eth1 is the deacto network card.
> 
> I don't want to reconfigure a few products I have bounded to eth0 (mainly 
> firewall rules).
> 
> How can I "force" it to use the new network card driver on eth0 instead of 
> eth1?
> 
> Or basically, where is it written that eth0 is 'thismodule' while eth1 
> is 'thisothermodule'?
> 
> I tried modprobe.conf/modules.conf:
> alias eth0 e1000e
> 
> Without success - it still - after modprobe e1000e - gives me access to it 
> only through eth1
-- 
42 is the answer to everything.  Food is the answer to everything except
obesity.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html

--=-norL4QRk5t43W51udD8G
Content-Disposition: attachment; filename=check-mac-address.sh
Content-Type: application/x-shellscript; name=check-mac-address.sh
Content-Transfer-Encoding: 7bit

#!/bin/sh
# Checks if the given interface matches the given ethernet MAC
# if it does it exits with 0 status, if it doesn't then it exists
# with 1 (error) status.

set -e

export LANG=C

if [ ! -n "$1" -o ! -n "$2" ] ; then
echo "Usage: $0 IFACE targetMAC"
exit 1
fi
iface="$1"
targetmac=`echo "$2" | sed -e 'y/ABCDEF/abcdef/'`
mac=$(/sbin/ifconfig "$iface" | sed -n -e '/^.*HWaddr 
\([:[:xdigit:]]*\).*/{s//\1/;y/ABCDEF/abcdef/;p;q;}')

if [ "$targetmac" = "$mac" ]; then exit 0; else exit 1; fi

--=-norL4QRk5t43W51udD8G--


=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: New network device causes 'jump' from eth0 to eth1

2008-07-03 Thread Shachar Shemesh

Noam Rathaus wrote:

Hi,

I moved an HD from one computer to another (not related to the grub issue :D), 
and because there is a different network card, eth0 is not longer present and 
now eth1 is the deacto network card.


I don't want to reconfigure a few products I have bounded to eth0 (mainly 
firewall rules).


How can I "force" it to use the new network card driver on eth0 instead of 
eth1?


Or basically, where is it written that eth0 is 'thismodule' while eth1 
is 'thisothermodule'?


I tried modprobe.conf/modules.conf:
alias eth0 e1000e

Without success - it still - after modprobe e1000e - gives me access to it 
only through eth1



  
On Debian systems, check out /etc/udev/rules.d/z25-persistent-network. 
Just delete the lines for the old and the new network card, and let it 
choose automatically eth0.


Shachar

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



New network device causes 'jump' from eth0 to eth1

2008-07-03 Thread Noam Rathaus
Hi,

I moved an HD from one computer to another (not related to the grub issue :D), 
and because there is a different network card, eth0 is not longer present and 
now eth1 is the deacto network card.

I don't want to reconfigure a few products I have bounded to eth0 (mainly 
firewall rules).

How can I "force" it to use the new network card driver on eth0 instead of 
eth1?

Or basically, where is it written that eth0 is 'thismodule' while eth1 
is 'thisothermodule'?

I tried modprobe.conf/modules.conf:
alias eth0 e1000e

Without success - it still - after modprobe e1000e - gives me access to it 
only through eth1


-- 
Noam Rathaus
CTO
[EMAIL PROTECTED]
http://www.beyondsecurity.com

"Know that you are safe."

Beyond Security Finalist for the "Red Herring 100 Global" Awards 2007

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]