Monday, January 23, 2012

Virtual Network on a Single Junos Router SRX210


I wanted to do a simple tutorial for creating a full network on a single Juniper router, and after having a colleague asking about it, I decided it was time.

We’re going to build this topology, with OSPF routing, on a single SRX210 running packet-mode Junos:
Let’s start with R1. First, configure the interfaces for R1. Note the use of the peer-unit line that specifies which lt-0/0/0 unit this interface will connect to. Here we’re using units 0 and 5, as per the diagram. We also configure the lo0.1 interface.
set interfaces lt-0/0/0 unit 0 family inet address 10.0.0.1/30
set interfaces lt-0/0/0 unit 0 peer-unit 1
set interfaces lt-0/0/0 unit 0 encapsulation ethernet
set interfaces lt-0/0/0 unit 5 family inet address 10.0.0.10/30
set interfaces lt-0/0/0 unit 5 peer-unit 4
set interfaces lt-0/0/0 unit 5 encapsulation ethernet
set interfaces lo0 unit 1 family inet address 1.1.1.1/32
Next we configure the virtual-router, along with the logical-tunnel interface’s units 0 and 5. We’ll also include lo0.1:
set routing-instances R1 instance-type virtual-router
set routing-instances R1 interface lt-0/0/0.0
set routing-instances R1 interface lt-0/0/0.5
set routing-instances R1 interface lo0.1
Repeat the steps for R2 and R3, following the diagram:
set interfaces lt-0/0/0 unit 1 family inet address 10.0.0.2/30
set interfaces lt-0/0/0 unit 1 peer-unit 0
set interfaces lt-0/0/0 unit 1 encapsulation ethernet
set interfaces lt-0/0/0 unit 2 family inet address 10.0.0.5/30
set interfaces lt-0/0/0 unit 2 peer-unit 3
set interfaces lt-0/0/0 unit 2 encapsulation ethernet
set interfaces lo0 unit 2 family inet address 2.2.2.2/32
set routing-instances R2 instance-type virtual-router
set routing-instances R2 interface lt-0/0/0.1
set routing-instances R2 interface lt-0/0/0.2
set routing-instances R2 interface lo0.2

set interfaces lt-0/0/0 unit 3 family inet address 10.0.0.6/30
set interfaces lt-0/0/0 unit 3 peer-unit 2
set interfaces lt-0/0/0 unit 3 encapsulation ethernet
set interfaces lt-0/0/0 unit 4 family inet address 10.0.0.9/30
set interfaces lt-0/0/0 unit 4 peer-unit 5
set interfaces lt-0/0/0 unit 4 encapsulation ethernet
set interfaces lo0 unit 3 family inet address 3.3.3.3/32
set routing-instances R3 instance-type virtual-router
set routing-instances R3 interface lt-0/0/0.3
set routing-instances R3 interface lt-0/0/0.4
set routing-instances R3 interface lo0.3
After we do this, we issue the commit command.
Let’s check our interfaces:
[email protected]> show interfaces terse | match lt-
lt-0/0/0 up up
lt-0/0/0.0 up up inet 10.0.0.1/30
lt-0/0/0.1 up up inet 10.0.0.2/30
lt-0/0/0.2 up up inet 10.0.0.5/30
lt-0/0/0.3 up up inet 10.0.0.6/30
lt-0/0/0.4 up up inet 10.0.0.9/30
lt-0/0/0.5 up up inet 10.0.0.10/30

[email protected]> show interfaces terse | match lo0
lo0 up up
lo0.1 up up inet 1.1.1.1 --> 0/0
lo0.2 up up inet 2.2.2.2 --> 0/0
lo0.3 up up inet 3.3.3.3 --> 0/0
Looks good! Next we test connectivity for all three links:
[email protected]> ping 10.0.0.2 routing-instance R1 rapid count 3
PING 10.0.0.2 (10.0.0.2): 56 data bytes
!!!
--- 10.0.0.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.116/3.052/4.435/0.998 ms

[email protected]> ping 10.0.0.9 routing-instance R1 rapid count 3
PING 10.0.0.9 (10.0.0.9): 56 data bytes
!!!
--- 10.0.0.9 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.285/13.683/36.429/16.084 ms

[email protected]> ping 10.0.0.1 routing-instance R2 rapid count 3
PING 10.0.0.1 (10.0.0.1): 56 data bytes
!!!
--- 10.0.0.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.117/2.699/3.391/0.526 ms

[email protected]> ping 10.0.0.6 routing-instance R2 rapid count 3
PING 10.0.0.6 (10.0.0.6): 56 data bytes
!!!
--- 10.0.0.6 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.123/4.776/7.982/2.424 ms

[email protected]> ping 10.0.0.5 routing-instance R3 rapid count 3
PING 10.0.0.5 (10.0.0.5): 56 data bytes
!!!
--- 10.0.0.5 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.407/3.452/5.359/1.351 ms

[email protected]> ping 10.0.0.10 routing-instance R3 rapid count 3
PING 10.0.0.10 (10.0.0.10): 56 data bytes
!!!
--- 10.0.0.10 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.094/5.480/8.832/2.440 ms
Awesome. Let’s also take a quick look at our routing table:
R1.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

1.1.1.1/32 *[Direct/0] 00:06:09
> via lo0.1
10.0.0.0/30 *[Direct/0] 00:06:09
> via lt-0/0/0.0
10.0.0.1/32 *[Local/0] 00:06:09
Local via lt-0/0/0.0
10.0.0.8/30 *[Direct/0] 00:06:08
> via lt-0/0/0.5
10.0.0.10/32 *[Local/0] 00:06:08
Local via lt-0/0/0.5

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

