Posts for: #Junos

Junos Generated Routes

Topology

graph LR
net1(LAN1_172.17.99.0/24) 
net1 <--> R1
R1 <--> |WAN1_10.10.10.8/30|R4

Configuration and Interpretations

Desired outcome: I want to configure a generated route on R1 for the prefix 172.17.99.0. Currently, the prefix 172.17.99.0/24 is directly attached to ge-0/0/6. I want to make R1 advertise the generated route 172.17.96.0/19 toward its BGP neighbor R4 only when R1 receives the BGP route 10.22.1.0/26 from R4 (which is configured as an aggregate route on R4) and successfully imports it from BGP into inet.0. On R1, at the moment there is only one contributing route for the generated route, which is 17.17.99.0/24.

[Read]

Junos Aggregate Routes

Topology

graph LR
net1(LAN1_172.17.99.0/24) 
net1 <--> R1
R1 <--> |WAN1_10.10.10.8/30|R4

Configuration and Analysis

The default next hop of an aggregate route is reject:

root@R4> show configuration routing-options rib inet.0 aggregate 
defaults {
    preference 189;
}
route 10.22.1.0/26;

root@R4> 
root@R4> show route protocol aggregate 

inet.0: 15 destinations, 17 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.22.1.0/26       *[Aggregate/189] 00:00:58
                       Reject

inet6.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)

root@R4> 
root@R4> show route 10.22.1.0/26 exact detail 

inet.0: 15 destinations, 17 routes (15 active, 0 holddown, 0 hidden)
10.22.1.0/26 (1 entry, 1 announced)
        *Aggregate Preference: 189
                Next hop type: Reject, Next hop index: 0
                Address: 0x77c5434
                Next-hop reference count: 2
                Kernel Table Id: 0
                State: <Active Int Ext>
                Local AS:    22 
                Age: 7:22 
                Validation State: unverified 
                Task: Aggregate
                Announcement bits (2): 0-KRT 5-Resolve tree 3 
                AS path: I  (LocalAgg)
                Flags:                  Depth: 0        Active
                AS path list:
                AS path: I Refcount: 2
                Contributing Routes (2):
                        10.22.1.0/27 proto Direct
                        10.22.1.32/27 proto Static
                Thread: junos-main 

root@R4> 

#LessonLearned The contributing routes may be of different routing protocols or pseudoprotocols.

[Read]

Static Routing

Next Hop Values

On R2, verify that there is a BGP route to 1.1.1.1.

user1@R2>
user1@R2> show route 1.1.1.1

inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

1.1.1.1/32         *[BGP/170] 5d 13:58:29, localpref 100
                      AS path: 17 17 17 17 I, validation-state: unverified
                    >  to 10.10.10.1 via ge-0/0/1.0

On R1, configure static route to 10.22.1.32/27 with next-hop 10.10.10.2, preference 6. The ping from R1’s loopback to R2’s 10.22.1.34 interface must succeed. How RIB looks like, when a static route is configured with a next hop set to the IP address of the directly-attached host:

[Read]

BGP AS_PATH Prepend

Lab Data

BGP ASN topology

R1-AS17 <—> R2-AS22

R1-AS17 <—> R4-AS22

WAN Subnets

R1:.1 <- 10.10.10.0/30 -> R2: .2

R1:.9 <- 10.10.10.8/30 -> R4: .10

LAN Subnets

R1: .69 <- 172.17.99.0 -> LAN1

Purpose

When R1 advertises the network 172.17.99.0 in BGP, R2 and R4 receive the route with the default AS_PATH attribute value, which is the ASN of R1. I want to make the 172.17.99.0 route received by R2 and R4 a bit ‘unattractive’, by making R1 send it with a longer AS_PATH attribute value. Since the AS_PATH attribute is a BGP non-transitive attribute, this modification will only impact the AS that are immediate neighbors of R1’s AS.

[Read]

Troubleshooting Junos

Notes from a Juniper Junos troubleshooting course

Packets reaching the irb interface trigger a routing lookup.

When using vMX, typically in a lab, then there should be two VMs: one for the control plane and one for the forwarding plane, named something like vmx1-vcp and vmx1-vfp respectively.

When pinging the IP address of an aggregate Ethernet interface, the ICMP Echo Reply packets are duplicated:

lab@vEX> ping 172.16.200.2 count 3    
PING 172.16.200.2 (172.16.200.2): 56 data bytes
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.034 ms
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.209 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.251 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.295 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.346 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.387 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.418 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=0 ttl=63 time=3.448 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.641 ms
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.688 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.711 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.717 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.871 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.883 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.919 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=1 ttl=63 time=3.923 ms (DUP!)
64 bytes from 172.16.200.2: icmp_seq=2 ttl=63 time=2.626 ms

--- 172.16.200.2 ping statistics ---
3 packets transmitted, 3 packets received, +14 duplicates, 0% packet loss
round-trip min/avg/max/stddev = 2.626/3.492/3.923/0.343 ms

lab@vEX> 

The ‘hot swappable’ and ‘hot pluggable’ are chassis capabilities and are not the same.

[Read]

OSPF

OSPF in Junos

lab@vSRX> show configuration interfaces ge-0/0/2 
unit 0 {
    family inet {
        address 192.168.11.2/24;
    }
}

lab@vSRX> show configuration protocols ospf 
area 0.0.0.0 {
    interface ge-0/0/2.0;
}

lab@vSRX> 
lab@vSRX> show ospf interface 
Interface           State   Area            DR ID           BDR ID          Nbrs
ge-0/0/2.0          BDR     0.0.0.0         192.168.1.1     192.168.31.1       1

lab@vSRX> 
lab@vSRX> show ospf neighbor 
Address          Interface              State           ID               Pri  Dead
192.168.11.1     ge-0/0/2.0             Full            192.168.1.1      128    39

lab@vSRX>

lab@vSRX> show route protocol ospf  

inet.0: 24 destinations, 38 routes (24 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.1.1/32     *[OSPF/10] 01:58:32, metric 1
                    >  to 192.168.11.1 via ge-0/0/2.0
224.0.0.5/32       *[OSPF/10] 01:58:42, metric 1
                       MultiRecv

inet6.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)

lab@vSRX>
[Read]

Restricting SSH Remote Access to Selected Management Stations

Lab Data

Topology

Rocky-Linux <—> Oob-Router <–> R1

Subnets

Rocky-Linux: .21 <- 192.168.201.0/24 -> Oob-Router:.1 <- 172.17.81.0/24 -> R1:.42

Purpose

Connecting to R1 from a remote machine using SSH must be restricted to a list of management stations whith authorized IP addresses.

Sample Configuration

root@R1> show configuration policy-options prefix-list WassimRocky 
192.168.201.0/24;
root@R1> 
root@R1> show configuration firewall family inet filter Filter1 
term AllowRocky {
    from {
        source-prefix-list {
            WassimRocky;
        }
        destination-port ssh;
    }
    then accept;
}
term PreventOthersSSH {
    from {
        destination-port ssh;
    }
    then {
        count CountSSHdiscards;         
        discard;
    }
}
term AllowOthers {
    then accept;
}
root@R1> show configuration interfaces lo0 unit 0 
family inet {
    filter {
        input Filter1;
    }
    address 1.1.1.1/32;
}
[Read]