Junos devices can have more than one address on a single logical interface. When set the address there are 2 options can be used, primary and preferred. What is the difference between them and when we use the correct option ?
What is the difference between the option primary and preferred and when we use the correct option ?
The preferred option is used when you have multiple IP addresses belonging to the same subnet on the same interface. This option allows
you to select which address will be used as the source address for packets sent by the local system to hosts on the directly
connected subnet. By default, the numerically lowest local address is chosen. In the example on the slide, the default
behavior has been overridden with the preferred option making 172.19.102.2/24 the preferred address.
The primary address on an interface is the address that is used by default as the local address for broadcast and multicast
packets sourced locally and sent out the interface. The primary address flag also can be useful for selecting the local address
used for packets sent out unnumbered interfaces when multiple non-127 addresses are configured on the loopback
interface, lo0. By default, the primary address on an interface is selected as the numerically lowest local address configured
on the interface. In the example on the slide, 172.19.102.1/24 is the primary address for the ge-0/0/2.0 interface, because
it is the numerically lowest address configured on that interface; 192.168.200.1/32 is the primary address for the lo0.0
interfaces, because it has the primary option.