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