< Home

nexthop (OSPF)

Function

The nexthop command sets a preference for equal-cost routes. After OSPF calculates the equal-cost routes, the next hop is chosen from these equal-cost routes based on the value of weights. A smaller value indicates a higher preference.

The undo nexthop command cancels the preference of these equal-cost routes.

By default, the value of weight is 255. Equal-cost routes have no preference, and they forward packets at the same time. Load balancing is performed among them.

Format

nexthop ip-address weight value

undo nexthop ip-address

Parameters

Parameter Description Value
ip-address Indicates the IP address of the next hop. The value is in dotted decimal notation.
weight value Indicates the weight of the next hop. A smaller value indicates a higher preference. It is an integer that ranges from 1 to 254.

Views

OSPF view

Default Level

2: Configuration level

Usage Guidelines

You can run the nexthop command to set a high preference for specified valid routes if both of the following conditions are met:
  • The number of equal-cost routes on a network is larger than the value configured using the maximum load-balancing command.
  • Valid routes must be specified for load balancing.

Example

# Set a preference for equal-cost routes in OSPF.

<HUAWEI> system-view
[HUAWEI] ospf 1
[HUAWEI-ospf-1] nexthop 10.0.0.3 weight 1
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >