O'Reilly logo

JUNOS Cookbook by Aviva Garrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.10. Choosing Primary and Preferred Interface Addresses

Problem

You have an Ethernet or other point-to-multipoint interface and have to set up multiple addresses on the interface—for example, so you can treat class of service for each flow differently—but you need to always use one of the addresses first.

Solution

Use the following commands to pick one address to always be the source address for traffic on the same subnet:

	[edit interfaces fe-0/0/0]
	aviva@router1# set unit 0 family inet address 192.168.220.1/24
	aviva@router1# set unit 0 family inet address 192.168.220.2/24  
preferred

Use the following commands to choose one address that is used as the source address in broadcast and unnumbered traffic sent out an interface:

	[edit interfaces fe-0/0/1]
	aviva@router1# set unit 0 family inet address 192.168.220.1/24
	aviva@router1# set unit 0 family inet address 192.168.220.2/24  
primary

Discussion

Each JUNOS interface has a preferred address, which is the default local address used when there is more than one address in the same subnet on the same interface. Each JUNOS interface also has a primary address, which is used by default as the source address when you originate packets out the interface where the destination gives no hint about the subnet. By default, the software chooses the numerically lowest address as the preferred and primary address. The show interfaces command output indicates which addresses are the preferred and primary:

	aviva@router1> show interfaces fe-0/0/0.0 Logical ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required