* Unable to create ip alias on bridge interface
@ 2018-05-28 9:05 Akshat Kakkar
2018-05-28 12:05 ` Michal Kubecek
0 siblings, 1 reply; 7+ messages in thread
From: Akshat Kakkar @ 2018-05-28 9:05 UTC (permalink / raw)
To: netdev
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.
Coming back to my original issue, I keep getting error "add bridge
failed: Invalid argument".
So, whats the best way out?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unable to create ip alias on bridge interface
2018-05-28 9:05 Unable to create ip alias on bridge interface Akshat Kakkar
@ 2018-05-28 12:05 ` Michal Kubecek
2018-05-28 18:20 ` Akshat Kakkar
0 siblings, 1 reply; 7+ messages in thread
From: Michal Kubecek @ 2018-05-28 12:05 UTC (permalink / raw)
To: Akshat Kakkar; +Cc: netdev
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unable to create ip alias on bridge interface
2018-05-28 12:05 ` Michal Kubecek
@ 2018-05-28 18:20 ` Akshat Kakkar
2018-05-29 9:32 ` Michal Kubecek
2018-05-29 10:09 ` Akshat Kakkar
0 siblings, 2 replies; 7+ messages in thread
From: Akshat Kakkar @ 2018-05-28 18:20 UTC (permalink / raw)
To: Michal Kubecek; +Cc: netdev
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 <mkubecek@suse.cz> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unable to create ip alias on bridge interface
2018-05-28 18:20 ` Akshat Kakkar
@ 2018-05-29 9:32 ` Michal Kubecek
2018-05-29 10:09 ` Akshat Kakkar
1 sibling, 0 replies; 7+ messages in thread
From: Michal Kubecek @ 2018-05-29 9:32 UTC (permalink / raw)
To: netdev; +Cc: Akshat Kakkar
On Mon, May 28, 2018 at 11:50:05PM +0530, Akshat Kakkar wrote:
> 1. How can this survive across reboots without having a custom script
> on boot up? Like some ifcfg file,etc.
Every reasonable distribution should provide a way to use more than one
address on an interface. But as there is no universal standard for
config files and their format, there is no universal standard for
listing multiple addresses either. You have to check the documentation
of your distribution.
> 2. is there a way to tell to make a given ip as primary, irrespective
> of order?
AFAIK there is no interface allowing to switch the primary address. It
only changes when you delete primary address and have promote_secondaries
enabled for the interface.
Also, don't forget that this primary/secondary distinction is only done
for addresses with the same range (which would create the same automatic
route), i.e. e.g. 10.0.1.42/24 and 10.0.1.43/24 but not if it's e.g.
10.0.1.42/24 and 10.0.2.42/24.
Michal Kubecek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unable to create ip alias on bridge interface
2018-05-28 18:20 ` Akshat Kakkar
2018-05-29 9:32 ` Michal Kubecek
@ 2018-05-29 10:09 ` Akshat Kakkar
2018-05-29 10:29 ` Michal Kubecek
1 sibling, 1 reply; 7+ messages in thread
From: Akshat Kakkar @ 2018-05-29 10:09 UTC (permalink / raw)
To: Michal Kubecek; +Cc: netdev
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 <akshat.1984@gmail.com> 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 <mkubecek@suse.cz> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unable to create ip alias on bridge interface
2018-05-29 10:09 ` Akshat Kakkar
@ 2018-05-29 10:29 ` Michal Kubecek
2018-05-29 10:41 ` Akshat Kakkar
0 siblings, 1 reply; 7+ messages in thread
From: Michal Kubecek @ 2018-05-29 10:29 UTC (permalink / raw)
To: netdev; +Cc: Akshat Kakkar
On Tue, May 29, 2018 at 03:39:05PM +0530, Akshat Kakkar wrote:
> 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?
Unless you have an unusual routing setup, yes. When unsure, you can use
"ip route get ..." which should tell you which route and which source
address will be used.
> 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?
This is the same. Under "normal" circumstances, 10.10.10.1 will be used
for targets from 10.10.10.0/24 and 20.20.20.1 for targets from
20.20.20.0/24.
Michal Kubecek
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Unable to create ip alias on bridge interface
2018-05-29 10:29 ` Michal Kubecek
@ 2018-05-29 10:41 ` Akshat Kakkar
0 siblings, 0 replies; 7+ messages in thread
From: Akshat Kakkar @ 2018-05-29 10:41 UTC (permalink / raw)
To: Michal Kubecek; +Cc: netdev
Thanks.
Thanks a lot for clarifying all this.
On Tue, May 29, 2018 at 3:59 PM, Michal Kubecek <mkubecek@suse.cz> wrote:
> On Tue, May 29, 2018 at 03:39:05PM +0530, Akshat Kakkar wrote:
>> 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?
>
> Unless you have an unusual routing setup, yes. When unsure, you can use
> "ip route get ..." which should tell you which route and which source
> address will be used.
>
>> 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?
>
> This is the same. Under "normal" circumstances, 10.10.10.1 will be used
> for targets from 10.10.10.0/24 and 20.20.20.1 for targets from
> 20.20.20.0/24.
>
> Michal Kubecek
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-29 10:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 9:05 Unable to create ip alias on bridge interface Akshat Kakkar
2018-05-28 12:05 ` Michal Kubecek
2018-05-28 18:20 ` Akshat Kakkar
2018-05-29 9:32 ` Michal Kubecek
2018-05-29 10:09 ` Akshat Kakkar
2018-05-29 10:29 ` Michal Kubecek
2018-05-29 10:41 ` Akshat Kakkar
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).