Hi, it seems that "ip address delete" will delete all addresses of the same class on an interface if it is ordered to only delete the first one: # ip a f eth0 # ip a l eth0 3: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether xx:xx:xx:xx:xx:xx # ip a a 192.168.a.b brd + dev eth0 # ip a a 192.168.c.d brd + dev eth0 # ip a d 192.168.a.b brd + dev eth0 # ip a l eth0 3: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether xx:xx:xx:xx:xx:xx I''m using kernel 2.6.13 and iproute2-050816. The man page seems to agree with me that this behaviour is wrong. If that behaviour is intended, please update the man page. Regards, Carl-Daniel -- http://www.hailfinger.org/
On Mon, 03 Oct 2005 19:55:09 +0200 Carl-Daniel Hailfinger <c-d.hailfinger.devel.2005@gmx.net> wrote:>Hi,hi>it seems that "ip address delete" will delete all addresses of the same >class on an interface if it is ordered to only delete the first one:Incidentally I encountered similar behavior with kernel 2.4 and older iproute (20010824 with some patches) a couple of weeks ago, so it''s nothing new.>Regards, >Carl-DanielYours sincerely, Peter -- http://www.shurdix.org - Linux distribution for routers and firewalls
Hi, Peter Surda schrieb:> On Mon, 03 Oct 2005 19:55:09 +0200 Carl-Daniel Hailfinger > <c-d.hailfinger.devel.2005@gmx.net> wrote: > > >>it seems that "ip address delete" will delete all addresses of the same >>class on an interface if it is ordered to only delete the first one: > > Incidentally I encountered similar behavior with kernel 2.4 and older iproute > (20010824 with some patches) a couple of weeks ago, so it''s nothing new.OK, I found out that this is documented behaviour, although the hint is not in the man page. "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." That means there is no way to change the IP of an interface if the prefix and network size stay the same. Are there any plans to fix that?> Yours sincerely, > PeterRegards, Carl-Daniel
On Tue, 4 Oct 2005, Carl-Daniel Hailfinger wrote:> OK, I found out that this is documented behaviour, although the hint is not > in the man page.If it''s not in the man page, then where is the below quote from?> "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." > > That means there is no way to change the IP of an interface if the prefix and > network size stay the same. Are there any plans to fix that?What''s wrong with delete followed by add? This thread started on netdev, so I''m cc-ing that, in case someone doesn''t read both lists. Alexey
Alexey Toptygin schrieb:> On Tue, 4 Oct 2005, Carl-Daniel Hailfinger wrote: > >> OK, I found out that this is documented behaviour, although the hint >> is not in the man page. > > If it''s not in the man page, then where is the below quote from?ip-cref.tex.>> "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." >> >> That means there is no way to change the IP of an interface if the >> prefix and network size stay the same. Are there any plans to fix that? > > What''s wrong with delete followed by add?You are logged into the machine via ssh on eth0. You delete the ip address of eth0. How are you going to add the new address to eth0 now that your connection is gone? Go to the server room and use the console? Normally, I would add the new IP to eth0, start another ssh to the new IP, log out from the session to the old IP, remove the old IP from eth0 and be done. If I want the server to be reachable under both IPs during a transition period, I can delay deletion of the old IP until later.> This thread started on netdev, so I''m cc-ing that, in case someone > doesn''t read both lists.Didn''t start there, but if netdev is interested, we can keep them in cc.> AlexeyRegards, Carl-Daniel
On Wed, 5 Oct 2005, Carl-Daniel Hailfinger wrote:>>> "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." >>> >>> That means there is no way to change the IP of an interface if the prefix >>> and network size stay the same. Are there any plans to fix that? >> >> What''s wrong with delete followed by add? > > You are logged into the machine via ssh on eth0. You delete the ip address of > eth0. How are you going to add the new address to eth0 now that your > connection is gone? Go to the server room and use the console? > > Normally, I would add the new IP to eth0, start another ssh to the new IP, > log out from the session to the old IP, remove the old IP from eth0 and be > done. If I want the server to be reachable under both IPs during a transition > period, I can delay deletion of the old IP until later.Then I guess the question is: does anything in common use depend on the old behavior? Alexey
On Wed, 05 Oct 2005 00:58:19 +0200 Carl-Daniel Hailfinger <c-d.hailfinger.devel.2005@gmx.net> wrote: via ssh on eth0. You delete the ip>address of eth0. How are you going to add the new address to eth0 now >that your connection is gone? Go to the server room and use the console?(btw exactly the thing that happened to me) but the solution is easy, put everything into one line: ip addr del blah1 dev eth0;ip addr add blah2 dev eth0;ip link set eth0 up ;-)>Regards, >Carl-DanielYours sincerely, Peter -- http://www.shurdix.org - Linux distribution for routers and firewalls
Current versions of iproute2 display the following: Warning: Executing wildcard deletion to stay compatible with old scripts. Explicitly specify the prefix length (192.168.a.b/32) to avoid this warning. This special behaviour is likely to disappear in further releases, fix your scripts!
jamal wrote:> On Tue, 2005-04-10 at 23:08 +0000, Alexey Toptygin wrote: > >>On Wed, 5 Oct 2005, Carl-Daniel Hailfinger wrote: > > [..] > >>>Normally, I would add the new IP to eth0, start another ssh to the new IP, >>>log out from the session to the old IP, remove the old IP from eth0 and be >>>done. If I want the server to be reachable under both IPs during a transition >>>period, I can delay deletion of the old IP until later. >> >>Then I guess the question is: does anything in common use depend on the >>old behavior? > > There''s a new feature in newer kernels which allows for an alias to be > upgraded to become primary when you delete the primary. You need to > configure the sysctl otherwise it defaults to purging all the > secondaries when you delete the primary.Thanks for that feature! Just looked at /proc/sys/net/ipv4/conf/*/promote_secondaries and it is the feature I was looking for. Merged in 2.6.12, if anyone reads this in a mail archive and wonders whether he has to upgrade. This leads to another question: Can I manually promote a secondary address to become primary without deleting the primary? This would help me to use the new address by default during the transition period.> What it sounds like is you need to have ssh run over SCTP instead of TCP > to allow multi-homing.Maybe, but I did not find any current openssh version with sctp support. And with promote_secondaries, my original problem is solved perfectly. Regards, Carl-Daniel -- http://www.hailfinger.org/