preference (OSPF view)

Use preference to set a preference for OSPF.

Use undo preference to remove the configuration.

Syntax

preference [ ase ] { preference | route-policy route-policy-name } *

undo preference [ ase ]

Default

The preference is 10 for OSPF internal routes and 150 for OSPF external routes (ASE routes).

Views

OSPF view

Predefined user roles

network-admin

Parameters

ase: Specifies a preference for OSPF external routes. If you do not specify this keyword, the command sets a preference for OSPF internal routes.

preference: Specifies the preference value in the range of 1 to 255. A smaller value represents a higher preference.

route-policy route-policy-name: Specifies a routing policy by its name, a case-sensitive string of 1 to 63 characters, to set a preference for the specified routes.

Usage guidelines

If multiple routing protocols find routes to the same destination, the router uses the route found by the protocol with the highest preference.

When the route-policy route-policy-name option is specified, the following preferences take effect:

Examples

# Set a preference of 200 for OSPF external routes.

<Sysname> system-view
[Sysname] ospf 100
[Sysname-ospf-100] preference ase 200

# Set a preference of 100 for OSPF internal routes matching the specified routing policy, and set a preference of 150 for other routes.

<Sysname> system-view
[Sysname] ip prefix-list test index 10 permit 100.1.1.0 24
[Sysname] route-policy pre permit node 10
[Sysname-route-policy-pre-10] if-match ip address prefix-list test
[Sysname-route-policy-pre-10] apply preference 100
[Sysname-route-policy-pre-10] quit
[Sysname] ospf 100
[Sysname-ospf-100] preference route-policy pre 150