LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   eth0 / eth1 : how is it decided? (https://www.linuxquestions.org/questions/linux-networking-3/eth0-eth1-how-is-it-decided-646884/)

bricedebrignaisplage 06-04-2008 03:09 AM

eth0 / eth1 : how is it decided?
 
I installed linux on a computer then put the hard drive on another computer that should be exactly the same. However the interface was changed from eth0 to eth1.

1) can I make them eth0 on both? because I would like to be able to switch...

2) I want the interface to be 172.16.0.1. Can I configure both eth0 and eth1 in /etc/network/interfaces to be this static IP or will it conflict? Actually this one is more important than previous question?

dellcom1800 06-04-2008 06:50 PM

hi

1) Was there another NIC on that other computer (IE integrated)?

2) I would say no. You could do this but they would have to be connected to two physically different networks, but if they are connected to the same one then no, it will cause a conflict

bricedebrignaisplage 06-04-2008 10:41 PM

1) What do you mean by "another NIC"? Another brand? The computers are the same. Probably the only difference at that point is the serial number of the parts, and the MAC address of the cards. Can it be that since eth0 was assigned to the interface with MAC address MAC1, so when it encountered the interface on the other computer with MAC address MAC2 it assigned it eth1?

2) Since the 2 computers don't co-exist it will not conflict on the network side. I am worried about the system complaining that 2 interfaces have the same address... But this I can simply try...

chmick 06-05-2008 02:59 AM

eth0/eth1, decided by udev
 
Quote:

Originally Posted by bricedebrignaisplage (Post 3174201)
I installed linux on a computer then put the hard drive on another computer that should be exactly the same. However the interface was changed from eth0 to eth1.

1) can I make them eth0 on both? because I would like to be able to switch...


Hello
I had a similar problem , when re installing my debian lenny .
I do not remember the exact name of the file , but i guess the solution, is in the udev configuration rules files .(i think it's /etc/udev/rules/

I found a file which associate the interface name (eth0 eth1 etc..) with the mac address .
to find this file a grep -R eth0 /etc/udev/* should do the trick .

jschiwal 06-05-2008 04:39 AM

My guess is that HAL and UDEV saved information on eth0 including the MAC address (persistant network device naming). The MAC differs on the second host so the system created a new ifcfg-<dev> for it. This comes in handy if you have a pcmcia NIC device. You could plug in one card for work and another one for home and you don't need to reconfigure the network setup, just change NIC cards.

Also check for these files:
/etc/udev/rules.d/70-persistent-net.rules
/etc/udev/rules.d/75-persistent-net-generator.rules

Code:

# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:0f:b0:0c:ef:ab", NAME="eth0"

# PCI device 0x14e4:0x4320 (bcm43xx)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:90:4b:92:71:a1", NAME="eth1"

# PCI device 0x1737:0xab09 (tulip)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:04:5a:9d:d6:e8", NAME="eth2"
jschiwal@hpamd64:/usr/src/linux/fs/cifs>

In this file, eth0 refers to my built in nic device (on laptop) that failed on me. The second is the built in wireless interface. The third is a PCMCIA card that I normally use.

The easiest way to deal with it may be to run your network configuration program and delete the interfaces and start over.

Make sure you change the hostname so that it is unique. If you have static IPs, the two hosts must have different IPs as well.


All times are GMT -5. The time now is 12:07 PM.