From mboxrd@z Thu Jan 1 00:00:00 1970 From: Akshat Kakkar Subject: Re: Unable to create ip alias on bridge interface Date: Tue, 29 May 2018 15:39:05 +0530 Message-ID: References: <20180528120540.64qrr3pcylboliew@unicorn.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: netdev To: Michal Kubecek Return-path: Received: from mail-pg0-f43.google.com ([74.125.83.43]:46670 "EHLO mail-pg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932698AbeE2KJG (ORCPT ); Tue, 29 May 2018 06:09:06 -0400 Received: by mail-pg0-f43.google.com with SMTP id a3-v6so6368028pgt.13 for ; Tue, 29 May 2018 03:09:06 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: For following commands, ip addr add 10.10.10.1/24 brd + dev br0 ip addr add 10.10.10.2/24 brd + dev br0 ip addr add 20.20.20.1/24 brd + dev br0 ip addr add 20.20.20.2/24 brd + dev br0 Both 10.10.10.1 and 20.20.20.1 becomes primary. Which one will be used as source IP? Is it nextHop of route that will decide? And what about communication in local subnet, say ping to 10.10.10.200 and 20.20.20.200? Will source for both will change according to destination IP? On Mon, May 28, 2018 at 11:50 PM, Akshat Kakkar wrote: > Thanks for clarifying that first ip will be used as primary ip. > I have 2 further queries on this. > 1. How can this survive across reboots without having a custom script > on boot up? Like some ifcfg file,etc. > 2. is there a way to tell to make a given ip as primary, irrespective of order? > > On Mon, May 28, 2018 at 5:35 PM, Michal Kubecek wrote: >> On Mon, May 28, 2018 at 02:35:41PM +0530, Akshat Kakkar wrote: >>> I am having a bridge named br0 having ports eno1 and eno2 as members. >>> I have given IP to br0 as 10.10.10.1/24 >>> >>> Now I want to create alias on br0 as br0:1 and give IP as >>> 10.10.10.2/24, but I am unable to. >>> >>> I know, we can add multiple IPs to br0 using "ip addr" command, but I >>> dont want to do it that way as I want all outgoing connections from >>> br0 to take src ip as 10.10.10.1. I know by providing option of "src" >>> in all routes, things can work but this looks more like a hack and >>> less of a solution. >> >> I don't understand. There are no actual aliases since kernel 2.2 and an >> attempt to add "br0:1 with address 10.10.10.2/24" using ifconfig should >> result in the same configuration as >> >> ip addr add 10.10.10.2/24 brd + label br0:1 dev br0 >> >> where the "label br0:1" part only adds a label which allows ifconfig to >> see the new address. >> >> As both addresses share the same range, you don't even have to worry >> about source address as primary address (10.10.10.1 - or first one added >> in general) will be used unless specified otherwise. >> >> Michal Kubecek