Configuring Default, Primary, and Preferred Addresses and Interfaces
The router has a default address and a primary interface, and interfaces have primary and preferred addresses.
The default address of the router is used as the source address on unnumbered interfaces. The routing protocol process tries to pick the default address as the router ID, which is used by protocols, including OSPF and internal BGP (IBGP).
The primary interface for the router is the interface that packets go out when no interface name is specified and when the destination address does not imply a particular outgoing interface.
An interface’s primary address is used by default as the local address for broadcast and multicast packets sourced locally and sent out the interface. An interface’s preferred address is the default local address used for packets sourced by the local router to destinations on the subnet.
The default address of the router is chosen using the following sequence:
- The primary address on the loopback interface lo0 that is not 127.0.0.1 is used.
- The primary address on the primary interface is used.
To configure these addresses and interfaces, you can do the following:
Configuring the Primary Interface for the Router
The primary interface for the router has the following characteristics:
- It is the interface that packets go out when you type a command such as ping 255.255.255.255—that is, a command that does not include an interface name (there is no interface type-0/0/0.0 qualifier) and where the destination address does not imply any particular outgoing interface.
- It is the interface on which multicast applications running locally on the router, such as Session Announcement Protocol (SAP), do group joins by default.
- It is the interface from which the default local address is derived for packets sourced out an unnumbered interface if there are no non-127 addresses configured on the loopback interface, lo0.
By default, the multicast-capable interface with the lowest-index address is chosen as the primary interface. If there is no such interface, the point-to-point interface with the lowest index address is chosen. Otherwise, any interface with an address could be picked. In practice, this means that, on the router, the fxp0 or em0 interface is picked by default.
To configure a different interface to be the primary interface, include the primary statement:
You can include this statement at the following hierarchy levels:
- [edit interfaces interface-name unit logical-unit-number family family]
- [edit logical-systems logical-system-name interfaces interface-name unit logical-unit-number family family]
Configuring the Primary Address for an Interface
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. For example, the local address in the packets sent by a ping interface so-0/0/0.0 255.255.255.255 command is the primary address on interface so-0/0/0.0. 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.
To set a different primary address, include the primary statement:
You can include this statement at the following hierarchy levels:
- [edit interfaces interface-name unit logical-unit-number family family address address]
- [edit logical-systems logical-system-name interfaces interface-name unit logical-unit-number family family address address]
Configuring the Preferred Address for an Interface
The preferred address on an interface is the default local address used for packets sourced by the local router to destinations on the subnet. By default, the numerically lowest local address is chosen. For example, if the addresses 172.16.1.1/12, 172.16.1.2/12, and 172.16.1.3/12 are configured on the same interface, the preferred address on the subnet (by default, 172.16.1.1) would be used as a local address when you issue a ping 172.16.1.5 command.
To set a different preferred address for the subnet, include the preferred statement:
You can include this statement at the following hierarchy levels:
- [edit interfaces interface-name unit logical-unit-number family family address address]
- [edit logical-systems logical-system-name interfaces interface-name unit logical-unit-number family family address address]