Hi,
If you want a good example like on what you are asking.
Here is a good example of it:
You can find this here:
http://www.juniper.net/techpubs/en_US/junos12.1/topics/topic-map/policy-static-route-selection.html
Overview
In this example, the static route 192.168.47.0/24 has two possible next hops. Because one link has higher bandwidth, this link is the preferred path. To enforce this preference, the qualified-next-hop statement is included in the configuration on both devices. See Figure 1.
Figure 1: Controlling Static Route Selection
Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device B
set interfaces ge-1/2/0 unit 0 description B->Dset interfaces ge-1/2/0 unit 0 family inet address 172.16.1.1/24set interfaces fe-1/2/1 unit 2 description secondary-B->Dset interfaces fe-1/2/1 unit 2 family inet address 192.168.2.1/24set interfaces lo0 unit 57 family inet address 10.0.0.1/32set interfaces lo0 unit 57 family inet address 10.0.0.2/32set routing-options static route 192.168.47.0/24 next-hop 172.16.1.2set routing-options static route 192.168.47.0/24 qualified-next-hop 192.168.2.2 preference 25
Device D
set interfaces ge-1/2/0 unit 1 description D->Bset interfaces ge-1/2/0 unit 1 family inet address 172.16.1.2/24set interfaces fe-1/2/1 unit 3 description secondary-D->Bset interfaces fe-1/2/1 unit 3 family inet address 192.168.2.2/24set interfaces lo0 unit 2 family inet address 192.168.47.5/32set interfaces lo0 unit 2 family inet address 192.168.47.6/32set routing-options static route 0.0.0.0/0 next-hop 172.16.1.1set routing-options static route 0.0.0.0/0 qualified-next-hop 192.168.2.1 preference 25
Step-by-Step Procedure
- On Device B, configure the interfaces.
[edit interfaces]user@B# set ge-1/2/0 unit 0 description B->Duser@B# set ge-1/2/0 unit 0 family inet address 172.16.1.1/24user@B# set fe-1/2/1 unit 2 description secondary-B->Duser@B# set fe-1/2/1 unit 2 family inet address 192.168.2.1/24user@B# set lo0 unit 57 family inet address 10.0.0.1/32user@B# set lo0 unit 57 family inet address 10.0.0.2/32
- On Device B, configure a static route to the customer network.
[edit routing-options static route 192.168.47.0/24]user@B# set next-hop 172.16.1.2
- On Device B, configure a backup route to the customer network.
[edit routing options static route 192.168.47.0/24]user@B# set qualified-next-hop 192.168.2.2 preference 25
- On Device D, configure the interfaces.
[edit interfaces]user@D# set ge-1/2/0 unit 1 description D->Buser@D# set ge-1/2/0 unit 1 family inet address 172.16.1.2/24user@D# set fe-1/2/1 unit 3 description secondary-D->Buser@D# set fe-1/2/1 unit 3 family inet address 192.168.2.2/24user@D# set lo0 unit 2 family inet address 192.168.47.5/32user@D# set lo0 unit 2 family inet address 192.168.47.6/32
- On Device D, configure a static default route to external networks.
[edit routing options static route 0.0.0.0/0]user@D# set next-hop 172.16.1.1
- On Device D, configure a backup static default route to external networks.
[edit routing options static route 0.0.0.0/0]user@D# set qualified-next-hop 192.168.2.1 preference 25
Results
Confirm your configuration by issuing the show interfaces and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
user@B# show interfacesge-1/2/0 {unit 0 {description B->D;family inet {address 172.16.1.1/24;}}}fe-1/2/1 {unit 2 {description secondary-B->D;family inet {address 192.168.2.1/24;}}}lo0 {unit 57 {family inet {address 10.0.0.1/32;address 10.0.0.2/32;}}}
user@B# show routing-optionsstatic {route 192.168.47.0/24 {next-hop 172.16.1.2;qualified-next-hop 192.168.2.2 {preference 25;}}}
user@D# show interfacesge-1/2/0 {unit 1 {description D->B;family inet {address 172.16.1.2/24;}}}fe-1/2/1 {unit 3 {description secondary-D->B;family inet {address 192.168.2.2/24;}}}lo0 {unit 2 {family inet {address 192.168.47.5/32;address 192.168.47.6/32;}}}
user@D# show routing-optionsstatic {route 0.0.0.0/0 {next-hop 172.16.1.1;qualified-next-hop 192.168.2.1 {preference 25;}}}
If you are done configuring the devices, enter commit from configuration mode on both devices.
Verification
Confirm that the configuration is working properly.
Checking the Routing Tables
Purpose
Make sure that the static routes appear in the routing tables of Device B and Device D.
Action
user@B> show route protocol static
inet.0: 7 destinations, 8 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
192.168.47.0/24 *[Static/5] 02:02:03
> to 172.16.1.2 via ge-1/2/0.0
[Static/25] 01:58:21
> to 192.168.2.2 via fe-1/2/1.2
user@D> show route protocol static
inet.0: 7 destinations, 8 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 02:02:12
> to 172.16.1.1 via ge-1/2/0.1
[Static/25] 01:58:31
> to 192.168.2.1 via fe-1/2/1.3