2.2.2.2/32 *[Direct/0] 00:06:09
> via lo0.2
10.0.0.0/30 *[Direct/0] 00:06:09
> via lt-0/0/0.1
10.0.0.2/32 *[Local/0] 00:06:09
Local via lt-0/0/0.1
10.0.0.4/30 *[Direct/0] 00:06:09
> via lt-0/0/0.2
10.0.0.5/32 *[Local/0] 00:06:09
Local via lt-0/0/0.2

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

3.3.3.3/32 *[Direct/0] 00:06:09
> via lo0.3
10.0.0.4/30 *[Direct/0] 00:06:08
> via lt-0/0/0.3
10.0.0.6/32 *[Local/0] 00:06:08
Local via lt-0/0/0.3
10.0.0.8/30 *[Direct/0] 00:06:08
> via lt-0/0/0.4
10.0.0.9/32 *[Local/0] 00:06:08
Local via lt-0/0/0.4
Perfect! Now let’s add OSPF to all three virtual-routers:
set routing-instances R1 protocols ospf area 0.0.0.0 interface lt-0/0/0.0
set routing-instances R1 protocols ospf area 0.0.0.0 interface lt-0/0/0.5
set routing-instances R1 protocols ospf area 0.0.0.0 interface lo0.1 passive

set routing-instances R2 protocols ospf area 0.0.0.0 interface lt-0/0/0.1
set routing-instances R2 protocols ospf area 0.0.0.0 interface lt-0/0/0.2
set routing-instances R2 protocols ospf area 0.0.0.0 interface lo0.2 passive

set routing-instances R3 protocols ospf area 0.0.0.0 interface lt-0/0/0.3
set routing-instances R3 protocols ospf area 0.0.0.0 interface lt-0/0/0.4
set routing-instances R3 protocols ospf area 0.0.0.0 interface lo0.3 passive
Next we try to commit, but we may get an error:
[email protected]# commit
error: Cannot parse routing-option max-interface-supported
error: configuration check-out failed
This is kind of an obscure error that occurs due to a bug in Junos 11.1 and 11.2, and detailed in Juniper KB 20977. It is fine in Junos 10.4 and fixed in Junos 11.3. To fix it, either configure *something* under routing-options, or use the following hidden command:
[edit]
[email protected]# set routing-options max-interface-supported 0

[edit]
[email protected]# commit check
configuration check succeeds
Now we commit, and check our routing tables for OSPF routes:
[email protected]> show route protocol ospf 

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

2.2.2.2/32 *[OSPF/10] 00:00:55, metric 1
> to 10.0.0.2 via lt-0/0/0.0
3.3.3.3/32 *[OSPF/10] 00:00:50, metric 1
> to 10.0.0.9 via lt-0/0/0.5
10.0.0.4/30 *[OSPF/10] 00:00:50, metric 2
> to 10.0.0.2 via lt-0/0/0.0
to 10.0.0.9 via lt-0/0/0.5
224.0.0.5/32 *[OSPF/10] 00:01:49, metric 1
MultiRecv

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

1.1.1.1/32 *[OSPF/10] 00:00:53, metric 1
> to 10.0.0.1 via lt-0/0/0.1
3.3.3.3/32 *[OSPF/10] 00:00:58, metric 1
> to 10.0.0.6 via lt-0/0/0.2
10.0.0.8/30 *[OSPF/10] 00:00:53, metric 2
to 10.0.0.1 via lt-0/0/0.1
> to 10.0.0.6 via lt-0/0/0.2
224.0.0.5/32 *[OSPF/10] 00:01:49, metric 1
MultiRecv

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

1.1.1.1/32 *[OSPF/10] 00:00:48, metric 1
> to 10.0.0.10 via lt-0/0/0.4
2.2.2.2/32 *[OSPF/10] 00:00:58, metric 1
> to 10.0.0.5 via lt-0/0/0.3
10.0.0.0/30 *[OSPF/10] 00:00:48, metric 2
to 10.0.0.5 via lt-0/0/0.3
> to 10.0.0.10 via lt-0/0/0.4
224.0.0.5/32 *[OSPF/10] 00:01:49, metric 1
MultiRecv
Perfect. One last thing to check is full connectivity, so…
[email protected]> ping 2.2.2.2 routing-instance R1 rapid count 3
PING 2.2.2.2 (2.2.2.2): 56 data bytes
!!!
--- 2.2.2.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.227/7.059/10.238/3.473 ms

[email protected]> ping 3.3.3.3 routing-instance R1 rapid count 3
PING 3.3.3.3 (3.3.3.3): 56 data bytes
!!!
--- 3.3.3.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.092/2.892/3.749/0.678 ms

[email protected]> ping 1.1.1.1 routing-instance R2 rapid count 3
PING 1.1.1.1 (1.1.1.1): 56 data bytes
!!!
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.514/4.918/8.915/2.846 ms

[email protected]> ping 3.3.3.3 routing-instance R2 rapid count 3
PING 3.3.3.3 (3.3.3.3): 56 data bytes
!!!
--- 3.3.3.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.104/2.693/3.742/0.744 ms

[email protected]> ping 1.1.1.1 routing-instance R3 rapid count 3
PING 1.1.1.1 (1.1.1.1): 56 data bytes
!!!
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 3.364/5.589/8.287/2.037 ms

[email protected]> ping 2.2.2.2 routing-instance R3 rapid count 3
PING 2.2.2.2 (2.2.2.2): 56 data bytes
!!!
--- 2.2.2.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.162/3.175/4.645/1.064 ms
And there you have it! A full three router topology using a single SRX210H. This should save you some cash when it comes time to building a lab for your JNCIE studies!

No comments: