Configure Filter Based Load Balancing in Juniper SRXMustBeGeek
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek
There are various tricks to configure load balancing in JunOS devices. Filter based forwarding and per
flow load balancing methods are quite popular. These type of load balancing can be configured in many
Juniper devices like, MX series, J series, SRX series, etc. Here, I will show steps to configure filter based
load balancing in Juniper SRX device. In filter based forwarding, two routing tables are configured. Each
table will have different ISP as their primary gateway and remaining opposite ISP as secondary gateway.
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 1 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
At first, let’s create some routing tables. We need to create two routing tables. Routing tables are
configured under [edit routing-instances] hierarchy. We will create routing tables named ISPA and ISPB.
ImageKit.io
[edit routing-instances]
root@SRX# set ISPA instance-type forwarding
[edit routing-instances]
root@SRX# set ISPA routing-options static route 0.0.0.0/0 next-hop 1.1.1.1
[edit routing-instances]
root@SRX# set ISPA routing-options static route 0.0.0.0/0 qualified-next-hop 2.2.2.1 preference 7
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 2 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 3 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
}
}
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 4 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
}
}
}
RIB (Routing Information Base) group is created to share route information from master routing table to
other custom routing tables. For inet family, master routing table is inet.o. As of now, routing tables ISPA
and ISPB only knows the routes that have been configured while creating the routing instance. That is, the
default route only. We need to copy all the routes from inet.0 to ISPA and ISPB routing tables to make the
routing work properly. RIB group is configured under [edit routing-options] hierarchy.
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 5 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
[edit routing-options]
root@SRX# set rib-groups LOAD-BALANCE-RIB import-rib inet.0
[edit routing-options]
root@SRX# set rib-groups LOAD-BALANCE-RIB import-rib ISPA.inet.0
[edit routing-options]
root@SRX# set rib-groups LOAD-BALANCE-RIB import-rib ISPB.inet.0
[edit routing-options]
root@SRX# show
rib-groups {
LOAD-BALANCE-RIB {
import-rib [ inet.0 ISPA.inet.0 ISPB.inet.0 ];
}
}
You can verify the configuration by running traceroute from client PC in both network. You can also check
the routing tables. To view the routing tables, type
root@SRX> show route table ISPA.inet.0
ImageKit.io
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 6 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
Configure IP Configure High JunOS SRX High Configure Logging Configure Configure SRX
Monitoring in SRX Availability Cluster Availability in Juniper Firewall Dynamic (Remote Mode to Packet
Cluster in Juniper SRX Concepts Filter Access) VPN in Mode from Flow
Juniper SRX Mode
Bipin
Bipin is a freelance Network and System Engineer with expertise on Cisco, Juniper,
Microsoft, VMware, and other technologies. You can hire him on UpWork. Bipin enjoys
writing articles and tutorials related to Network technologies. Some of his certifications
are, MCSE:Messaging, JNCIP-SEC, JNCIS-ENT, and others.
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 7 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
ALSO ON MUSTBEGEEK
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 8 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
Sponsored
See How a $249 Amazon Investment Can Benefit You (Apply Today)
CPX
The New Jeep Grand Cherokee 2024 Is Utter Perfection - See The Prices
2024 Jeep Grand Cherokee
12 Comments 1 Login
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 9 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
Name
J
Joe McSparin − ⚑
8 years ago
Is the /lter based load balance recommended over the other way that uses the forwarding-
table?
0 0 Reply ⥅
B
binoy − ⚑
9 years ago
does this work with SRX cluster setup , has anyone checked the same .
0 0 Reply ⥅
Manjit Singh − ⚑
9 years ago
Hello,
0 0 Reply ⥅
Muko − ⚑
10 years ago
What is a way for both WAN interfaces to be able to reply to Ping requests from the
Internet?
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 10 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
Could it be a solution to use both the Filter Based forwarding and per Vow load balancing
(on your another article) on the same SRX box?
Best regards,
Muko
0 0 Reply ⥅
@Muko you can use virtual router instead, i did ran into the same kind of
situation couple of months ago. Refer to KB15545. @Bipin Giri your articles are
supposed to be rather responsive, not like some sorta
painting hanging on the wall put out on display. Try responding to visitors queries
every once in a while.
0 0 Reply ⥅
S
sven − ⚑
10 years ago
If I use the Firewall /lter as described, the /lter has only one "then" clause, the banace to
the Routing-instance. When this con/g is running, the pakets are'nt going through the srx.
but a /lter can only have one "then" clause. the example is not working.
as you wrote, I've to add the "then accept" clause, why isn't it part of the example, and how
can I add it.
thx
0 0 Reply ⥅
0 0 Reply ⥅
S
sven − ⚑
10 years ago
and, there is only one route table (inet.0). Im not able to command "show route table
ISPA.inet.0" , its not present :\
0 0 Reply ⥅
S
sven − ⚑
10 years ago
im getting ping answers from 1.1.1.1 and 2.2.2.1. but when I try to ping 8.8.8.8, the srx
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 11 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
im getting ping answers from 1.1.1.1 and 2.2.2.1. but when I try to ping 8.8.8.8, the srx
log/le (traceoptions) says: Destination lookup failed, no route to host :\
0 0 Reply ⥅
S
sven − ⚑
10 years ago
if i'm not adding "accept" into the /rewall /lter "then" clause, no tra`c is passing.
is this my fault?
0 0 Reply ⥅
Yes, because you have to add then clause with accept keyword in /rewall /lter to
allow tra`c. Because /lters have implicit deny which means if you don't
con/gure /lters to accept tra`c it will deny. By the way to be speci/c about your
problem, can you paste your /lter here?
0 0 Reply ⥅
J
Johnny Wahlen > Bipin Giri
− ⚑
9 years ago edited
Any example how to do this? This is crucial for inbound NAT to have the
routing instance but without accept it stops working. I do have a term
right after with then accept on it. Here is one of the /lters:
term For-ISP2{
from {
source-address {
1.1.1.1/29;
}
}
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 12 of 13
Configure Filter Based Load Balancing in Juniper SRXMustBeGeek 11/06/24, 8:02 AM
https://www.mustbegeek.com/configure-filter-based-load-balancing-in-juniper-srx/ Page 13 of 13