# Kernel boot parameter to swap ethernet cards

## Arthanis

Im using another distro (rocks cluster) to build a cluster. I know that maybe here isnt the place to ask things, but as gentoo community has been awesome through these years I have been using gentoo on my PC and laptop, and this question is "distro-agnostic", I will ask anyway.

For some reason, Rocks NEEDS that public ethernet card is eth1 and the nodes network to be eth0. Since after it installs the system, it associates the mac with each eth, so I cannot change configuration files after its installed to swap the ethernet cards. So I need a kernel parameter (if that exists) to force the ethernet cards to be swapped when detected by udev, when it first boots to install. Does anyone know a way to do it? Thanks in advance.

----------

## DONAHUE

http://www.cyberciti.biz/howto/question/static/linux-kernel-parameters.php gives a cryptic 

```
netdev=         [NET] Network devices parameters

                        Format: <irq>,<io>,<mem_start>,<mem_end>,<name>

                        Note that mem_start is often overloaded to mean

                        something different and driver-specific.

                        This usage is only documented in each driver source

                        file if at all.
```

Probably udev rules are the best way to get the results you want.

Readable reference.

google udev rule eth0 or udev rule eth0 gentoo for tons of stuff if you need more

----------

## Arthanis

thanks, I will try that and post the results

----------

## Arthanis

The udev solution would fit me if I didn`t had to do that at install time. Once the system is installed, It associates the mac with eth* in its applications. Thats why I would need a kernel boot option, so it auto-configures its applications right away

----------

## krinn

just look at the udev fixed rules for eth in /etc/udev/rules.d/70-persistent-net.rules

let just udev start, assigning eth0 and eth1, udev will record who is who in the persistent file and you've just have to alter it to set eth0 or eth1 to what card should have it.

----------

## DONAHUE

If the underlying linux os was gentoo and rocks cluster was an application and the nic's had to be properly named before running/installing rocks cluster the first time. we would:

install gentoo

wirite persistent net rules in the gentoo file system to properly name the nics

boot gentoo the first time 

install and start rocks cluster for the first time

the modified anaconda installer may/should allow an analogous configuration. For what you describe I would expect a configuration file with somethinhg like public_ifc_mac= and  internal_ifc_mac=

----------

## Corona688

 *Arthanis wrote:*   

> The udev solution would fit me if I didn`t had to do that at install time.

  I suppose you could add a boot script that slurps in /proc/cmdline and produces udev rules, overwriting 70-persistent-net.rules before udev starts.  The kernel itself doesn't handle device naming any more, that's all udev's job. (which is what makes renaming them possible at all.)

You could also do things the old-fashioned way.  Check the order in lspci, and swap their card positions if necessary   :Laughing: 

----------

## DONAHUE

Brilliant! *Quote:*   

> You could also do things the old-fashioned way. Check the order in lspci, and swap their card positions if necessary  

 Also old style, swap the cables if wrong.

----------

## Arthanis

Yeah, swap cables would be the obvious solution, although brilliant. I didn`t do the because one is a intel gigabit onboard NIC, and the other is a 10/100 PCI. I need the gigabit to be eth0 and the 100 mbit to be eth1. Which invalidates the other solution of swapping them NICs slots =P. Thanks for the awesome ideas, anyway.

----------

