* iproute2: removing primary address removes secondaries
@ 2008-01-11 16:31 martin f krafft
2008-01-11 17:13 ` Daniel Lezcano
2008-01-12 1:59 ` iproute2: removing primary address removes secondaries David Miller
0 siblings, 2 replies; 6+ messages in thread
From: martin f krafft @ 2008-01-11 16:31 UTC (permalink / raw)
To: netdev discussion list
[-- Attachment #1: Type: text/plain, Size: 2579 bytes --]
Dear list,
When I add an address to an interface whose network prefix is the
same as that of an address already bound to the interface, the new
address becomes a secondary address. As per
http://www.policyrouting.org/iproute2.doc.html:
"secondary --- this address is not used when selecting the default
source address for outgoing packets. An IP address becomes
secondary if another address within the same prefix (network)
already exists. The first address within the prefix is primary and
is the tag address for the group of all the secondary addresses.
When the primary address is deleted all of the secondaries are
purged too."
In the following, I want to argue that this is not necessary.
I think that removal of a primary address should cause the next
address to be promoted to be the default source address and the
link-scoped route to be retained. This is basically out of
http://bugs.debian.org/429689, the maintainer asked me to turn
directly to this list.
If I add an address to a device with 'ip add', ip also implicitly
adds a link-scoped route according to the netmask. It only does this
for primary addresses, so if I add a second address within the same
network, the route is not duplicated.
Thus, the net effect on the routing table is the same for the
following two commands:
ip a a 172.16.0.100/12 dev eth0 && ip a a 172.16.0.200/12 dev eth0
ip a a 172.16.0.100/12 dev eth0 && ip a a 172.16.0.200/32 dev eth0
^^^^
In the first case, the .200 address becomes a secondary of the .100
address. In the second case, they are both primaries. In both cases,
only one /12 link-scoped route will be created.
However, in both cases, if I remove the .100 address, the .200 is
affected: if it's secondary, it ceases to exist, and if it's
primary (i.e. in the /32 case), then the host can no longer use it
to communicate to hosts in the same link segment, only to hosts on
the other side of the default gateway.
I thus question the point of purging secondary addresses. Obviously,
only one address can be primary (it is used as source address for
packets leaving the machine by the respective route). But if the
primary address is removed, the next secondary should be promoted
and the route should *not* be deleted.
Comments?
Cheers,
--
martin | http://madduck.net/ | http://two.sentenc.es/
microsoft: for when quality, reliability, and security
just aren't that important!
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iproute2: removing primary address removes secondaries
2008-01-11 16:31 iproute2: removing primary address removes secondaries martin f krafft
@ 2008-01-11 17:13 ` Daniel Lezcano
2008-01-11 17:26 ` why does promote_secondaries default to off? (was: iproute2: removing primary address removes secondaries) martin f krafft
2008-01-12 1:59 ` iproute2: removing primary address removes secondaries David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2008-01-11 17:13 UTC (permalink / raw)
To: netdev discussion list
martin f krafft wrote:
> Dear list,
>
> When I add an address to an interface whose network prefix is the
> same as that of an address already bound to the interface, the new
> address becomes a secondary address. As per
> http://www.policyrouting.org/iproute2.doc.html:
>
> "secondary --- this address is not used when selecting the default
> source address for outgoing packets. An IP address becomes
> secondary if another address within the same prefix (network)
> already exists. The first address within the prefix is primary and
> is the tag address for the group of all the secondary addresses.
> When the primary address is deleted all of the secondaries are
> purged too."
>
> In the following, I want to argue that this is not necessary.
> I think that removal of a primary address should cause the next
> address to be promoted to be the default source address and the
> link-scoped route to be retained. This is basically out of
> http://bugs.debian.org/429689, the maintainer asked me to turn
> directly to this list.
>
> If I add an address to a device with 'ip add', ip also implicitly
> adds a link-scoped route according to the netmask. It only does this
> for primary addresses, so if I add a second address within the same
> network, the route is not duplicated.
>
> Thus, the net effect on the routing table is the same for the
> following two commands:
>
> ip a a 172.16.0.100/12 dev eth0 && ip a a 172.16.0.200/12 dev eth0
> ip a a 172.16.0.100/12 dev eth0 && ip a a 172.16.0.200/32 dev eth0
> ^^^^
> In the first case, the .200 address becomes a secondary of the .100
> address. In the second case, they are both primaries. In both cases,
> only one /12 link-scoped route will be created.
>
> However, in both cases, if I remove the .100 address, the .200 is
> affected: if it's secondary, it ceases to exist, and if it's
> primary (i.e. in the /32 case), then the host can no longer use it
> to communicate to hosts in the same link segment, only to hosts on
> the other side of the default gateway.
>
> I thus question the point of purging secondary addresses. Obviously,
> only one address can be primary (it is used as source address for
> packets leaving the machine by the respective route). But if the
> primary address is removed, the next secondary should be promoted
> and the route should *not* be deleted.
>
> Comments?
>
> Cheers,
There is a tweak in /proc/sys which activate secondaries promotion when
a primary is deleted.
/proc/sys/net/ipv4/conf/all/promote_secondaries
I think it changes the behavior to the one you wish.
Regards
^ permalink raw reply [flat|nested] 6+ messages in thread
* why does promote_secondaries default to off? (was: iproute2: removing primary address removes secondaries)
2008-01-11 17:13 ` Daniel Lezcano
@ 2008-01-11 17:26 ` martin f krafft
2008-01-11 17:33 ` why does promote_secondaries default to off? Daniel Lezcano
0 siblings, 1 reply; 6+ messages in thread
From: martin f krafft @ 2008-01-11 17:26 UTC (permalink / raw)
To: netdev discussion list
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
also sprach Daniel Lezcano <dlezcano@fr.ibm.com> [2008.01.11.1813 +0100]:
> There is a tweak in /proc/sys which activate secondaries promotion when a
> primary is deleted.
>
> /proc/sys/net/ipv4/conf/all/promote_secondaries
>
> I think it changes the behavior to the one you wish.
Totally. That would have been the last place I had looked.
Thank you!
Do you have any idea why this isn't on by default?
--
martin | http://madduck.net/ | http://two.sentenc.es/
"i never go without my dinner. no one ever does, except vegetarians
and people like that."
-- oscar wilde
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: why does promote_secondaries default to off?
2008-01-11 17:26 ` why does promote_secondaries default to off? (was: iproute2: removing primary address removes secondaries) martin f krafft
@ 2008-01-11 17:33 ` Daniel Lezcano
2008-01-11 17:43 ` martin f krafft
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2008-01-11 17:33 UTC (permalink / raw)
To: netdev discussion list
martin f krafft wrote:
> also sprach Daniel Lezcano <dlezcano@fr.ibm.com> [2008.01.11.1813 +0100]:
>> There is a tweak in /proc/sys which activate secondaries promotion when a
>> primary is deleted.
>>
>> /proc/sys/net/ipv4/conf/all/promote_secondaries
>>
>> I think it changes the behavior to the one you wish.
>
> Totally. That would have been the last place I had looked.
> Thank you!
>
> Do you have any idea why this isn't on by default?
This tweak is "recent" (2.6.16 as far as I remember), so I suppose the
reason is to not puzzled people with a changed default behavior.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: why does promote_secondaries default to off?
2008-01-11 17:33 ` why does promote_secondaries default to off? Daniel Lezcano
@ 2008-01-11 17:43 ` martin f krafft
0 siblings, 0 replies; 6+ messages in thread
From: martin f krafft @ 2008-01-11 17:43 UTC (permalink / raw)
To: netdev discussion list
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
also sprach Daniel Lezcano <dlezcano@fr.ibm.com> [2008.01.11.1833 +0100]:
> This tweak is "recent" (2.6.16 as far as I remember), so I suppose
> the reason is to not puzzled people with a changed default
> behavior.
Your instant and helpful responses are most appreciated!
--
martin | http://madduck.net/ | http://two.sentenc.es/
a common mistake that people make
when trying to design something completely foolproof
was to underestimate the ingenuity of complete fools.
-- douglas adams, "mostly harmless"
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: iproute2: removing primary address removes secondaries
2008-01-11 16:31 iproute2: removing primary address removes secondaries martin f krafft
2008-01-11 17:13 ` Daniel Lezcano
@ 2008-01-12 1:59 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2008-01-12 1:59 UTC (permalink / raw)
To: madduck; +Cc: netdev
echo "1" >/proc/sys/net/ipv4/conf/all/promote_secondaries
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-01-12 1:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11 16:31 iproute2: removing primary address removes secondaries martin f krafft
2008-01-11 17:13 ` Daniel Lezcano
2008-01-11 17:26 ` why does promote_secondaries default to off? (was: iproute2: removing primary address removes secondaries) martin f krafft
2008-01-11 17:33 ` why does promote_secondaries default to off? Daniel Lezcano
2008-01-11 17:43 ` martin f krafft
2008-01-12 1:59 ` iproute2: removing primary address removes secondaries David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).