IPv4 and IPv6 Static Route Configuration in Juniper

Here’s a sample IPv4 and IPv6 Static Route Configuration in Juniper Routers

Configuration:

IPv4:

Route the block (1.1.1.0/24) to next hop  2.2.2.1 with metric 255

user@MX-re0>configure
#set routing-options static route 1.1.1.0/24 next-hop 2.2.2.1
#set routing-options static route 1.1.1.0/24 metric 255

Optional: Set comment using annotate command

#edit routing-options static
#annotate route  1.1.1.0/24  “/* STATIC ROUTE IPv4*/”

Commit
#commit

It will look something like this:

user@MX-re0>> show configuration routing-options static
/* STATIC ROUTE IPv4*/
route 1.1.1.0/24  {
    next-hop 2.2.2.1;
    metric 255;
IPv6:
Route the block (2000:2000:2000::/56 ) to next hop 2006:3006:1:234:5:6:78:90ab with metric 255
user@MX-re0>configure
#set routing-options rib inet6.0 static route 2000:2000:2000::/56 next-hop 2006:3006:1:234:5:6:78:90ab
#set routing-options rib inet6.0 static route 2000:2000:2000::/56  metric 255

Optional: Set comment using annotate command

#edit routing-options  rib inet6.0 static 
#annotate route  2000:2000:2000::/56 “/* STATIC ROUTE IPv6*/”

It will look something like this:

user@MX-re0> show configuration routing-options rib inet6.0

/*  STATIC ROUTE IPv6 */
route 2000:2000:2000::/56 {
next-hop 2006:3006:1:234:5:6:78:90ab;
metric 255;

Verification:

user@MX-re0> show route table inet.0 | match static
1.1.1.0/24     *[Static/5] 03:05:57, metric 255

user@MX-re0> show route table inet6.0 | match static
2000:2000:2000::/56*[Static/5] 00:59:37, metric 255

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *