Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

set ip next-hop options

I found a lot of references to this command but they all seem to be lacking details of how this command actually works.  For instance, what would be the difference between these two route-maps:

route-map One

set ip next-hop 1.1.1.1 2.2.2.2

vs.

route-map Two

set ip next-hop 1.1.1.1

set ip next-hop 2.2.2.2

   

Rgds,

Diego              

7 REPLIES
New Member

set ip next-hop options

Refer to below link:

http://www.cisco.com/en/US/docs/ios/12_0s/feature/guide/12s_pbr.html#wp1053101

"If the interface associated with the first next hop specified with the set ip next-hop command is down, the optionally specified IP addresses are tried in turn."

So 2.2.2.2 from route-map One will only be used when 1.1.1.1 is not adjacent to the router.

For route-map Two, as stated in CCNP text book, the router evaluates all set commands in the order they are presented. And as soon as address or interface has been chosen, other set commands are ignored.

So basically two route-maps work the same.

Re: set ip next-hop options

Hi Diego,

nice question! I'm not quite sure with the second example, I'd like to do some testing with gns3 later on.

In the first example, 1.1.1.1 will be set as the next-hop if an approriate entry exists in the routing table. If not, the same check is done for 2.2.2.2; if doesn't have a routing table entry neither, the packets are forwarded according to the routing table.

I think in the second example, only 1.1.1.1 will be evaluated. There is a preference rule for different set actions:

1. set ip next-hop

2. set interface

3. set ip default next-hop

4. set default interface

Subsequent set actions of the same type should be ignored (I guess).

Hope that helps

Rolf

Re: set ip next-hop options

I should have tested before replying:

R1(config)#route-map blah

R1(config-route-map)#set ip next-hop 1.1.1.1

R1(config-route-map)#set ip next-hop 2.2.2.2

R1(config-route-map)#do show route-map

route-map blah, permit, sequence 10

Match clauses:

Set clauses:

ip next-hop 1.1.1.1 2.2.2.2

Policy routing matches: 0 packets, 0 bytes

R1(config-route-map)#do show run | s ^route-map

route-map blah permit 10

set ip next-hop 1.1.1.1 2.2.2.2

So IOS is smart enough to do the right thing.

Purple

set ip next-hop options

Hi,

Yes IOS does this,transform a AND condition to a OR condition when the set or match commands are for same parameters if I reckon correctly.

Regards

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.
New Member

set ip next-hop options

OK, so now we know that it doesn't matter if you setup two IPs on one line or two lines with one IP each.  But there is still something else that is a bit confusing.

Thomas points out that as per Cisco documentation:

"If the interface associated with the first next hop specified with the set ip next-hop command is down, the optionally specified IP addresses are tried in turn."

but I have seen other documentation that state that the decision to use the IP in the next-hop command is determined by the IP existing in the routing table or not.  See this doc or example:

http://www.cisco.com/en/US/tech/tk364/technologies_configuration_example09186a00801f3b54.shtml

The set ip next-hop command verifies the existence of the next hop specified, and:

if the next hop exists in the routing table, then the command policy routes the packet to the next hop.

if the next hop does not exist in the routing table, the command uses the normal routing table to forward the packet.

I don't mind testing a bit but my fear is that maybe this changes according to IOS version.  In which case it would be a mess to find out which IOS checks interface and which IOS checks routing table.

Rgds,

Diego

Purple

set ip next-hop options

Hi,

the doc you referenced is about the difference between set ip default next-hop and set ip next-hop:

-set ip default next-hop will take effect if there is not a specific route to destination(it's the same as a default route in the RIB) whereas set ip next-hop will always take effect provided the next-hop is directly connected and can be recursed to an outgoing interface and that even if there is a specific route in RIB for this destination.

Regards

Alain

Don't forget to rate helpful posts.

Don't forget to rate helpful posts.
New Member

set ip next-hop options

Thanks Alain,  I think I get it. 

Rgds,

Diego

586
Views
29
Helpful
7
Replies
CreatePlease to create content