28.06.2014 Views

Discussion

Discussion

Discussion

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Solution<br />

Create a routing policy that load-balances traffic on a per-flow basis:<br />

[edit policy-options]<br />

aviva@router1# set policy-statement balance-traffic from route-filter 192.168.10.0/24<br />

orlonger<br />

aviva@router1# set policy-statement balance-traffic then load-balance per-packet<br />

Then apply the policy to the forwarding table:<br />

[edit routing-options]<br />

aviva@router1# set forwarding-table export balance-traffic<br />

<strong>Discussion</strong><br />

The routing protocols populate the routing table with the routes they know about<br />

and learn from their neighbors. For each prefix, or destination, RPD chooses one<br />

active route and installs its next hop into the forwarding table. If a route points to an<br />

indirect next hop, RPD downloads all the next hops of the indirect next hop, and the<br />

PFE selects a single next hop to use.<br />

When there are multiple paths to a single destination, the routing protocols install<br />

the next hops for each path into the routing table. The protocols do have some<br />

degree of freedom when populating the routing table. A protocol can opt to install<br />

multiple routes, each with the same next hop, a single route with multiple next hops,<br />

or even multiple routes with multiple next hops. BGP, for example, can use any of<br />

these variations depending on how many peers advertise a prefix, how those peers<br />

can be reached, and whether BGP multipath is enabled.<br />

When an active route has multiple equal-cost paths, the default behavior is for RPD<br />

to use a hash algorithm to choose a single gateway and install it into the forwarding<br />

table. If multiple prefixes have a common set of next hops, this gateway selection<br />

process should result in uniform distribution of prefixes across the next hops. For<br />

example, if prefixes A, B, C, and D all have gateways 1 and 2, RPD may install A and<br />

D with gateway 1 and Band C with gateway 2, so half the prefixes go through one<br />

link and half through the other.<br />

To instead have RPD install all the next hops for a prefix into the forwarding table,<br />

you turn on load balancing for that prefix. Load balancing distributes the traffic to<br />

the prefix across all the paths, evening out the traffic flow across different interfaces<br />

and circuits.<br />

Configuring load balancing is a two-step process. First, create a routing policy to<br />

define which packets to load-balance. In this recipe, the from clause matches the prefix<br />

192.168.10.0/24 and any longer prefixes. The then clause has the load-balance<br />

per-packet action to turn on load balancing:<br />

[edit policy-options]<br />

aviva@router1# set policy-statement load-balance then load-balance per-packet<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.<br />

Load-Balancing Traffic Flows | 271

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!