# eth name change on reboots

## Southernman

There is the little problem of my nic card changing name on me on reboots.

For what reason, I couldn't say.. that's where you good folk come in, I hope.

Doing some searching on the forum led me to look at this file:

etc/udev/rules.d/70-persistent-net.rules

```
# This file was automatically generated by the /lib/udev/write_net_rules

# program, probably 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 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:3a:c3:68", NAME="eth0"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:db:61:bd", NAME="eth1"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:34:3b:3f", NAME="eth2"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:06:02:28", NAME="eth3"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:83:04:8a", NAME="eth4"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:c4:27:d3", NAME="eth5"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:3c:8e:5a", NAME="eth6"
```

If it matters, the forcedeth driver was compiled built in - in lieu of a module.

I found this via this thread but am not certain about the work around suggested.

Any suggestions, definitive or not... are welcome and greatly appreciated!

Before hitting submit here, study of the file that creates the persistent rules has a entry that is suspect:

```
# If a rule using the current name already exists then find a new name and

# report it to udev which will rename the interface.

basename=${INTERFACE%%[0-9]*}

if interface_name_taken; then

   INTERFACE="$basename$(find_next_available "$basename[0-9]*")"

   if [ ! -t 1 ]; then

      echo "INTERFACE_NEW=$INTERFACE"

   fi
```

The above is only the pertinent part (IMO) if you want the whole file, just lmk.

----------

## Southernman

After thought warning!

Looking further at the scripts for this so called persistent thing-a-ma-jig. 

Would it solve my problem by adding a mac address to my /etc/conf.d/net file

current file below:

```
dns_domain_lo="Home"

modules=( "ifconfig" )

config_eth5=( "192.168.1.102 netmask 255.255.255.0 broadcast 192.168.1.255" )

routes_eth5=( "default via 192.168.1.1" )
```

----------

## Southernman

Not sure how pretty it is but this thread https://forums.gentoo.org/viewtopic-t-531421-highlight-eth+changing.html

led me to a fix to keep the nic card as eth0.

There is still a small hiccup however. Netscripts keeps over writing my /etc/resolv.conf 

taking my nameservers completely out of the file. Have to renter my nameservers 

before actually being able to ping out.

Progress at least!

----------

## RazielFMX

That is really odd.

You should check the /etc/conf.d/net.example for ideas on static IPs and DNS servers.  I use DHCP for the whole nine... well, I used to:

```

config_eth0=( "dhcp" )

modules_eth0=( "dhcpcd" )

dhcpcd_eth0=( "-t 8" )

```

However, I actually removed net.eth0 from my startup

```

rc-update del net.eth0 default

```

And then to stop the init process from trying to be smart:

```

rm -f /etc/init.d/net.eth0

```

Why did I do this?  Because I am on a laptop and use Network Manager.  I'm not sure if it will let you do static DNS and IPs, but it might be something worth looking into for you.

Before you go ahead and bandaid the problem (Network Manager will figure out what your interfaces are and if they are wired or wireless), I would really like to know what the problem is, since I have never seen a problem like this before.

I am assuming you built your own kernel (the only way to do things, imo).  I want you to go back into your kernel config and go to your network drivers.  I want you to disable every driver under 10, 100, 1000, and 10000 ethernet except for the one specific to you card (and any sub things it needs) as modules.

Then:

make && make modules_install

Copy your new kernel to your /boot (preferably overriding your old one).

Then, add the entries for your modules into /etc/modules.autoload.d/kernel-2.6

REBOOT.

You might have already done this, in which case disregard.

What is very interesting to me is the persistence file in which the mac address of your interface seems to change, causing this behavior.  I would recommend trying to track down why this is happening.

The only somewhat related thing I could find, which was utterly useless, was a case of this on Sabayon Linux 3.3 for x86_64.

Speaking of which, out of morbid curiosity, could you post the output of:

uname -ropism

(basically uname -a sans your hostname)

I am just wondering your kernel version and architecture.

----------

## Southernman

Thanks, I'll grab that info sometime tomorrow hopefully. Have to hit the rack as I have to take my dad to the hospital early in the am for triple bypass.

Thanks for the time you took. I'll get back to you asap.

Take care.

----------

## NeddySeagoon

Southernman

This error

```
Bringing up eth0

network interface does not exist 
```

posted in your other thread, means your network module is not loaded.

Try 

```
modprobe forcedeth
```

if that returns without an error, do 

```
/etc/init.d/net.eth0 restart
```

Your network should work now.

If thats good add forcedeth to /etc/modules.autoload.d/kernel-2.6

----------

## RazielFMX

 *NeddySeagoon wrote:*   

> Southernman
> 
> This error
> 
> ```
> ...

 

The thing is, he has eth1.  Then if he reboots, it becomes eth2, etc...

----------

## NeddySeagoon

RazielFMX,

Ahh ... I missed that.  Write a udev rule to name your interface(s)

I have a file called  /etc/udev/rules.d/03-local-net.rules which contains

```
# Name the eth interfaces correctly

 

KERNEL=="eth*", SYSFS{address}=="00:26:54:0b:c6:c6", NAME="eth_lan"

KERNEL=="eth*", SYSFS{address}=="00:0c:6e:14:c8:e7", NAME="eth_spare" 
```

The letters in the MAC Addresses must be lowercase.

Its risky using kernel names as the name allocation will fail if the name is already in use.

Be as inventive as you like with names but things break when you use more than 9 characters in the name.

You need to change the symlinks in /etc/init,d/ to the new name, the rc-update entries and /etc/conf.d/net, so the names are the same everywhere.

----------

## PaulBredbury

I think this would work:

/etc/udev/rules.d/10-local.rules

```
SUBSYSTEM=="net", DRIVERS=="forcedeth", NAME="lan"
```

But it would be better to specify the address.

----------

## RazielFMX

The udev rules will certainly fix his issue, but I would love to know why it happened in the first place!  I have never seen this problem on any of the systems I have installed (or attempted to install) Gentoo.

----------

## PaulBredbury

The MAC address is changing somehow. Each new address is considered to be a new device.

----------

## NeddySeagoon

PaulBredbury,

I seem to recall that there are two MAC address randomisers.

One does all 6 bytes, one does the last 3 bytes only but you have to

call them up, not something you would get by accident.

----------

