From: Sthu Deus on
Good day.


How I can make best way the following:

having 2 NICs in an OS (called eth0 and eth1, having iptables rules
set accordingly) and exchanging one or two of them with (an)other(s)
NIC(s), to make it be again (called eth0 and eth1, having iptables rules
set accordingly) automatically.

?

For now I have to clear up udev rules net file so that it will be
filled w/ eth0 and 1 instead of 2 and 3.
Then I have to review which one is set for one network, and
another - for another network - according to interfaces file.


Thank You for Your time.


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4c4f2387.0b07650a.3bb5.ffffe79e(a)mx.google.com
From: Camaleón on
On Wed, 28 Jul 2010 01:20:46 +0700, Sthu Deus wrote:

> How I can make best way the following:
>
> having 2 NICs in an OS (called eth0 and eth1, having iptables rules set
> accordingly) and exchanging one or two of them with (an)other(s) NIC(s),
> to make it be again (called eth0 and eth1, having iptables rules set
> accordingly) automatically.

(...)

Just guessing, but... how about changing/adjusting their udev names
matching their MAC address?

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

Once/if that file gets modified, take care for the rest of the involved
files (/etc/networking/interfaces) are pointing to the right devices.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/pan.2010.07.27.18.55.08(a)gmail.com
From: Sthu Deus on
Thank You for Your time and answer, Camaleón:

> Just guessing, but... how about changing/adjusting their udev names
> matching their MAC address?

In my view it is impossible (though correct me if I'm wrong here): I do
not know the MACs of the new NICs that will be installed as a
replacement for the existing ones.

> /etc/udev/rules.d/70-persistent-net.rules
>
> Once/if that file gets modified, take care for the rest of the
> involved files (/etc/networking/interfaces) are pointing to the right
> devices.

Is possible to be done somehow automatically (by the tools available
for Debian and not writing my own scripts)?


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4c51323d.487e0e0a.32a6.12d3(a)mx.google.com
From: Camaleón on
On Thu, 29 Jul 2010 14:06:24 +0700, Sthu Deus wrote:

> Thank You for Your time and answer, Camaleón:
>
>> Just guessing, but... how about changing/adjusting their udev names
>> matching their MAC address?
>
> In my view it is impossible (though correct me if I'm wrong here): I do
> not know the MACs of the new NICs that will be installed as a
> replacement for the existing ones.

I'm not following you here. You can:

1/ Write the rules _after_ plug-in the cards: they will get detected as
eth2 and eth3 then you only have to adjust the udev rules.

2/ Write the rules _before_ plug-in the cards: you can edit the udev
rules and create new ones by reading the MAC address of the adapters
which is printed (or "sticked") on the card.

Udev rules for network adapters are used to have persistent names for
uniquely identifying eth0, eth1, eth2, eth(n) with a physical device...
in the same manner that udev handles hard disks.

So, if your goal is to replace the current ethernet cards with a newer
ones and keep the iptables rules to match the older ("eth0", "eth1")
names -which will be pointing to the legacy/removed devices-, you just
need to update the rules so that the new adapters get the older names. I
know, it sounds a bit messy.

>> /etc/udev/rules.d/70-persistent-net.rules
>>
>> Once/if that file gets modified, take care for the rest of the involved
>> files (/etc/networking/interfaces) are pointing to the right devices.
>
> Is possible to be done somehow automatically (by the tools available for
> Debian and not writing my own scripts)?

Unless I'm wrong, I see no objection to edit "70-persistent-net.rules"
directly. Dunno if there is another "Debian-way" (manual or automatic)
for this :-?

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/pan.2010.07.29.08.13.26(a)gmail.com
From: Stephen Powell on
On Thu, 29 Jul 2010 03:06:24 -0400 (EDT), Sthu Deus wrote:
>
> Is possible to be done somehow automatically (by the tools available
> for Debian and not writing my own scripts)?

I haven't been following this thread; so I don't know what specific
problem you are trying to solve. But for me, the most common case
is that I have one network card which I need to replace and I want
it to have the interface name eth0, just like the original one. There
are no other network cards in the machine.

For that specific case, the easist solution is to simply erase (rm)
the /etc/udev/rules.d/70-persistent-net.rules file. Then shutdown,
swap network cards, and boot up. During boot, a new
/etc/udev/rules.d/70-persistent-net.rules file will be created, and
it will list the MAC address of the new card and assign it to eth0.

For machines with two network cards, it's not much more difficult.
Let's say that card1 is assigned to eth0 and card2 is assigned to
eth1. You want to replace one of them. Edit the file
/etc/udev/rules.d/70-persistent-net.rules and delete the line(s)
which describe the card you want to replace. Then shutdown,
swap cards, and boot up. During boot, a new line will be added to
/etc/udev/rules.d/70-persistent-net.rules which describes the new card,
and it will be assigned to the interface that was deleted. Make a
backup copy of the file somewhere else before editing or deleting it,
just in case, but the procedure I described will probably work just fine.

--
.''`. Stephen Powell
: :' :
`. `'`
`-


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/1083967198.30806.1280407377733.JavaMail.root(a)md01.wow.synacor.com