Understanding Ping and Traceroute Basics
Understanding Ping and Traceroute Basics
2 3 4 5 6 7 8 9 10 #7100160-en
About the Author
Antonio “Ato” Sanchez Monge (JNCIE-M #222 and CCIE
#13098) holds a MS in Physics and a BA in Mathematics from the Universidad Autonoma de Madrid (UAM). He joined
Juniper Networks in 2004, where he is currently working in the Advanced Services team. He has also authored another
book in this series, This Week: Deploying BGP Multicast VPNs.
Author’s Acknowledgments
I would like to thank: Anton Bernal, my de facto mentor, for inspiring this book beginning-to-end; Patrick Ames, our
great editor, for his continuous, high-quality, and timely help from the original idea through publication; Josef
Buchsteiner, for finding some time in his busy schedule to provide expert-level technical feedback; Gonzalo Gomez
and Victor Rodriguez for the very thorough and useful review; Jesus Angel Rojo and David Eduardo Martinez Fontano
for setting the standards of the power of ping method; Lorenzo Murillo for teaching me the video camera trick; Oscar
Pache and Javier Aviles for teaching me the snake testing basics back in 2007; David Dugal for assessing this book’s
security issues; Oleg Karlashchuk and Erdem Sener for their infinite patience and help in the lab; Manuel Di Lenardo
for sharing the Ethernet OAM loopback trick; Pablo Mosteiro, Efrain Gonzalez and Pablo Sagrera, for keeping the faith
on this project; Domi- nique Cartella and Kisito Nguene-Ndoum for teaching me the value of accuracy in
troubleshooting; Ramiro Cobo for sharing interesting failure scenarios. Last but not least, I would have never written
this book without the support of my family and friends, especially Eva, Manuel, and Lucas.
iii
Chapter 1
This first chapter shows what happens every time you run ping or
traceroute, al- though their varied applications are discussed later in
the book. What you’ll see here are ping and traceroute at work at the
very beginning of the walkthrough. A selection of useful ping options
are provided that become more elaborate as new scenarios are
discussed, but don’t expect an exhaustive coverage of all the ping
options – this is not a command reference! Also, not all ICMP types and
codes are covered; this is not a RFC!
This book is mainly (but not exclusively) about the Junos tools at your
disposal.
Physical Topology
In order to complete all the practical examples included in this book, you
will need:
Three MPLS-capable Junos OS routers with at least two
ethernet (fe-, ge- or xe-) ports each. They don’t need to be three
different physical devices. For example, one single MX/M/T-series
router supports logical-systems and is enough for the purposes of
this book. You can leverage Junosphere to simulate the different
devices!
One ethernet switch with port mirroring capability. Any EX-
series switch would be a perfect fit, but you can also use a virtual-
switch or a bridge-do- main in a MX-series or SRX device, or even a
third-party switch.
A host (PC, server, or workstation) with an ethernet port that
can be put in promiscuous mode. This server is used to run a
protocol decoder like tcpdump to spy on all the conversations
held by the routers in the lab.
The proposed physical topology is depicted in Figure 1.1. The device
models and port numbers are shown for reference, so you can interpret
the output shown in the examples.
Three MX-Series routers with Packet Forwarding Engines (PFEs) based
on the Trio chipset, running Junos OS 11.4R4.4, were used for this book.
The Line Cards with Trio chipset contain the word 3D in their name.
Here we use the term pre-Trio for all the Line Cards whose PFEs were
developed before the Trio chipset. At the time of this edition, non-Trio is
equivalent to pre-Trio when we speak about M/MX/T-Series. But this
may change in the future, hence the term pre-Trio.
Unless otherwise specified, you can safely assume that the results are
independent of the PFE type. If available, use a multi-PFE router for P
and choose ports from differ- ent PFEs to connect to switch X.
Examples of multi-PFE routers are MX240, MX480, MX960, M120,
M320, and all T-series models.
Figure1.1 PhysicalDevicesandTopology
Logical Topology
TIP The Appendix contains the complete initial configuration of all the
devices.
NOTE Why a BGP/MPLS VPN setup? Frankly, it’s more interesting for
the tasks coming up in this book, because in this way you will see many
of the case studies from both the perspective of IP and of MPLS.
Figure1.2 VLANsandLogicalConnectionsBetweentheRouters
You can see this capture shows all traffic in the monitored VLANs,
including routing protocol exchanges and transit data traffic. There are
several ways to successfully find the packets involved in your ping:
Decode the capture in real-time with a graphical utility like
Wireshark (http:// [Link]/) and filter the view.
Alternatively, you can save the capture to a file and view it offline.
Just let the capture run on the terminal and do a pattern search
in the scroll buffer. You may have to clear the buffer often so that
you can easily find the last flow. This can either be very easy, or a
nightmare, depending on the terminal software.
Remove the -v option so that only one line is displayed per
packet. You will find the packets more easily, but obviously lose
some details.
Use tcpdump filtering expressions. This is not guaranteed
to work, as the mirrored packets have a VLAN tag that
doesn’t match H’s interface.
MORE? All the packet captures taken at H are available for download in libpcap
format at
the Juniper Day One website ([Link] These files
are
purified in the sense that all the routing protocol noise is removed.
TIP Every time that Capture x.y is referenced in the text, the
corresponding file to open with Wireshark is capture_x-[Link].
TIP If you want to speed up the appearance of the statistics, use the wait
1 option.
NOTE If the link was down or the IPv4 subnet was incorrectly
configured, the message No route to host would still be displayed.
The No route to host message disappeared, but ping still fails. Let’s have a
look at the capture at H. Is there any ICMP packet? Not at all! Is CE1
actually generating any packet? Let’s execute the monitor traffic interface
command at PE1, which launches tcpdump in the background, and let
it run for a minute:
user@PE1> monitor traffic interface ge-1/0/0.101 no-resolve size 2000
verbose output suppressed, use <detail> or <extensive> for full protocol decode
Address resolution is OFF.
Listening on ge-1/0/0.101, capture size 2000 bytes
So, CE1 is generating ARP requests, but it never receives an ARP reply
back. The result is that CE1 cannot resolve the MAC address of
[Link], the next hop for IPv4 packets destined to [Link].
Hence, even though you successfully configured a static route at CE1
towards 10/8, it remains in a hold state at the forwarding table:
user@PE1> show route [Link] table CE1
user@PE1>
For this same reason, the local IP address of VRF1 is also not reachable
from CE1:
user@PE1> ping [Link] routing-instance CE1 count 1
PING [Link] ([Link]): 56 data bytes
Before turning off the ARP filtering at the switch X, let’s try to see
what can be done when ARP resolution is failing. One option is to
configure static ARP resolution at
the [edit interfaces <...> family inet address <...> arp] hierarchy, but let’s use a
different approach in which we also need to know the MAC address of
the local interface at VRF1:
user@PE1> show interfaces ge-1/0/1 | match hardware
Current address: [Link], Hardware address: [Link]
Now, the following ping command allows you to specify the destination
MAC
address while bypassing the forwarding table lookup:
user@PE1> ping [Link] bypass-routing interface ge-1/0/0.101 mac-address [Link] count 1
Although ping still fails, the echo request is sent this time. You can see it
in Capture
1.1, that was taken at H:
[timestamp] IP (tos 0x0, ttl 64, id 60312, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3526, seq 0, length 64
TRYTHIS Increase the packet count value. Unlike the IPv4 ID, the
ICMPv4 ID value remains constant in all the same-ping packets and
identifies the ping flow. The sequence number increases one by one.
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 3530, seq 0, length 64
<timestamp> Out arp who-has [Link] tell [Link]
<timestamp> Out arp who-has [Link] tell [Link]
<timestamp> Out arp who-has [Link] tell [Link]
<timestamp> Out arp who-has [Link] tell [Link]
<timestamp> Out arp who-has [Link] tell [Link]
user@X> configure
VRF1 at PE1 cannot resolve the MAC address associated to [Link], hence ping fails. There
is an interesting difference in behavior between CE1 and VRF1. While CE1 sends ARP
requests periodically (every ~15 seconds), VRF1 only does it if triggered by a ping
command. Can you spot the reason? Actually, CE1 has a static route pointing to [Link] as
next hop: as long as it is in hold state, CE1 will keep trying to resolve it over and over again.
Now it’s time to remove the ARP filter from the switch. While keeping the packet capture
active at H, execute:
Figure1.3 ARPResolutionattheFirstHop
Can you explain the different behavior? You can also try this with and without ARP filtering
at X.
Everything falls into place regarding the one-hop ping, as shown here:
MAC Address
Name Interface Flags
Address
[Link]
[Link] ge-1/0/0.101 none
[Link]
And capture 1.3 at H shows both the one-hop ICMPv4 request and the
reply:
<timestamp> IP (tos 0x0, ttl 64, id 7523, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3546, seq 0, length 64
----------------------------------------------------------------------------------
<timestamp> IP (tos 0x0, ttl 64, id 7526, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo reply, id 3546, seq 0, length 64
So ping still fails because PE1 does not have a route to the destination
yet. Let’s look at the ICMPv4 packets in Capture 1.4, taken at H:
[timestamp] IP (tos 0x0, ttl 64, id 13549, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3559, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] IP (tos 0x0, ttl 255, id 0, offset
0, flags [none], proto ICMP (1), length 56)
[Link] > [Link]: ICMP net [Link] unreachable, length 36
IP (tos 0x0, ttl 64, id 13549, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3559, seq 0, length 64
Figure1.4 GenerationofanICMPv4NetUnreachableMessage
Now the capture 1.5 at H shows the same ICMPv4 echo request
packet four times, one at each segment of its trip from CE1 to CE2.
What follows is just one single packet at different stages of its life
through the network:
[timestamp] IP (tos 0x0, ttl 64, id 40308, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3649, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] MPLS (label 299840, exp 0,
ttl 63)
(label 16, exp 0, [S], ttl 63)
IP (tos 0x0, ttl 63, id 40308, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3649, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] MPLS (label 16, exp 0, [S],
ttl 62)
IP (tos 0x0, ttl 63, id 40308, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3649, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] IP (tos 0x0, ttl 61, id 40308, offset
0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3649, seq 0, length 64
ALERT! This is just one packet! The proof is in the IPv4 header ID,
which remains the same as it travels along the router hops. In addition,
as you will see in Chapter 4, when an IPv4 packet is fragmented
somewhere in the path, all the resulting fragments also keep the
original IPv4 ID.
TryItYourself:pingisaReturnTrip
You expect the ICMP echo reply later in the capture, but it doesn’t show up. Can you
figure out why ping is failing at this point? Try to fix the issue! The answer is at the end of
this chapter.
TRYTHIS If you change the discard action for reject, the echo request is silently
dropped.
Although this makes troubleshooting more difficult, from a security
perspective
discard is a much better design option than reject.
If you are puzzled at this point, that’s okay! The filter was applied at
lo0.0, but lo0.0 is in the master instance inet.0, so why did it affect traffic
addressed to CE2 at all? Well, in Junos, if a routing instance (in this case,
CE2) has no local lo0 unit, all its input control traffic is evaluated by the
master instance’s lo0 filter.
TRYTHIS Put the lo0.0 filter back in place, create lo0.1, and associate it to routing-
instance
CE2. The end-to-end ping should still succeed!
The ICMPv4 echo reply now shows up once at each of the four network
segments in
Capture 1.6 at H, as illustrated in Figure 1.6:
[timestamp] IP (tos 0x0, ttl 64, id 40242, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo reply, id 3691, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] MPLS (label 299872, exp
0, ttl 63)
(label 16, exp 0, [S], ttl 63)
IP (tos 0x0, ttl 63, id 40242, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo reply, id 3691, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] MPLS (label 16, exp 0,
[S], ttl 62)
IP (tos 0x0, ttl 63, id 40242, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo reply, id 3691, seq 0, length 64
---------------------------------------------------------------------------------- [timestamp] IP (tos 0x0, ttl 61, id 40242, offset
0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo reply, id 3691, seq 0, length 64
Figure1.6 LifeofanICMPv4EchoReplyfromCE2toCE1
This video camera assists you with analyzing any (ICMP is just one
example) protocol conversation in the complete forwarding path,
including the endpoints as well as the transit segments.
<timestamp> IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5e5e:ab00:650a:c360 >
ff02::1:ff01:1: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has fc00::1:1
source link-address option (1), length 8 (1): [Link]
----------------------------------------------------------------------------------
<timestamp> IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::5e5e:ab00:650a:c361 >
fe80::5e5e:ab00:650a:c360: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is fc00::1:1, Flags
[router, solicited, override]
destination link-address option (2), length 8 (1): [Link]
In the IPv6 world ICMPv6 is also used to achieve the same functionality
as ARP in
IPv4, and this process is part of Neighbor Discovery (ND).
Figure1.7 IPv6NeighborDiscoveryattheFirstHop
REVIEW Can you spot why the ND process to learn about fc00::1:1 MAC from CE1
restarts
immediately without any ping to trigger it? You already saw the
answer in the equivalent IPv4 scenario.
Figure1.8 GenerationofanICMPv6RouteUnreachableMessage
MORE? Read RFC 4659: BGP-MPLS IP Virtual Private Network (VPN) Extension for
IPv6
VPN.
Configure at PE1:
user@PE1> configure
user@PE1# set protocols bgp group IBGP family inet6-vpn unicast
user@PE1# commit and-quit
Now, configure at PE2:
user@PE2> configure
user@PE2# set protocols bgp group IBGP family inet6-vpn unicast
user@PE2# commit and-quit
Check that inet6-vpn routes are being exchanged between VRF1 and VRF2:
bgp.l3vpn-inet6.0: 1/1/1/0
VRF1.inet6.0: 1/1/1/0
Once end to end connectivity is ensured, ping should work fine between
CE1 and
CE2:
user@PE1> ping fc00::2:2 routing-instance CE1 count 1
PING6(56=40+8+8 bytes) fc00::1:2 --> fc00::2:2
16 bytes from fc00::2:2, icmp_seq=0 hlim=61 time=0.859 ms
Take the time to read Capture 1.9 and map it to Figures 1.9 and 1.10.
Also try to map echo reply messages to Table 1.1. Figures 1.9 and
1.10 illustrate echo request and echo reply from CE1 & CE2.
Figure1.9 LifeofanICMPv6EchoRequestfromCE1toCE2
Figure1.10 LifeofanICMPv6EchoReplyfromCE2toCE1
user@PE1> configure
How about routable IPv4 multicast addresses? Let’s configure a complete scenario by first
building a Multicast VPN infrastructure. Configure at PE1:
user@PE2> configure
user@PE2# set protocols bgp group IBGP family inet-mvpn signaling
user@PE2# set routing-instances VRF2 protocols mvpn
user@PE2# set routing-instances VRF2 protocols pim interface all mode sparse user@PE2#
set routing-instances VRF2 routing-options multicast ssm-groups 239/8
user@PE2# set protocols igmp interface ge-1/0/1.102 version 3 static group [Link] source
[Link]
user@PE2# commit and-quit
Group: [Link]
Source: [Link]
Flags: sparse,spt
Upstream interface: ge-1/0/1.101
Nothing in the packet capture, right? At this point it’s very common to
start config- uring IPv4 multicast protocols (PIM, IGMP) at CE1, but that
is useless if you are trying to simulate a multicast source, which is
stateless. You just need a few more ping options:
user@PE1> ping [Link] interface ge-1/0/0.101 count 1
PING [Link] ([Link]): 56 data bytes
Capture 1.10 shows an ICMPv4 packet that only survives one hop:
<timestamp> IP (tos 0x0, ttl 1, id 9133, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 8941, seq 0, length 64
Can you spot why the packet is stopping at VRF1 and does not move beyond it? Don’t
look for a complex reason, it’s all about ping!
Once you manage to get the ICMPv4 echo request all the way up to
CE1, have a look at Capture 1.11:
[Link] > [Link]: ICMP echo request, id 3818, seq 0, length 64
----------------------------------------------------------------------------------
<timestamp> MPLS (label 299888, exp 0, [S], ttl 9)
IP (tos 0x0, ttl 9, id 42264, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3818, seq 0, length 64
----------------------------------------------------------------------------------
<timestamp> MPLS (label 16, exp 0, [S], ttl 8)
IP (tos 0x0, ttl 9, id 42264, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3818, seq 0, length 64
----------------------------------------------------------------------------------
<timestamp> IP (tos 0x0, ttl 7, id 42264, offset 0, flags [none], proto ICMP (1), length 84)
[Link] > [Link]: ICMP echo request, id 3818, seq 0, length 64
It’s normal not to see any echo reply, as there is no real receiver at
CE2. In production networks, you can use ping to generate multicast
traffic, and use input firewall filters to count the traffic in a per-flow
basis.
Figure1.11 LifeofanICMPv4MulticastEchoRequestfromCE1toCE2
Let’s look at the life of the first UDP probe sent for each TTL value. The
following movie has several parts: action #1 for TTL=1, action #2 for
TTL=2, etc. Each chapter or action shows the life of an UDP probe, as
well as the reply (if any) sent by one of the routers in the path.
NOTE The source and destination UDP ports you get in your lab
may be different from the ones shown in this book.
Action#1
CE1 sends an UDP probe with TTL=1, and PE1 replies with an ICMP time
exceeded packet as shown in Figure 1.12:
[timestamp] IP (tos 0x0, ttl 1, id 36596, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33434: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] IP (tos 0x0, ttl 255, id 0, offset
0, flags [none], proto ICMP (1), length 56)
[Link] > [Link]: ICMP time exceeded in-transit, length 36
IP (tos 0x0, ttl 1, id 36596, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33434: UDP, length 12
Figure1.12 LifeofaTTL=1UDPPacketProbe
Action#2
CE1 sends an UDP probe with TTL=2, which gets silently discarded by
P as shown in Figure 1.13:
[timestamp] IP (tos 0x0, ttl 2, id 36599, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33437: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 299840, exp
0, ttl 1)
(label 16, exp 0, [S], ttl 1)
IP (tos 0x0, ttl 1, id 36599, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33437: UDP, length 12
Figure1.13 LifeofaTTL=2UDPPacketProbe
Action#3
CE1 sends an UDP probe with TTL=3, and PE2 replies with an
ICMPv4 time ex- ceeded packet as shown in Figure 1.14:
[timestamp] IP (tos 0x0, ttl 3, id 36602, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33440: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 299840, exp
0, ttl 2)
(label 16, exp 0, [S], ttl 2)
IP (tos 0x0, ttl 2, id 36602, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33440: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 16, exp 0, [S],
ttl 1)
IP (tos 0x0, ttl 2, id 36602, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33440: UDP, length 12
===========================================================
======================= [timestamp] MPLS (label 299872, exp 0, ttl 255)
(label 16, exp 0, [S], ttl 255)
IP (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto ICMP (1), length 56)
[Link] > [Link]: ICMP time exceeded in-transit, length 36
IP (tos 0x0, ttl 1, id 36602, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33440: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 16, exp 0, [S],
ttl 254)
IP (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto ICMP (1), length 56)
[Link] > [Link]: ICMP time exceeded in-transit, length 36
IP (tos 0x0, ttl 1, id 36602, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33440: UDP, length 12
----------------------------------------------------------------------------------
[timestamp] IP (tos 0x0, ttl 253, id 0, offset 0, flags [none], proto ICMP (1), length 56)
[Link] > [Link]: ICMP time exceeded in-transit, length 36
IP (tos 0x0, ttl 1, id 36602, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33440: UDP, length 12
Figure1.14 LifeofaTTL=3UDPPacketProbe
Action#4
CE1 sends an UDP probe with TTL=4, and CE2 replies with an
ICMPv4 port unreachable packet, as shown in Figure 1.15:
[timestamp] IP (tos 0x0, ttl 4, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 299840, exp 0,
ttl 3)
(label 16, exp 0, [S], ttl 3)
IP (tos 0x0, ttl 3, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 16, exp 0, [S],
ttl 2)
IP (tos 0x0, ttl 3, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] IP (tos 0x0, ttl 1, id 36605, offset
0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
================================================================
================== [timestamp] IP (tos 0x0, ttl 255, id 27376, offset 0, flags [DF], proto ICMP
(1), length 56)
[Link] > [Link]: ICMP [Link] udp port 33443 unreachable, length 36
IP (tos 0x0, ttl 1, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
----------------------------------------------------------------------------------
[timestamp] MPLS (label 299872, exp 0, ttl
254) (label 16, exp 0, [S], ttl 254)
IP (tos 0x0, ttl 254, id 27376, offset 0, flags [DF], proto ICMP (1), length 56)
[Link] > [Link]: ICMP [Link] udp port 33443 unreachable, length 36
IP (tos 0x0, ttl 1, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] MPLS (label 16, exp 0, [S],
ttl 253)
IP (tos 0x0, ttl 254, id 27376, offset 0, flags [DF], proto ICMP (1), length 56)
[Link] > [Link]: ICMP [Link] udp port 33443 unreachable, length 36
IP (tos 0x0, ttl 1, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
---------------------------------------------------------------------------------- [timestamp] IP (tos 0x0, ttl 252, id 27376,
offset 0, flags [DF], proto ICMP (1), length 56)
[Link] > [Link]: ICMP [Link] udp port 33443 unreachable, length 36
IP (tos 0x0, ttl 1, id 36605, offset 0, flags [none], proto UDP (17), length 40)
[Link].36595 > [Link].33443: UDP, length 12
Figure1.15 LifeofaTTL=4UDPPacketProbe
TryItYourself:tracerouteinMPLSNetworks
There are several ways to avoid this silent discard and hence get rid of the 2 * * * line in
the traceroute output. Turn your video camera on, execute the following procedure,
and interpret the different movies.
1. Execute at PE1:
user@PE1> configure
user@PE1# set protocols mpls no-propagate-ttl
user@PE1# commit and-quit
user@PE1> traceroute [Link] routing-instance CE1 no-resolve
user@PE1# delete protocols mpls no-propagate-ttl
user@PE1# commit and-quit
user@PE1> traceroute [Link] routing-instance CE1 no-resolve
3. If PE2 supports tunnel services, load the following configuration change at PE2 (adapting
the FPC/PIC
slots to the actual hardware). Then traceroute from PE1 again:
user@PE2> configure
user@PE2# load patch terminal
[Type ^D at a new line to end input] [edit
chassis]
+ fpc 0 {
+ pic 0 {
+ tunnel-services;
+ }
+ }
[edit interfaces]
+ vt-0/0/0 {
+ unit 0 {
+ family inet;
+ family inet6;
+ }
+ }
[edit routing-instances VRF2]
+ interface vt-0/0/0.0; [edit
routing-instances VRF2]
- vrf-table-label;
^D
user@PE2# commit and-quit
user@PE1> traceroute [Link] routing-instance CE1 no-resolve
user@PE2> configure
user@PE2# delete interfaces vt-0/0/0
user@PE2# delete routing-instances VRF2 interface vt-0/0/0.0
user@PE2# set routing-instances VRF2 vrf-table-label user@PE2#
commit and-quit
TryItYourself:IPv6traceroute
Table1.1 ICMPTypesandCodes(seensofar)
ICMPv6(IPv6
ICMPv4(IPPro
NextHeader
tocol1)
58)
Destination /
Route
0 Net 0
Unreachable
3 Unreachable 1
Destination /
Port
3 Port 4
Unreachable
Unreachable
Destinatio
n Unreachable,
13 Unreacha 1 Adm.
ble, Adm. Prohibited
Filtered
Time Time
11 0 3 0
Exceeded Exceeded
Neighbor
136 0
Discovery
MORE? Have a look at RFC 792 and 4443, the specifications for ICMPv4 and
ICMPv6,
respectively. They are all at [Link]
Since the capture is extensive, let’s show each of the packets once: the
request on its way from PE1 to P, and the reply on its way from PE2 to
P. Please refer to Figure 1.16 and to Capture 1.13 for the whole movie.
Figure1.16 LifeofaMPLSping
MORE? Have a look at RFC 4379 to better understand the motivation and
specifics of MPLS
ping.
TryItYourself:ManagingARPCacheEntries
The key is that CE1 has a static route pointing to [Link], while VRF1 does not. The first
command triggers a new ARP resolution: if it succeeds, nothing is done; if it fails, the entry
is silently deleted, with the resulting impact in the forwarding table. The second command
just deletes the unreferenced entry, requiring an IP packet at VRF1 towards [Link] in
order to trigger ARP again.
TryItYourself:pingisaReturnTrip
Even though the ICMP echo request reached its destination, CE2 does not have a route to
send the ICMP echo replies back to CE1. You need to add this route in order to make ping
work. Golden Rule #1: the return path is at least as important as the forward path!
user@PE2> configure
user@PE2# set routing-instances CE2 routing-options static route 0/0 next-hop [Link] user@PE2#
commit and-quit
Ping still fails, but at least it’s getting an answer! Capture 1.14 contains the details.
Review this chapter to find the way to correct this issue.
TryItYourself:TakingtheMulticastpingFurther
When the destination address is multicast, ping uses Time To Live (TTL)=1 by default. You
need to explicitly set a different value in order to take the ICMPv4 echo request all the way
up to CE2:
TryItYourself:tracerouteinMPLSNetworks
The end customer CE1 does not have any visibility of the MPLS backbone, which is seen
as one hop. The movie in Capture 1.15 now has only three parts, as compared to the
original movie which had four parts. Does action #2 (TTL=2) of your movie look like
Figure 1.17? Well done!
Figure1.17 Effectofno-propagate-
ttlattheIngressPE
2. Configuring icmp-tunneling at
P:
user@PE1> traceroute [Link] routing-instance CE1 no-resolve
traceroute to [Link] ([Link]), 30 hops max, 40 byte packets
1 [Link] 0.460 ms 0.299 ms 0.296 ms
2 [Link] 0.647 ms [Link] 0.548 ms [Link] 0.561 ms
MPLS Label=299840 CoS=0 TTL=1
S=0
MPLS Label=16 CoS=0 TTL=1 S=1
3 [Link] 0.395 ms 0.370 ms 0.368 ms
4 [Link] 0.537 ms 0.482 ms 0.741 ms
With icmp-tunneling, the Round Trip Time (RTT) of all the packets whose TTL expires in the
MPLS core is similar. Chapter 4 covers the ping latency topic in more detail.
3. With icmp-tunneling still configured at P, then moving VRF2 at PE2 to tunnel mode:
user@PE1> traceroute [Link] no-resolve routing-instance CE1
traceroute to [Link] ([Link]), 30 hops max, 40 byte packets
1 [Link] 0.477 ms 0.302 ms 0.299 ms
2 [Link] 0.638 ms 0.546 ms 0.543 ms
MPLS Label=299840 CoS=0 TTL=1 S=0
MPLS Label=303088 CoS=0 TTL=1 S=1
3 [Link] 0.536 ms 0.456 ms [Link] 0.444 ms
MPLS Label=303088 CoS=0 TTL=1 S=1
4 [Link] 0.379 ms 0.368 ms 0.374 ms
5 [Link] 0.503 ms 0.474 ms 0.470 ms
The TTL=4/5 packets need to loop in the vt- interface, hence the extra IP hop displayed.
Check the details at
Capture 1.17.
TryItYourself:IPv6tracero
ute
This effectively enables the icmp-tunneling mechanism for IPv6. Check the details at Capture
1.18, taken with
VRF2 back to vrf-table-label mode:
user@PE1> traceroute fc00::2:2 routing-instance CE1 no-resolve
traceroute6 to fc00::2:2 (fc00::2:2) from fc00::1:2, 64 hops max, 12 byte packets
1 fc00::1:1 7.978 ms 0.385 ms 0.332 ms
2 fc00::100:1:2 0.639 ms 0.562 ms 0.554 ms
MPLS Label=299824 CoS=0 TTL=1
S=0
MPLS Label=16 CoS=0 TTL=1 S=1
3 fc00::2:1 0.431 ms 0.519 ms 0.385 ms
4 fc00::2:2 0.613 ms 0.629 ms 0.505 ms
Don’t worry if you see different MPLS labels, they can change upon routing
events in a network.
Chapter 2
Conclusions . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . 57
NOTE Although traceroute may look like a good fit here, let’s stick to ping for
the moment.
Close terminals #1 and #2, and open two new terminals, each with a
different CLI
session at P.
At terminal #1, leave running:
user@P> monitor traffic interface ge-2/3/0.111 size 2000 no-resolve matching icmp
Both PE1 and P are treating these packets at the Control Plane level,
as shown in Figure 2.2. When the load-balance per-packet knob is
configured, the Control Plane uses a round robin algorithm to load
balance the outgoing packets: two packets out to link #1, then two
packets out to link #2, etc.
==================================TERMINAL
#2=====================================
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13147, seq 0
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13147, seq 0
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13147, seq 1
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13147, seq 3
Figure2.2 ForwardingPathofaOne-hopPing
TRYTHIS What if lo0.0 has more than one IPv4 address configured? Junos would pick
the
primary address, but if no primary is specified, what is the tie breaker?
Both the requests and the replies are load balanced across the equal
cost links. Let’s see how to influence that decision. Execute at
terminal #3:
user@PE1> ping [Link] interface ge-1/0/0.111 rapid count 4
This time, the echo requests are still load balanced, while the echo
replies are all received at interface ge-1/0/0.111, can you spot why?
==================================TERMINAL
#1====================================
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13436, seq 0
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13436, seq 0
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13436, seq 1
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13436, seq 2
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13436, seq 3
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13436, seq 3
==================================TERMINAL
#2====================================
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13436, seq 1
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13436, seq 2
When used alone, the interface option simply changes the source IP
address of the echo requests, very much like the source option (try it!).
So you are actually attract- ing the echo replies on the specified
interface, but the echo requests are still sent in a round robin fashion
according to the forwarding table.
You need something else to send all the packets out of the same
interface. So at terminal #3, execute:
user@PE1> show arp hostname [Link]
MAC Address
Name Interface Flags
Address
[Link]
[Link] ge-1/0/0.111 none
[Link]
user@PE1> ping [Link] interface ge-1/0/0.111 bypass-routing mac-address [Link] rapid
count 4
PING [Link] ([Link]): 56 data bytes
!!!!
--- [Link] ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss round-trip
min/avg/max/stddev = 0.483/0.560/0.778/0.126 ms
Now you are driving both the requests and the replies at the specified
interface:
==================================TERMINAL
#1====================================
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13452, seq 0
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13452, seq 0
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13452, seq 1
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13452, seq 1
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13452, seq 2
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13452, seq 2
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13452, seq 3
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13452, seq 3
==================================TERMINAL
#2====================================
Okay, previously you saw that PE1 sourced echo requests from its
local lo0.0 when pinging P’s loopback. What if you ping a directly
connected address?
user@PE1> ping [Link] count 1
PING [Link] ([Link]): 56 data bytes
64 bytes from [Link]: icmp_seq=0 ttl=64 time=0.673 ms
==================================TERMINAL
#1====================================
<timestamp> In IP [Link] > [Link]: ICMP echo request, id 13484, seq 0
<timestamp> Out IP [Link] > [Link]: ICMP echo reply, id 13484, seq 0
==================================TERMINAL
#2====================================
This time, echo requests are sourced from the local IPv4 address at ge-
1/0/0.111. This is not strictly related to the fact that the destination
address is directly connect- ed. The real reason behind this behavior is
that the route to [Link] only has one next hop, as compared to
the route to [Link], which has two possible next hops:
user@PE1> show route [Link] table inet.0
[Link]/32 *[IS-
IS/18] [Link], metric 10 to
[Link] via ge-1/0/0.111
> to [Link] via ge-1/0/1.112
==================================TERMINAL
#1====================================
[Link].630231 In IP [Link] > [Link]: ICMP echo request, id 15010, seq 0
===============================TERMINAL #1 OR
#2==================================
[Link].630269 Out IP [Link] > [Link]: ICMP echo reply, id 15010, seq 0
You don’t see anything in terminal #1 and #2 (at P), right? The reason
for this is illustrated in Figure 2.3. Junos OS tcpdump can only capture
control traffic that is sent or received by the Routing Engine. This is a
limit for funny lab tests, but that’s why you bought a video camera!
On the other hand, it is a safety protection mea- sure: it would be too
easy to collapse the router Control Plane otherwise.
Figure2.3 ForwardingPathofaTwo-hopPE-to-PEPing
user@P> configure
You need to use a different method to track the path followed by ping, and it’s not
traceroute! Open a new terminal #4 and connect it to P, then execute:
Now, just wait a couple of minutes without running any ping command, and then check the
counters:
user@P> show firewall | match ^icmp.*i | except " 0"
icmp-echo-reply-ge-2/3/0.113-i 317 5
icmp-echo-reply-xe-2/0/0.114-i 298 5
The counters are increasing! Why is that? Answers are at the end of the chapter.
Load Balancing at the Forwarding Plane
Launch a 100-packet ping from PE1 to PE2 (terminal #3), specifying ge-
1/0/0.111
as the next hop interface:
user@PE1> ping [Link] interface ge-1/0/0.111 bypass-routing mac-address [Link] rapid count
100
PING [Link] ([Link]): 56 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!
--- [Link] ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss round-
trip min/avg/max/stddev = 0.419/0.545/5.167/0.670 ms
Now, check the input (-i) and output (-o) firewall filter counters at P
(terminal #4), looking for echo requests:
user@P> show firewall | match request | except " 0"
TRYTHIS The first numeric column in the output represents bytes and the second
represents
packets. This means P receives and sends 84-byte packets. Can you
explain why? Use a packet capture and write down the size of all
headers.
P only uses one of its links to PE2 to forward the echo requests of your
ping. This proves that the Forwarding Plane uses a different load-
balancing algorithm from the one used by the Control Plane. In this
case, the load-balance per-packet knob is translated as per-flow. If there are
several candidate next-hops with equal cost to the destination, the
ingress Packet Forwarding Engine (PFE) of P picks one of them by
calculating a hash value using certain – some fixed, some configurable
– packet properties. From P’s perspective, all packets are received from
the same interface
(ge-2/3/0.111) and share common properties: same IPv4 protocol, same
source and destination address, and no port information. As a result,
the hash value is the same for all the packets of the stream.
NOTE The hash value depends on multiple factors including the type of Packet
Forwarding
Engine, so it is possible that you can get xe-2/0/0.114 as the next hop.
However, one thing is certain, you should see one and only one
output interface.
Now, let’s clear counters at P again and launch a 100-packet ping from
PE1 to PE2, but this time don’t specify the next hop interface:
user@P> clear firewall all
Now, check the firewall filter counters at P, looking for echo requests:
user@P> show firewall | match request | except " 0"
icmp-echo-request-ge-2/3/0.111-i 4200 50
icmp-echo-request-xe-2/0/0.112-i 4200 50
icmp-echo-request-xe-2/0/0.114-o 8400 100
PE1 is generating the echo requests from its Control Plane, so it uses a
round robin algorithm to spread them across the two links to P. On the
other hand, in this example, P only picks one next hop, so it must be
calculating the same hash value for all the packets in the echo
request stream. There are two possible reasons for this: either the
ingress PFE is ignoring the input interface for hash computation (the
default for Trio), or it is taking it into account but the mathematical
result turns out to be the same. It’s also fairly possible that you get
different hash results anyway,
and hence a different output interface. If you see P effectively load
balancing in your setup across two interfaces, then your PFEs are
definitely taking the input interface into account for the hash.
Now, check the firewall filter counters at P, looking for echo replies:
user@P> show firewall | match request | except " 0"
icmp-echo-reply-ge-2/3/0.113-i 4200 50
icmp-echo-reply-xe-2/0/0.112-o 8400 100
icmp-echo-reply-xe-2/0/0.114-i 4200 50
TRYTHIS If you are using Trio PFEs in your setup, configure set
and
forwarding-options en- hanced-hash-key family inet incoming-interface-index
watch the outcome. If you are lucky enough, P will balance the echo
requests, or the echo replies, or both. If you are unlucky, then the
hash results are not changing because two flows are not statistically
significant to achieve effective load balancing.
RR: [Link]
[Link]
[Link]
[Link]
With this option, each router in the path of the ICMP echo request,
as well as the ICMP echo reply, stamps its own IP address
somewhere in the packet. As a result, the output shows the
complete two-way trip.
Let’s see how these packets are forwarded. Clean firewall filter
counters at P:
user@P> clear firewall all
icmp-echo-request-ge-2/3/0.111-i 6200 50
icmp-echo-request-ge-2/3/0.113-
6200 50
o
icmp-echo-request-xe-2/0/0.112-i 6200 50
icmp-echo-request-xe-2/0/0.114-o 6200 50
icmp-echo-reply-ge-2/3/0.113-i 6200 50
icmp-echo-reply-xe-2/0/0.112-o 6200 50
icmp-echo-reply-xe-2/0/0.114-i 6200 50
The traffic is perfectly balanced at each hop. And, if you keep your
terminals #1 and
#2 with tcpdump at P, you can see the ICMP packets in the captures!
The ICMP echo request and reply packets need special treatment in
order to record the transit IP at each step, so the Control Plane is
involved at each hop (as shown in Figure 2.4), which explains the
round robin traffic distribution that you can see here. Also, the
tcpdump captures at P prove that the packets go up and down the
Routing Engine of the transit routers.
Figure2.4 Effectoftherecord-routepingoption
How is it possible that a single packet gets processed by the Control Plane of all the transit
routers? Turn on your video camera at H and see!
Traffic Polarization
Figure2.5 Dual-linkCoreTopology
MORE? The fields taken into account for hash calculation by Trio
PFEs are configurable at [edit forwarding-options enhanced-hash-key family inet|
inet6|mpls] for IPv4, IPv6 and MPLS packets, respectively. In older PFEs,
the hierarchy is [edit forward- ing-options hash-key family inet|inet6|mpls] .
TIP Some of the pre-Trio platforms take the MPLS EXP bits into
account by default to perform load balancing. If the configuration knob
set forwarding-options hash-key family mpls no-label-1-exp is available, and not
hidden, your router is one of them!
TryItYourself:CE-to-CEpingTrackingatP-router
Why aren’t the packets being matched by the filters? Try to fix it (answers at the end of the
chapter)!
Figure2.7 ForwardingPathofaMultihopCE-to-CEPing
Once you get the right filters in place, launch a 100-packet ping from
CE1 to CE2:
user@PE1> ping [Link] routing-instance CE1 rapid count 100
PING [Link] ([Link]): 56 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!
--- [Link] ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss round-
trip min/avg/max/stddev = 0.460/0.680/5.655/0.940 ms
In order to see how PE1 and PE2 are balancing the ICMPv4 traffic out
of their core uplinks, check the input firewall filter counters at P:
user@P> show firewall | match mpls-packets.*i
mpls-packets-ge-2/3/0.111-i 0 0
mpls-packets-ge-2/3/0.113-i 0 0
mpls-packets-xe-2/0/0.112-i 9200 100
mpls-packets-xe-2/0/0.114-i 9200 100
Due to the forwarding path outlined in Figure 2.7, it’s all about hashing
now! You may see other interfaces chosen by the hashing algorithm,
but there should definitely be the same degree of polarization as
shown here.
TRYTHIS Can you explain the 92-byte and 88-byte packet size? The captures taken
in Chapter
1 can help you.
If you use the record-route option, the forwarding path changes as shown
in Figure
2.8. The traffic is evaluated at the Control Plane by PE1 and PE2, but
not by P. The reason is that IPv4 options are not exposed in MPLS
packets. As a result, PEs use round robin algorithm, while P uses a
hash:
user@P> clear firewall all
user@PE1> ping [Link] routing-instance CE1 rapid count 100 record-route no-resolve
PING [Link] ([Link]): 56 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!
--- [Link] ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss round-
trip min/avg/max/stddev = 0.460/0.680/5.655/0.940 ms
mpls-packets-ge-2/3/0.113-i 6600 50
mpls-packets-xe-2/0/0.112-i 6600 50
mpls-packets-xe-2/0/0.114-i 6600 50
NOTE If you see that P is load balancing, then the input interface is likely being
taken into
account for the hash calculations.
TryItYourself:CapturingMPLS-taggedTrafficwithtcpdump
Ping packets with record-route option are processed by the Control Plane at the PEs. However,
the com- mand monitor traffic interface <core-interface> matching icmp wouldn’t catch them. One
alternative is to capture at the access interface PE-CE instead, and you also have the video
camera at H. But what if you want to see the packets at the core interface, and at the
router? Which monitor traffic options should you use?
Figure2.8 ForwardingPathofaMultihopCE-to-CEPingwithRecord-routeOption
You can see that the good thing about traceroute is that it tells you the
path upfront, but the logic behind it is a bit more complex than it
might seem at first.
For example, you can see that the hop displayed at the first line is
always the same, which is natural since there is only one connection
CE1-PE1. On the other hand, the second line is changing from one
packet to another. Let’s see why.
As you know, each line of the traceroute output corresponds to an
initial TTL value that starts from 1 and grows by 1 at each line. Figure
2.9 shows the forwarding path
of the various packets sent from CE1, depending on the initial TTL value.
You can see that the second and third hops are actually determined by
the Forwarding Plane of PE1, and P, respectively.
Figure2.9 ForwardingPathoftheVariousPacketsInvolvedinTraceroutefromCE1toCE2
The UDP packets with expired TTL value and the resulting ICMP time
exceeded messages, are both processed locally by the microkernel of
the Line Cards. This is also a component of the Control Plane, as you
can see in Figure 2.1. You can verify that during traceroute
executions, the following Routing Engine counter does not increase at
transit routers:
user@P> show system statistics icmp | match exceeded
<x> time exceeded
TIP Execute the traceroute monitor [Link] no-resolve command at PE1, which
is the Junos OS CLI equivalent of a popular tool with different names
(MTR, Matt’s
TraceRoute, or my traceroute):
TryItYourself:UnveilingthetracerouteLoadBalancingLogic
The Forwarding Plane applies a hash to the packets. How is it possible that the hash
results vary from one traceroute execution to another? Use the video camera to get more
data.
Is it transparent No No No No
to PE-routers
configuration?
Is it transparent
to P-routers No No Yes No
configuration?
Is it compatible
with all the
Yes Yes (**) No Yes
protocol choices
in the core?
Can it be used to
transport edge No Yes Yes No
VPN services?
Does it preserve
the encapsulation Yes No No Yes
of PE-to-PE ping?
Is it supported by
all Junos Yes Yes Yes No
platforms?
(*) Actions next-interface, next-ip, next-ip6 are supported since Junos 12.2 in Trio.
(**) Junos OS supports static MPLS label range: 1000000 - 1048575
user@PE1> configure
All the options in Table 2.1 show a relative tie, so whether to use one option or anoth- er
depends on your context. For big networks with RSVP enabled, RSVP strict LSPs are the way to
go as you don’t want to configure all the P-routers in the path. And that’s what we’ll use for the
following test. (There is a scenario discussed with MPLS Static LSPs later on in Chapter 5, and
we’ll leave the remaining options with you as
an optional exercise to explore. )
A key rule of troubleshooting is to avoid breaking existing services, so you need to find a way
to create a static path without changing the current forwarding logic between PE1 and PE2
lo0.0 addresses. An efficient approach to accomplish this is to define a secondary lo0.0 address
in both routers:
user@PE2> configure
user@PE2# edit interfaces lo0 unit 0 family inet
user@PE2# set address [Link]/32 primary
user@PE2# set address [Link]/32
user@PE2# commit and-quit
CAUTION Make sure the new address doesn’t overlap any of the
already allocated addresses in the network in production environments,
Also, consider blocking it at the IGP export policy. Finally, it’s critical to
flag the original lo0.0 address as primary, otherwise a router ID change
may cause serious impact.
user@PE1> configure
The RSVP LSPs need to be targeted to the remote PE router ID, but since you don’t want to
affect existing services, use the no-install-to-address option. On the other hand, the active knob
allows you to install the routes towards the remote secondary lo0.0 addresses in the global
routing table inet.0:
user@PE2> configure
user@PE2# edit protocols mpls
user@PE2# set path to-PE1 [Link]
user@PE2# set path to-PE1 [Link]
user@PE2# edit label-switched-path PE2-to-PE1
user@PE2# set to [Link] no-install-to-address
user@PE2# set install [Link]/32 active user@PE2#
set primary to-PE1
user@PE2# commit and-quit
user@PE2> show rsvp session name PE2-to-PE1 ingress
Ingress RSVP: 1 sessions
To From State Rt Style Labelin Labelout LSPname
[Link] [Link] Up 0 1 FF - 300160 PE2-to-PE1
Total 1 displayed, Up 1, Down 0
Figure2.10 ForwardingPathofanICMPv4EchoRequestandReplySteeredwithRSVPLSPs
Conclusions
Although ping and traceroute are key tools, it’s important to note
that due to the load balancing mechanisms discussed:
Regular end-to-end ping does not necessarily explore all the
possible equal cost paths between a source and a destination.
This is especially true in large networks.
Traceroute typically explores more paths, but these do not
necessarily include the set of paths explored by ping. Also, a
packet loss in traceroute is often difficult to interpret: this is where
traceroute monitor can be helpful.
The ping with record-route option is nice because it tracks both
the forward and return paths. These can definitely be different
from the ones followed by traceroute, or even regular ping,
including the internal forwarding path inside the routers. On the
other hand, when using this option transit routers often stamp
packets with their own loopback address (especially if default-
address- selection is configured), which is not precise enough to
determine the exact physical path.
So, the best approach is: combine the tools wisely, keep in mind what
each tool does, and know exactly what you are testing with every
command.
The firewall filter defined above is matching on the ICMP type, which is the first octet in
the IP payload. Temporarily configure at P:
user@P> configure
user@P# edit firewall family inet filter ICMP
user@P# set term ECHO-REPLY then log
user@P# commit and-quit
Check the packets matching the ECHO-REPLY term and making it to the firewall log:
user@P> show firewall log detail
TIP This is a circular log, with newest packets displayed first. Starting with
Junos OS
12.1, the firewall log can be cleared with command clear firewall log. If
you want more persistent logging, use the then syslog firewall filter
action instead.
Once you spot the packets, capture them with the video camera (terminal #0) and analyze
them carefully. Can you see why they are matching the ECHO-REPLY term? The icmp-type
keyword looks at a first byte of the IP payload, since that is precisely the position of the ICMP
type field. For ICMP echo replies: icmp-type = 0.
On the other hand, the firewall filter term ECHO-REPLY is matching on certain TCP packets,
precisely those with source port 179 (BGP). The TCP source port is encoded at the first two
bytes of the IP payload. In hexadeci- mal: 179 = 00:b3. What a coincidence, the most
significant byte of the TCP source port is the same as the ICMP type of echo replies!
Figure2.11 HeaderComparisonBetweenICMPv4EchoRequest(left)andBGPPacket(right)
TryItYourself:TheMagicBehindrecord-routeOption
With the record-route option, the ICMP packets go up the Control Plane at each hop. But
why does this happen for packets with a remote destination IP? As you can check in the
capture, the packets have the Record Route Option (#7) in the IP header, which means
precisely that: Go up the Control Plane. This option has an IP address list field that gets
filled in by transit routers, as you can see in Capture 2.1:
<timestamp> IP (tos 0x0, ttl 64, id 8878, offset 0, flags [none], proto ICMP (1), length 124, options (RR
[Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link],EOL))
[Link] > [Link]: ICMP echo request, id 4019, seq 0, length 64
<timestamp> IP (tos 0x0, ttl 63, id 8878, offset 0, flags [none], proto ICMP (1), length 124, options (RR
[Link], [Link] [Link] [Link] [Link] [Link] [Link] [Link] [Link],EOL))
[Link] > [Link]: ICMP echo request, id 4019, seq 0, length 64
<timestamp> IP (tos 0x0, ttl 64, id 56377, offset 0, flags [none], proto ICMP (1), length 124, options (RR
[Link], [Link], [Link] [Link] [Link] [Link] [Link] [Link]
[Link],EOL))
[Link] > [Link]: ICMP echo reply, id 4019, seq 0, length 64
<timestamp> IP (tos 0x0, ttl 63, id 56377, offset 0, flags [none], proto ICMP (1), length 124, options (RR
[Link], [Link], [Link], [Link] [Link] [Link] [Link] [Link]
[Link],EOL))
[Link] > [Link]: ICMP echo reply, id 4019, seq 0, length 64
NOTE The RR option has a limited size, or number of hops that it can record.
TryItYourself:CE-to-CEPingTrackingatP-router
The answer is very simple, which doesn’t mean it’s easy! As you saw in Chapter 1, the
ICMPv4 packets are encapsulated in MPLS when they reach P, so you need a MPLS filter:
user@P> configure
user@P# edit firewall family mpls filter COUNT-MPLS
user@P# set interface-specific
user@P# set term DEFAULT then count mpls-packets
user@P# top
user@P# set interfaces ge-2/3/0 unit 111 family mpls filter input COUNT-MPLS user@P#
set interfaces ge-2/3/0 unit 111 family mpls filter output COUNT-MPLS user@P# set
interfaces ge-2/3/0 unit 113 family mpls filter input COUNT-MPLS user@P# set interfaces
ge-2/3/0 unit 113 family mpls filter output COUNT-MPLS user@P# set interfaces xe-2/0/0
unit 112 family mpls filter input COUNT-MPLS user@P# set interfaces xe-2/0/0 unit 112
family mpls filter output COUNT-MPLS user@P# set interfaces xe-2/0/0 unit 114 family
mpls filter input COUNT-MPLS user@P# set interfaces xe-2/0/0 unit 114 family mpls filter
output COUNT-MPLS user@P# commit and-quit
In order to see MPLS control traffic sent from PE2 to the core:
user@PE2> monitor traffic interface ge-1/0/0.113 no-resolve size 2000 matching mpls user@PE2>
monitor traffic interface ge-1/0/1.114 no-resolve size 2000 matching mpls
In order to see MPLS control traffic received by PE2 from the core, there are two options. If
you use a
vt- interface at the VRF, then you can capture directly there. But if you use vrf-table-label
instead, you need to find the Label Switched Interface (lsi) unit associated to the VRF
first:
user@PE2> monitor traffic interface lsi.0 no-resolve size 2000 matching icmp
With vrf-table-label, a PE allocates a MPLS label for the VRF. All the incoming MPLS packets
arriving with that MPLS label at the top of the stack are processed by a receive-only
interface coupled to the VRF: in this case, lsi.0.
TryItYourself:UnveilingthetracerouteLoadBalancingLogic
The UDP ports are taken by default into account to calculate the hash in Trio PFEs. Since
both the source and destination UDP ports change at each execution of traceroute, so does
the hash calculation.
Chapter 3
Failure Scenario . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . 79
Figure3.1 FunctionalandPhysicalShapes
The key word in the previous paragraph is network. That’s because you
can view the router as a set of functional components that are
internally connected, and trouble- shoot it very much like a real
network, made up of different devices linked with external connections.
Let’s zoom in on the different functional systems.
Figure3.2 ImplementationDetailsoftheControlPlaneinRedundantPlatforms
If P is one of these platforms and it has two REs, you can check the
current redun- dancy state with the following command:
user@P-re0> show chassis routing-engine | match "slot|state" Slot 0:
Current state Master
Slot 1:
Current state Backup
No RE redundancy.
MX-Series MX-5/10/40/80 No switch Direct 1GE
connection RE-TFEB.
2 switches per
plane. GE switch
connects via 1GE
to same-plane RE,
to FEBs and to FE
switch. FE switch
M120 connects via 1GE
to GE switch, and
via FE to FPCs. REs
can only see line
Control Board (CB) cards (FEBs/FPCs)
via same-plane CB.
T640/T1600/T4000
T-Series
You can check the ports and statistics of the internal ethernet
switches very easily, provided that there are any switches! The
following output is from a MX480:
Speed is 1000Mb
Link is good on GE port 12 connected to device: Other RE
Speed is 1000Mb
Link is good on GE port 13 connected to device: RE-GigE
Speed is 1000Mb
In this example, the internal switch sees the REs simply as hosts
connected to its ports 12 and 13. Let’s run a quick connectivity test
between two Control Plane functional components. How about a
simple ping from the master RE to the microkernel of a Line Card?
This is possible starting with Junos OS 10.4. You first need to know
the target IP address:
user@P-re0> show arp vpn juniper_private1 no-resolve
MAC Address
Interface Flags
Address
[Link]
em1.0 none
[Link]
[Link]
em1.0 none
[Link]
[Link]
em0.0 none
[Link]
[Link]
em1.0 none
[Link]
[Link]
em0.0 none
[Link]
[Link]
em0.0 none
[Link]
[Link]
em0.0 none
[Link]
Total entries: 7
Out of all the addresses above, which one corresponds to the Line
Card in slot #2? You’ll need to use one more command, like this:
user@P-re0> file show /etc/[Link] | match " fpc2$"
[Link] fpc2
MORE? Raise the count and spot with show chassis ethernet-switch
the ports of the internal ethernet switch that are used by the
statistics
flow. Don’t forget that these ports are also used for all the internal
control communication and keep increasing in steady mode.
TIP In order to thoroughly test any internal or external forwarding path, you
can choose
the same bit patterns that are generally used by manufacturing teams
while stressing components. See the last Try It Yourself exercise in
Chapter 4 for details.
You can try the same ping from the backup RE and it should work from
there, too. If
RE0 is master (check it with show chassis routing-engine), go to RE1:
user@P-re0> request routing-engine login other-routing-engine
user@P-re1> exit
user@P-re0>
What do em0 and em1 stand for? Both are network interfaces at the Routing Engine. They
connect to the same-plane and to the other-plane internal ethernet switches, respectively. In
some sense, you can call them primary and secondary interfaces as in Table 3.2. They are
flagged as P and S in Figure 3.2.
Table3.2 NamesofEthernetInterfacesattheRoutingEngine
Secondary
MX-240/480/960 em0 (1GE) em1 (1GE)
(em1)
T640/T1600/
T-Series T4000
TX SCC
Secondary
TXP SFC ixgbe0 (1GE) ixgbe1 (1GE)
(ixgbe1)
Check Capture 3.1 for details of the previous packet exchange. This
capture was taken with the write-file option at the router itself.
TryItYourself:InternalvsExternalControlTraffic
Would the capture show the external ICMPv4 traffic sent and received by the Routing
Engine? Execute at terminal #2: user@P-re0> ping [Link] , and see if you catch it at
terminal #1. No luck? Then remove matching icmp and use the extensive or write-file options. If
you look very carefully at the capture file, you can see the P-PE1 ping traffic and even the
ISIS and LDP packets exchanged by P with its neighbors!
As you might have noticed in the last Try It Yourself section, a mix of
traffic flows in and out the RE ethernet interfaces:
Internal traffic is not tunneled. The most used transport
protocol is TCP. The internal TCP sessions are used for varied
functions like transferring the forwarding table from the RE to
the Line Cards, maintaining consistency between REs when
graceful-switchover is enabled, retrieving statistics and state
from Line Cards, (re)booting the Line Cards, and more.
External traffic is tunneled in TTP (TNP Tunneling Protocol). This
is the traffic sent or received by the router from the outside world,
namely routing, man- agement, and exception packets exchanged
with the neighboring (physical or logical) devices.
TryItYourself:TestingControlPlaneRedundancyWithoutaRESwitchover
If your test P-router is one whose Backup RE connects to Line Cards using Secondary
Interface according to Table 3.2, and if it has two REs and (S)CBs, then it has full Control
Plane redundancy. If there is a RE switchover, then the new master RE would activate its
primary interface. But, would it have connectivity to all the Line Cards? You can know the
answer before the RE switchover. How?
Figure3.3 ArchitectureDetailsoftheForwardingPlaneinMulti-PFEPlatforms
Figure3.4 ModelofPFEInterconnectionwithFabricPlanes
Built-In Trio
Forwarding Engine
MX-5/10/40/80 Board 1 global (built-in)
MX-Series (TFEB)
Modular PIC
Concentrator (MPC)
1, 2 or 4 per
(*) - or - Dense PIC
MPC/DPC/FPC,
MX-240/480/960 Concentrator (DPC)
depending on the
- or - Flexible PIC
model
Concentrator (FPC)
Forwarding Engine
M120 1 per FEB
Board (FEB) (**)
M320
1 or 2 per FPC,
Flexible PIC
depending on the
Concentrator (FPC)
model
T640/T1600/T4000
T-Series
(*) MPC is based on Trio. DPC and FPC are pre-Trio. Junos OS CLI operational command syntax refer to
all of them as fpc. (**) M120 also has FPCs, but they don’t contain any PFEs. Their function is to
interconnect PICs with a FEB
REMEMBER The pre-Trio term is used for the PFEs that were developed before the Trio
chipset.
TIP In a M120, each FEB has a PFE and you can find the mapping with the
command
show chassis fpc-feb-connectivity.
Table 3.4 provides details about where the fabric planes are
physically located in each platform.
Table3.4 FabricPlaneDistributionperPlatform
NumberofFabricPla
Series Model FabricLocation
nes
MX-5/10/40/80 - -
MX-Series
M7i
- -
M-Series
M10i
2 per CB (up to 2
M120 Control Board (CB) active CBs = 4 active
planes)
T-Series T640/T1600/T4000
Three-stage CLOS
Switch Interface
TX SCC / TXP SFC fabric with 4 active
Board (SIB)
planes
And let’s look at the layout of a MX480 with redundant Switch Control
Boards:
Before moving deeper into the Forwarding Plane, let’s talk briefly about
PICs (Physi- cal Interface Cards) and MICs (Modular Interface Cards).
From an architectural point of view, a PIC is a physical card containing a
set of functional components called ports or interfaces. Stated simply,
PICs provide connectivity between PFEs and the outside world.
Depending on the Line Card model, PICs can be either indepen- dent
physical cards, or physically bound to Line Cards, or bundled in a MIC.
The show commands typically take pic as an argument, but the
commonly used request chassis pic [offline|online] operation only works if the
PIC is an independent physical card. Otherwise you need to act on the
card it is bound to (fpc or mic).
Execute at P:
user@P-re0> show chassis fpc pic-status
Slot 0Online DPCE 40x 1GE R PIC 0
Online 10x 1GE(LAN) PIC 1
Online 10x 1GE(LAN)
CAUTION In this example, the Line Cards had all the PIC/MIC
slots full, but that will not always be the case. Consider the
possibility of empty PIC slots when doing the PFE-to-PIC mapping.
Figure3.5 InternalProcessingofTransitPackets
Figure3.6 InternalProcessingofControlandExceptionPackets
With the network in a steady state and no ping running, let’s see what’s
actually going on at the PFEs and the switch fabric:
user@P-re0> clear pfe statistics traffic
Traffic statistics cleared.
How might you interpret this data? The Input packets and Output packets
account for all the traffic that enters/exits the PFE from/to the PICs. This
includes all the transit, control, and exception traffic, but that’s not all.
The Input packets also account for Normal discard, in this specific setup
untagged traffic received from the switch. In a router with no transit
traffic at all, these formulas should apply:
Input packets = Local packets input + Normal discard + <Other Drops> Output
packets = Local packets output
However, in this example, the numbers on the left of the equal sign are
slightly larger
(by around 40 packets) than the numbers on the right: 775 > 735, and 504
> 463.
TryItYourself:InterpretingPFEStatistics
Why aren’t the formulas exact? The answer is very simple, but not that easy to figure
out! Think about it, figure it out on your own, or cheat and go to the end of the chapter
to find out.
In the current situation, it’s natural to expect there to be no traffic
flowing through the fabric at all. However, in this case there is some
traffic. Let’s look:
user@P-re0> show class-of-service fabric statistics source 2 destination 2 | match "stat|pps"
The reason there is some traffic is because the software release used
during this writing – Junos OS 11.4R4.4 – supports a nice feature on
MX-Series called fabric self-ping. Here, each PFE periodically pings
itself using its fabric loopback stream:
the path that takes cells from the PFE to the switch fabric, and back to
the same PFE. And it does so for every fabric plane. The goal is to
detect PFE-to-fabric connectivity issues in an independent way. Before
the new feature was implemented, end-user transit traffic was
necessary to start detecting fabric failures.
Figure 3.7 illustrates the implementation details of this feature. In pre-
Trio PFEs, the self-ping packets are generated by the microkernel and
sent at a low rate using the PFE-to-fabric queue #7, which has low
priority by default but can and should be changed (with set class-of-service
forwarding-classes <name> queue-num 7 priority high, for example). On the
other hand, Trio PFEs generate the packets themselves at a high rate,
using a high priority PFE-to-fabric queue. In other words, self-ping is
software-based for pre-Trio, and hardware-based for Trio.
Figure3.7 PFESelf-pingThroughFabricForwardingPath
NOTE At the time of this writing T-Series also supports fabric self-ping.
Figure3.8 ForwardingPathofOne-hopPingfromPE1toP
The PFE input and output stats also increment by 10,000, as expected:
user@P-re0> clear pfe statistics traffic
user@P-re0> configure
Let’s bring down some links to ensure that ping between PE1 and PE2 enters and exits P at
the same PFE. Execute at P:
The PFE input and output stats, shown next, increment by 20,000,
because this time both ICMPv4 echo requests and replies enter and exit
the router:
user@P-re0> clear pfe statistics traffic
Since the traffic enters and exits the router at the same PFE #2/0, it
doesn’t need to cross the switch fabric. Let’s check to ensure that
during the PE1-to-PE2 ping, only fabric self-ping crosses the fabric at
P:
user@P-re0> show class-of-service fabric statistics source 2 destination 2 | match "stat|pps"
Total statistics: High priority Low priority
Pps : 38 0
Tx statistics: High priority Low priority
Pps : 38 0
Drop statistics: High priority Low priority
Pps : 0 0
Figure3.9 ForwardingPathofIntra-PFETransitPingfromPE1toPE2
The sentence: Since the traffic enters and exits the router at the same
PFE, it doesn’t need to cross the switch fabric, is actually misleading
because it is not always true. Table 3.5 shows a subset of the actions
that do require the packet to be looped once in the PFE-fabric-PFE path,
even for intra-PFE traffic with the same source and destina- tion PFE.
Table3.5 Intra-PFETransitTrafficHandlinginDifferentLineCardsTypes
Requiresadditionalloopthrou
Action ghthefabric?
TRIO Pre-TRIO
InputFirewallFilter No(*) No
OutputFirewallFilter No Yes
MPLSpush/swap/pop No Yes
InputSampling-likeActions Yes No
For Trio PFEs, the fabric loop is only used in one corner case: input
sampling-like firewall filter actions. These actions are: then sample, log,
syslog, port-mirror. When the actions are invoked from an input filter,
the current implementation
Figure3.10 Intra-PFEMPLSTransitTrafficInternalPathinDifferentLineCardTypes
Figure3.11ForwardingPathofIntra-PFETransitPingWhenthePFE-fabricLoopisUsed
TRYTHIS Check to ensure that TTP statistics do not increase at P during regular
PE1-PE2 ping.
user@P-re0> configure
Let’s change the active links to ensure that ping between PE1 and PE2 enters and exits
P at different PFEs. Execute at P:
/* Output suppressed */
10000 packets transmitted, 10000 packets received, 0% packet loss round-
trip min/avg/max/stddev = 0.422/0.535/44.918/1.109 ms
The PFE input and output stats increment by 20,000. As was the case for
intra-PFE
ping, both ICMPv4 echo requests and replies enter and exit the router:
user@P-re0> clear pfe statistics traffic
Since the traffic enters and exits the router at different PFEs, #2/0
and #2/1, it needs to cross the switch fabric. Execute during PE1-to-
PE2 ping, at P:
Total statistics:
High priority
Low priority
Pps :
40
3139
Tx statistics:
High priority
Low priority
Pps :
40
3139
Drop statistics:
High priority
Low priority
Pps :
0
0
Figure3.12 ForwardingPathofInter-PFETransitPingfromPE1toPE2
TryItYourself:ThePrivateLifeofrecord-
routeping
This time, try it with the record-route option, and compare with the previous test. Can you
identify the three differences? Two of the differences are relatively straightforward, but
how about the third one? As always, the answers are at the end of each chapter.
Failure Scenario
One of the inspirations for this book is the following real-life scenario;
hope you like it! Let’s keep the topology with single PE-P links in
different PFEs:
user@P-re0> show isis adjacency
Figure 3.13 shows the forwarding path taken by echo requests and
replies. The dotted line shows the case where the record-route option
is used.
Figure3.13ForwardingPathofInter-PFETransitPingWithandWithoutRecord-routeOption
At terminal #3, execute the necessary procedure to bring down all the
fabric planes at P. The command show chassis fabric summary provides you
with the fabric
plane numbers, and you can then offline them by executing request
chassis fabric plane offline <x>, where <x> is a number going from 0 to the
highest numbered plane.
TIP You can measure the impact by typing ctrl-C at terminals #1 and
#2 once both pings are up and running again. If you multiply the
number of lost packets by 10, then you have the number of seconds of
impact.
TryItYourself:SelectivelyBreakingtheControlPlane
The previous test showed a failure in ping at terminal #1, while ping at terminal #2 was
fine. Try to figure out a way to trigger the reverse failure: one that impacts terminal #2, but
leaves terminal #1 up and running.
user@P-re0> monitor traffic interface em0 no-resolve size 2000 write-file /var/tmp/[Link]
The external ICMPv4, LDP, ISIS traffic is in fact tunneled inside a TTP header. TTP stands for
TNP Tunnel- ing Protocol and was originally designed to work over TNP. With the migration
to TCP/IP stack, TTP has been redefined as IPv4 protocol 84 and registered at IANA. Figures
3.14 and 3.15 show the secret life of an ICMPv4 echo request going from P to PE1.
Capture 4.2 contains the packets exchanged with: user@P> ping [Link] count 1
Figure3.14SecretLifeofanICMPv4EchoRequestfromPMasterREtotheWire
Figure3.15SecretLifeofanICMPv4EchoRequestReceivedatPE1
TryItYourself:TestingControlPlaneRedundancywithoutaRESwitchover
Open three terminals connected to P backup RE. If RE0 is master, then RE1 is backup:
user@PE-re0> request routing-engine login other-routing-engine
The ICMPv4 echo requests should go out of em1 while the ICMPv4 echo replies come back at
em0. But when RE1 becomes master, it will use em0 to send the packets. How can you check
to ensure that em0 is bidirection- ally healthy before that happens? Going back to terminal
#3:
user@P-re1> ping [Link] routing-instance juniper_private1 interface em0 bypass-routing mac-address
[Link]
TryItYourself:InterpretingPFEStatistics
“In a router with no transit traffic at all, these formulas should apply.” You are not running
ping, but there is transit traffic going through P – the BGP keepalives in the session
between PE1 and PE2!
TryItYourself:ThePrivateLifeofrecord-routeping
With the record-route option, the TTP statistics increase but the fabric statistics don’t. The
reason for this is the different forwarding path shown in Figure 3.13.
What’s the third difference? PE1-to-PE2 ping takes a longer time to complete, and as a
result the pps num- bers in show pfe statistics are sensibly lower. With the rapid option, ping
waits for the echo reply of the current packet to move the next one. It doesn’t wait forever:
if the reply doesn’t arrive within the specified interval (1 second by default), ping moves to
the next packet. But as long as the echo reply arrives within the interval, the average
combined latency of the echo request and its reply determines the time it takes for ping to
complete, and the resulting pps . With the record-route option, the packets need to transit the
control plane of P, and that does add up for the latency due to the non-real-time nature of
the Junos OS kernel.
TryItYourself:SelectivelyBreakingtheControlPlane
Just configure a firewall filter that blocks ICMPv4 and apply it at P’s lo0.0 in the input direction.
At terminal
#3, execute:
user@P-re0> configure
user@P-re0# set firewall family inet filter BLOCK-ICMP term ICMP from protocol icmp user@P-re0#
set firewall family inet filter BLOCK-ICMP term ICMP then discard
user@P-re0# set firewall family inet filter BLOCK-ICMP term REST then accept user@P-
re0# set interfaces lo0.0 family inet filter input BLOCK-ICMP
user@P-re0# commit and-quit
CAUTION Don’t forget to remove the filter attachment from lo0.0 when done.
Chapter 4
You’ve already read about what ping is and where it goes; this chapter
deals more with how it goes: reliably or intermittently? Fast or slow? Big
or small? As a whole or in pieces? The ping options covered in this
chapter are widely known and used, but frequent assumptions are
made about them that are not always true. For example:
Myth #1: Intermittent one-hop ping packet loss is an
indication of either hardware issues at the endpoints or
physical problems in the link.
Myth #2: If ping shows high latency and jitter, then we have
an explanation to end-user slow network complaints.
Let’s confront these and other myths in this chapter!
TIP For latency tests, always make sure you use the source or interface
options, just in case you have default-address-selection configured.
The time values displayed are for the Round Trip Time (RTT) between
the time the echo request is sent, and the echo reply is received. So,
assuming symmetrical routing, which isn’t always the case, the
unidirectional latency is typically half of the time.
As you can see, there is a high level of jitter. These latency variations
are actually introduced by the Control Plane components of the sender
and receiver, especially by the Routing Engines, which run non-real-
time FreeBSD kernels. Due to the forward- ing architecture in Junos OS
devices, this extra delay introduced by the Control Plane does not affect
end-user transit traffic at all, so you don’t need to worry that much
about ping jitter.
The average latency can even go higher up if there is a lot of control
or exception traffic queued in the PFE-to-host path. Typical scenarios
where this can happen are aggressive RE-based traffic sampling, or
firewall filter log/syslog/reject actions. The ICMP echo requests/reply
compete with this other exception traffic and may be impacted with
higher latency or even discards.
TIP Look for input/output drops in show pfe statistics traffic, which
indicate the health of the communication channel between Control
and Forwarding planes.
CAUTION If you use ping to measure latency in multi-hop paths, load balancing
comes into
play and you may be looking at different paths at the same time.
Also, beware of asymmetrical routing.
So far so good, but keep raising the count until you see drops. The test
should last at least five seconds in order to start seeing drops. During
this writing, the authors started to see drops at around count 30000:
user@P> clear firewall all
NOTE The value 30000 is specific to the setup and really depends
on the RTT. In this case, all devices are in the same room so the RTT is
very low. With high latency links, you may never see drops unless you
increase the packet size.
Here the packets are discarded inside P! Let’s look for the cause of the
drops. If your P router has Trio Line Cards and is running Junos OS 11.2
or higher, it has a feature enabled by default called Distributed Denial
of Service (DDoS) Protection. It implements control and exception
traffic policers at different levels of the host- bound path, both at the
Line Cards and at the Routing Engine.
Let’s check to see how the ICMPv4 policers are programmed and what
their statistics are during a stressing ping. Execute at P and PE1:
user@P> show ddos-protection protocols icmp
Protocol Group: ICMP
NOTE Here icmp stands for ICMPv4. There is a separate protocol group called
icmpv6.
As you can see, the Max arrival rate reported is below the policer
Bandwidth, hence the ping drops are not caused by the DDoS Protection
feature. There must be some- thing else.
TryItYourself:DDoSProtectionProtocols
DDoS Protection classifies control and exception traffic into protocols and protocol groups.
Launch ping from PE1 to PE2, and see how the ICMPv4 echo requests are classified at P in
the following cases: normal transit; with record-route; TTL expiring at P; and Destination
Unreachable generated at P.
In this case the drops are caused by an additional ICMPv4-specific
policer implement- ed at the Routing Engine kernel. This policer, more
aggressive by default, was implemented in Junos OS earlier than the
DDoS Protection feature. Execute at PE1 and at P:
user@PE1> show system statistics icmp | match limit
0 drops due to rate limit
[Link]: 5
% sysctl -a | grep [Link]
[Link]: 1000
% exit
You can see above that P dropped a few incoming echo requests.
TIP Also look for drops in show interfaces queue, show pfe statistics traffic, show
pfe statistics ip icmp, show system statistics ttp, show system queues, and full
buffers in show system buffers. They can point to a bottleneck in the
internal forwarding path within the routers, and may definitely account
for ping packet loss.
user@P> configure
For the sake of testing only, let’s raise the policing rate at P:
Find a way to rate limit the incoming ICMPv4 packets addressed to P to 100kbps. You should
apply a global policer to the aggregate ICMPv4 packets, regardless of the input interface.
Don’t use DDoS Protection or the global kernel ICMPv4 policer.
The bottom line is: keep using ping to measure link reliability but take
your time to interpret the drop statistics. Not every packet discarded
in a one-hop ping is the cause of poor link quality.
Certain link issues show up only with certain bit patterns. This is especially true in
synchronous transport technologies like SONET/SDH. Send ICMPv4 echo requests with the
following bit patterns: all 0’s, all 1’s, alternating 0 and 1. Also try the following patterns,
typically used by manufacturing teams: 0xd6bd6b (MOD3), 0x294294 (inverse MOD3),
0x8080 (lonely_1 8), 0x8000 (lonely_1 16), 0x7F7F (lonely_0 8),
0x7FFF (lonely_0 16). Are ICMPv4 echo replies reflecting the patterns? Think of ping as an
echo request.
NOTE Due to the possible encapsulations or decapsulations along the path, the
value of S
may vary on a hop-by-hop basis.
user@PE1> configure
user@PE1# set interfaces ge-1/0/0 mtu 1528
user@PE1# commit and-quit
user@P> configure
In order to make MTUs symmetric, execute at P:
Figure4.1 ScenarioWithMixedMTUValues
user@P> configure
Unlike IPv6, the IPv4 specification (RFC 791) allows for packet fragmentation by a transit
router, and not only by the originating host. On the other hand, packet reassembly is always
performed by the receiving host.
In general, one important aspect of fragmentation is that load balancing in the network can
cause multiple fragments of the same packet to follow different paths. This can result in
fragments arriving at the receiving host out of order, which means a buffer is required to hold
the out-of-order fragments before reassembling them.
As a first task, adapt the ICMP filter at P to deal with IPv4 fragments:
The ping size option specifies the number of bytes in the ICMP payload.
In the case of IPv4, you need to add 8 and 20 bytes for the ICMPv4 and
IPv4 headers, respec- tively.
NOTE If the IPv4 header has options, then it’s longer than 20
bytes. This is the case if you use the record-route option.
Since the PE1-to-PE2 Path MTU is 1500 bytes, the maximum value of the
size
option without fragmentation is 1500-20-8 = 1472. Let’s go 1 byte
above:
user@P> clear firewall all
Note that 1481 bytes is including the 8-byte ICMPv4 header. Check
the firewall counters at P:
user@P> show firewall | match request | except " 0"
icmp-echo-request-ge-2/3/0.111-i 1501 1
icmp-echo-request-xe-2/0/0.114-o 1501 1
icmp-fragments-ge-2/3/0.111-o 21 1
icmp-fragments-xe-2/0/0.114-i 21 1
Figure4.2 FragmentationofICMPv4EchoRequestinTransit
Figure4.3 FragmentationofICMPv4EchoReplyattheSource
Your previous ping worked because P and PE2 were able to fragment
the ICMPv4 echo request and reply, respectively. But some end-user
applications set the DF (Don’t Fragment) flag in the IPv4 header. You
can simulate that with the do-not- fragment option:
user@P> clear firewall all
user@PE2> clear firewall all
Let’s remove the DF flag and increase the IPv4 packet size to over 1510
bytes, the
PE1-P link MTU. In order to send a 1511-byte IPv4 packet, the ping size
value is
1483:
icmp-echo-request-ge-2/3/0.111-i 1508 1
icmp-echo-request-xe-2/0/0.114-o 1508 1
icmp-fragments-ge-2/3/0.111-i 23 1
icmp-fragments-ge-2/3/0.111-o 31 1
icmp-fragments-xe-2/0/0.114-i 31 1
icmp-fragments-xe-2/0/0.114-o 23 1
As you can see in Capture 4.3 and Figure 4.5, this time the ICMPv4
echo request is fragmented twice: once at the source (PE1), and one
more time at a transit router
(P). The ICMPv4 echo reply is only fragmented by the source (PE2) this
time: similar to Figure 4.3 but with 11 bytes in the last fragment’s
ICMPv4 payload.
NOTE The first IPv4 fragment in the PE1-P link has 1508 bytes
instead of 1510. The reason is that the Fragment Offset in the IPv4
header is measured in units of 8 bytes, so the first fragment size must
be an exact multiple of that quantity.
Figure4.5 FragmentationofICMPv4EchoRequestBothattheSourceandinTransit
CAUTION Try to avoid using unrealistically high size values. One lost
fragment is enough to keep all the other fragments waiting in the
reassembly buffer of the destination. This is a classical DoS attack! Of
course, you can guard against it with several techniques: DDoS
Protection, IP fragment policers in lo0.0 filters, etc.
Finally, try to send from PE1 an IPv4 packet bigger than PE1-P link
MTU, but with the DF flag:
user@PE1> ping [Link] size 1483 count 1 do-not-fragment
PING [Link] ([Link]): 1483 data bytes ping:
sendto: Message too long
Unlike IPv4, the IPv6 specification (RFC 2460) does not allow for packet
fragmenta- tion by transit routers. Only the originating host is allowed
to fragment packets. But, how does it know the maximum fragment
size? By using a Path MTU Discovery mechanism, described in RFC
1981. Let’s see how it works.
First, configure IPv6 addresses in the links. Don’t worry about IPv6
routing: IS-IS is automatically advertising the prefixes.
user@PE1> configure
user@PE1# set interfaces ge-1/0/0 unit 111 family inet6 address fc00::100:1:1/112 user@PE1#
commit and-quit
user@P> configure
user@P# set interfaces ge-2/3/0 unit 111 family inet6 address fc00::100:1:2/112 user@P# set
interfaces xe-2/0/0 unit 114 family inet6 address fc00::100:4:2/112 user@P# commit and-quit
user@PE2> configure
user@PE2# set interfaces ge-1/0/1 unit 114 family inet6 address fc00::100:4:1/112 user@PE2#
commit and-quit
The sizes of the IPv6 packet and ICMPv6 headers are 40 and 8 bytes,
respectively. In order to send an IPv6 with exactly the inet6 MTU of the
PE1-P link in bytes, the size value should be: 1510-40-8 = 1462 bytes.
With the video camera on, execute at PE1:
user@PE1> ping fc00::100:4:1 size 1462 count 1
PING6(1510=40+8+1462 bytes) fc00::100:1:1 --> fc00::100:4:1
1240 bytes from fc00::100:1:2: Packet too big mtu = 1500
Vr TC Flow Plen Nxt Hlim
6 00 00000 05be 3a 40
fc00::100:1:1->fc00::100:4:1
ICMP6: type = 128, code = 0
This first IPv6 ping just triggered PMTU Discovery, as you can see in
Capture 4.4 and in Figure 4.6. PE1 just learned about the existence of
a remote link in the path with a lower inet6 MTU = 1500 than the local
link. The next packet to fc00::100:4:1 will be sent taking this information
into account.
Let’s execute again at PE1:
user@PE1> ping fc00::100:4:1 size 1462 count 1
PING6(1510=40+8+1462 bytes) fc00::100:1:1 --> fc00::100:4:1
1470 bytes from fc00::100:4:1, icmp_seq=0 hlim=63 time=1.352 ms
Figure4.6 TooBigICMPv6EchoRequestDiscardedbyTransitIPv6Router
This time PE1 has enough information to make the ping succeed. Figure
4.7 shows
the ICMPv6 echo request. The ICMPv6 echo reply flow is very similar.
You can see all packets at each stage in Capture 4.5.
Figure4.7 FragmentationofICMPv6EchoRequestattheSource
NOTE If you use the matching icmp6 keyword instead, only the first fragments (0|
1448)
show up.
ICMPv4(IPPro ICMPv6(IPv6
tocol1) NextHeader
58)
Destination
Unreachable,
3 4 2 0 Too Big
Fragmentatio
n Needed
Figure4.8 TooBigICMPv4EchoRequestwithDFFlagDiscardedbyIngressMPLSPE
In this case, PE1 is fragmenting the ICMPv4 echo request at the IPv4
layer. The two fragments are then encapsulated into MPLS packets, as
shown in Figure 4.9. In Capture 4.7 you can see both the echo request
and the reply. Try to draw a figure like Figure 4.9 with the latter!
Figure4.9 FragmentationofICMPv4EchoRequestattheIngressMPLSPE
The flow is shown in Figures 4.10 and 4.11. Capture 4.8 has the whole
movie.
Figure4.10 ICMPv4EchoRequestwithDFFlagReachingtheDestination
Figure4.11 ICMPv4EchoReplywithDFFlagDroppedbyIngressMPLSPE
MORE? Check RFC 3209, section 2.6, for an explanation on how RSVP implements
Path
MTU Discovery. All the RFCs are viewable at [Link]
TryItYourself:RateLimitingICMPv4Packets
Find a way to rate limit the incoming ICMPv4 packets without using DDoS Protection or the
global kernel
ICMPv4 policer.
user@P> configure
user@P# edit firewall
user@P# set policer 100K if-exceeding bandwidth-limit 100k burst-size-limit 10k user@P# set
policer 100K then discard
user@P# set family inet filter PROTECT-RE term ICMP from protocol icmp user@P#
set family inet filter PROTECT-RE term ICMP then policer 100K user@P# set family
inet filter PROTECT-RE term ICMP then count lo0-ICMP user@P# set family inet filter
PROTECT-RE term ICMP then accept
user@P# set family inet filter PROTECT-RE term REST then count lo0-REST
user@P# set family inet filter PROTECT-RE term REST then accept
user@P# top
user@P# set interfaces lo0.0 family inet filter input PROTECT-RE
user@P# commit and-quit
TryItYourself:DDoSProtectionProtocols
With the stressing ICMPv4 ping launched from PE1 to PE2, execute at P the command:
user@P> show ddos-protection protocols statistics | match "protocol| arrival" | except " 0 pps"
Here are the results:
Normal transit echo requests are not classified in any protocol group, since they are not
control or exception traffic from the perspective of P, so they bypass the Control Plane.
Command:
user@PE1> ping [Link] rapid count 30000
Transit echo requests with record-route option are classified in protocol group ICMP. Command:
user@PE1> ping [Link] rapid count 30000 record-route
Transit echo requests with TTL expiring at P are classified in protocol group TTL. Command:
user@PE1> ping [Link] ttl 1 interval 0.1 no-resolve
user@P> configure
user@P# set routing-options static route [Link] reject user@P#
commit and-quit
user@PE1> ping [Link] interval 0.1 no-resolve
user@P> configure
user@P# delete routing-options static route [Link]
user@P# commit and-quit
TryItYourself:DataPatterns
ICMPv4 echo replies are echoing the patterns, as expected. Here are the
ping commands: All 0’s:
user@PE1> ping [Link] source [Link] pattern 00 count 1 size 1400
All 1’s:
user@PE1> ping [Link] source [Link] pattern FF count 1 size 1400
Alternating 0 and 1:
user@PE1> ping [Link] source [Link] pattern 55 count 1 size 1400
user@PE1> ping [Link] source [Link] pattern AA count 1 size 1400
Theory of Loops . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 106
Single-Link Loops . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
.110
Particle Accelerators . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 123
In this chapter you are going to dramatically reduce the size and
complexity of the lab: you will just keep P.
Imagine your network is experiencing traffic loss and a thorough
troubleshooting activity based on ping causes you to conclude that, for
whatever reason, a particular router is blackholing traffic. At this point,
and if there is redundancy, you should deviate the traffic so that it
doesn’t transit the suspect router, but do so before restart- ing any
router component, in order not to lose valuable info. A typical first step
in a Service Provider network is to set IGP overload bit or high metrics,
but this only repels transit core traffic at P-routers – in PE-routers you
also need to deactivate BGP sessions and make sure the local router
keeps no egress or transit RSVP LSPs active. Once the router is isolated
from end-user traffic, you can conduct further trouble- shooting for a
limited time... but what can you do?
Another frequent scenario occurs when you connect to a remote router
to perform some proof-of-concept tests, but you don’t know if the
remote router is connected to other devices. It could be a lab router, or
even a pre-production router that you want to health-check. You are
unaware of any back-to-back connections yet the hardware doesn’t
support tunnel services. Let’s also assume there is nobody locally next
to the devices to perform the cabling.
If you think there are very few things you can do with the router,
continue reading! Virtualization is a great strategy and the support of
Logical Systems, Virtual Routers,
and Logical Tunnels with Junos OS makes it very easy to simulate a
whole network
with many routers and switches interconnected. However, the approach
in this book is radically different (and complementary): you can test
most Forwarding Plane features and components in a protocol-less
scenario. No need to think about address- ing schemes, routing
protocols or MPLS signaling. Just set one or more ports in loopback
mode and you will be able to steer and manipulate traffic at will.
But what generates the traffic? Ping. Elementary!
Here are just a couple of the common misconceptions that are
addressed in this chapter:
Myth #1: If a router is dropping traffic and you suspect a
hardware issue, you are most likely to find the root cause only if
you keep the end-user traffic flowing through the router.
Myth #2: You need several (at least logical) routers and a
traffic generator to run Class of Service tests.
Prepare to have these and other myths dispelled in this chapter!
Theory of Loops
This book differentiates between two types of loops:
In half-duplex loops the packets sent out of a port are received
on the same port. In other words, transmission (TX) and reception
(RX) signals are looped in an individual port.
On the other hand, full-duplex loops involve two ports
connected to each other back-to-back: naturally, port A (TX, RX) is
connected to port B (RX, TX).
Let’s explore each loop in a little more detail.
Half-Duplex Loops
Figure5.1 Half-duplexPortLoopbackTechniques
Due to their great flexibility and low requirements, this book uses
local software half-duplex loops as the preferred option for general
applications beyond link troubleshooting. It’s true, they are not
suitable for Control Plane tests involving different Logical Systems or
Virtual Routers running routing protocols with each other, but in the
context of pure Forwarding Plane tests, they simply rock!
In order to generate traffic, there are two classic networking options. If
you ping an IPv4/IPv6 address locally configured at the router’s
interface, make sure you use the interface and bypass-routing options,
otherwise the packet won’t leave the Control Plane. If you ping the
remote address of the link, the packet will loop until TTL expires. (Both
options are covered in detail later in this chapter.)
TIP Some interfaces have keepalives that will detect the loop and bring the
interface
down. Turn them off to bring the port up. For example, in SONET/SDH
interfaces, you can use encapsulation cisco-hdlc and no-keepalive options.
Full-Duplex Loops
Snake Tests
Snakes are test setups where each packet has a long life inside the
router, transiting several interfaces and functional components. Traffic
is steered in a deterministic way with the help of techniques you are
about to peruse.
The classical use case of snakes is illustrated in Figure 5.3:
In the upper and lower part of Figure 5.3, you can see half-
duplex and full- duplex tests, respectively. In this chapter, the
half-duplex scenarios are built with local software loopback, but
physical loops could be an option, too.
On the left hand side, the snake scenarios are simple in that
each packet only transits each link once. On the right hand side,
packets can be looped several times at the same interface. Why?
Well imagine you have a 1Gbps stream and you want to fill a
10GE or a 100GE interface!
Figure5.3 SnakeTestsWithanExternalTrafficGenerator
TryItYourself:MeasuringThroughputwithSnakeTests
Imagine you are performing a bidirectional snake test like the one on the lower left corner
of Figure 5.3. This test involves a 1Gbps flow across twenty different 1GE physical
interfaces in the same PFE. You measure a
90% throughput, in other words, a total 10% loss. What is the real percentage of PFE
throughput?
TIP Snake tests may involve many links. Verify their integrity
individually, watching for framing or link-level errors that could alter
the forwarding capacity measurements.
Single-Link Loops
Let’s configure two independent half-duplex loopback scenarios. First,
pick two unused ports, if possible each in a different Packet Forwarding
Engine (PFE), and configure them in loopback mode. Finally, associate
them to different Virtual Routers in order to avoid a potential address
overlap with the global routing table. Initially, the two ports are down:
user@P> show interfaces ge-2/3/1 | match physical
Physical interface: ge-2/3/1, Enabled, Physical link is Down
user@P> configure
Configure them in loopback mode:
Why are the counters at zero? As you might remember from Figure
2.1, these packets never make it to the Forwarding Plane. You need
to do something else to achieve that:
user@P> ping [Link] bypass-routing interface ge-2/3/1.201 mac-address [Link] rapid count 100
PING [Link] ([Link]): 56 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!
--- [Link] ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss round-
trip min/avg/max/stddev = 0.286/0.454/5.710/0.747 ms
Repeat this procedure for the other interface, in this case xe-2/0/1.201.
You can see the forwarding path in Figure 5.4.
Figure5.4 ForwardingPathofPingbypass-routingtotheLocalIPv4AddressofaHalf-
duplexLoop
IMPORTANT This is not genuine transit traffic. When the ICMPv4 echo
request is received from the interface stream, it goes up to the Control
Plane.
<timestamp> Out IP [Link] > [Link]: ICMP echo request, id 43079, seq 0, length 64
<timestamp> Out arp who-has [Link] tell [Link]
<timestamp> In arp who-has [Link] tell [Link]
user@P> configure
Let’s reconstruct the movie. The mac-address option allows the Control Plane to send the
ICMPv4 echo request, but after the first loop trip, it’s the Forwarding Plane’s turn. ARP
resolution fails, and the packet is finally discarded. Here is the fix:
user@P# set interfaces ge-2/3/1.201 family inet address [Link]/30 arp [Link] mac
[Link]
user@P# set interfaces xe-2/0/1.201 family inet address [Link]/30 arp [Link] mac
[Link] user@P#
commit and-quit
NOTE Dynamic ARP resolution works fine in full duplex loops, so you don’t need
static
ARP there. This is a clear advantage for you to consider.
In this test, you get real transit traffic going through the loops, as you
can see in
Figure 5.5.
The Control Plane sends the ICMPv4 echo request for the first time. At
that point, every time the packet is received from the loop (with TTL >
1) the Forwarding Plane decreases its TTL by one just before again
sending it to the loop. This is done without involving the Control Plane
at all, except for the final time, when TTL expires and the transit packet
becomes an exception.
Figure5.5 ForwardingPathofPingtotheRemoteIPv4AddressofaHalf-duplexLoop
user@P> ping [Link] no-resolve routing-instance VR1 count 1000 ttl 100 interval 0.1
PING [Link] ([Link]): 56 data bytes
/* Output suppressed */
--- [Link] ping statistics ---
1000 packets transmitted, 0 packets received, 100% packet loss
CAUTION The time exceeded counter is global for the system, so it may
increase for other reasons not related to your test – it only accounts for
received ICMPv4 time exceeded messages at the RE.
TIP Line Cards typically have circular buffers. If you want to spot faulty buffer
sectors,
you need to leave the ping running a long time with interval 0.1, big size,
and no
count value. Do it from the console if you want to avoid session
disconnections!
TryItYourself:RemoteLoopbackMo
de
Configure PE1 and the X switch so that each packet sent by PE1 at ge-1/0/0 is looped by X
ge-0/0/11 back to PE1. Tip: look for Configuring Ethernet LFM with Loopback Support in the
Junos technical guides: http:// [Link]/techpubs.
user@P> configure
This test relies on chaining Virtual Routers: for example, a snake of five loops would consist of
this chain: VR1 -> VR2 -> VR3 -> VR4 -> VR5 -> VR1. For simplicity,
let’s just take two Virtual Routers so the chain becomes: VR1 -> VR2 -> VR1. If that is puzzling
it should be much clearer soon!
Configure the snake logic at P:
user@P# set firewall family inet filter to-VR1 term ALL then routing-instance VR1 user@P# set
firewall family inet filter to-VR2 term ALL then routing-instance VR2 user@P# set interfaces ge-
2/3/1 unit 201 family inet filter input to-VR2
user@P# set interfaces xe-2/0/1 unit 201 family inet filter input to-VR1
user@P# set routing-instances VR1 routing-options static route 0/0 next-hop [Link] user@P# set
routing-instances VR2 routing-options static route 0/0 next-hop [Link] user@P# commit and-quit
Figure5.6 ForwardingPathofaHalf-duplexIPv4SnakePingwithTTL=1
user@P> ping [Link] source [Link] no-resolve routing-instance VR1 count 1 ttl 2
PING [Link] ([Link]): 56 data bytes
36 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 fef1 0 0000 01 01 a223 [Link] [Link]
TIP Always check interface counters to verify the accuracy of the numbers.
As you can see in Figure 5.7, the time exceeded message jumps the
other way around, from VR2 to VR1. However, it doesn’t transit the
fabric. In fact, when PFE #2/0
looks up the packet in the context of VR1, it finds out that the
destination address is local and sends the message up to the Control
Plane.
Figure5.7 ForwardingPathofaHalf-duplexIPv4SnakePingwithTTL=2
Making the ICMPv4 echo request jump additional times is just a matter
of increas- ing the TTL. If you choose an odd TTL value (different from
1), the forwarding path looks like the one in Figure 5.8. For example 99:
user@P> ping [Link] source [Link] no-resolve routing-instance VR1 count 1 ttl 99
PING [Link] ([Link]): 56 data bytes
36 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 00d2 0 0000 01 01 a043 [Link] [Link]
Figure5.8 ForwardingPathofaHalf-duplexIPv4SnakePingwithanOddTTL>2
Or, if you choose an even TTL value different from 2, the outcome is as
shown in
Figure 5.9. Give it a try:
user@P> ping [Link] source [Link] no-resolve routing-instance VR1 count 1 ttl 100
PING [Link] ([Link]): 56 data bytes
36 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 02f2 0 0000 01 01 9e23 [Link] [Link]
Figure5.9 ForwardingPathofaHalf-duplexIPv4SnakePingwithanEvenTTL>2
TRYTHIS Add another port to the setup and introduce VR3 in the VR chain.
NOTE Starting with Junos OS 12.2, you can use firewall filter next-interface, next-ip
and
next-ip6 options in Trio, as an alternative to using different Virtual Routers.
user@P> configure
Steering packets with static MPLS paths is much more intuitive, you just need to make the LSP
follow your predetermined path. First, at P, create two new half duplex loops by reusing the
existing physical interfaces but this time with a different VLAN ID:
user@P> configure
user@P# edit protocols mpls
user@P# set static-label-switched-path SNAKE-A-1 ingress to [Link] push 1000001 next-hop
[Link]
user@P# set static-label-switched-path SNAKE-A-2 transit 1000001 swap 1000002 next-hop [Link] user@P#
set static-label-switched-path SNAKE-A-3 transit 1000002 swap 1000003 next-hop [Link] user@P# set static-
label-switched-path SNAKE-A-4 transit 1000003 pop next-hop [Link]
user@P#
top
user@P# commit and-quit
You need a route in inet.0 to target your ping. There are several ways to
achieve that, let’s choose probably the simplest one:
user@P> configure
user@P# set routing-options static route [Link] next-hop [Link] resolve user@P#
commit and-quit
Now you can now follow the snake through all its coils:
user@P> show route forwarding-table destination [Link] table default
Routing table: [Link]
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
[Link]/32 user 0 indr 1048582 2
[Link] Push 1000001 810 2 ge-2/3/1.202
TryItYourself:CountingPacketsatMPLSSnakes
A plain IPv4 snake ping with TTL=1 is illustrated in Figure 5.6. However, the interface
statistics for the
MPLS scenario don’t match that picture at all. What is the actual forwarding path in this
case?
The results with TTL=4 are easier to interpret, according to Figure 5.10:
user@P> ping [Link] no-resolve ttl 4 count 1
PING [Link] ([Link]): 56 data bytes
36 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 ab13 0 0000 01 01 939d [Link] [Link]
Figure5.10 ForwardingPathofaHalf-duplexIPv4OverMPLSSnakePingwithTTL=4
Figure 5.10 still applies in these instances, but this time the TTL value
represents the number of times that the packet goes through the
whole snake. At each iteration, the packet remains in the Forwarding
Plane. Only when the IPv4 TTL finally expires (after loop #16 or full trip
#4), will the Control Plane come into play again.
REMEMBER It’s the Line Card microkernel, and not the Routing Engine,
that’s generating the time exceeded message: but that’s part of the
Control Plane, too!
Particle Accelerators
You are now ready to learn several techniques that can allow you to
simulate a very powerful traffic generator based on ping, without
bothering the Control Plane! While each technique strategy has its
owns pros and cons, become familiar with them and you’ll have a
useful toolset that can create a traffic burst out of virtually anywhere.
Of course, these particle accelerators are not equivalent to commercial
feature-rich traffic generators, but they can be useful in many
situations, in both production and lab networks.
ALERT! Please use the following techniques in a responsible
manner. Never utilize these methods in a production environment,
or without the express permission of the respective owners of the
target routers and networks.
Depending on the angle from which you look in a mirror, you may see
yourself or something else. The classical use of port mirroring in Junos
OS involves copying the traffic from one port to another, in other
words, set the mirror at an angle that allows you to see something else.
We’ll do something slightly different here.
This first particle accelerator technique is very simple, but can take a
long time to figure out. Start by configuring a half-duplex 10GE loop,
and set it as the system- wide port-mirror destination:
user@P> show interfaces xe-2/1/0 | match address
Current address: [Link], Hardware address: [Link]
user@P> configure
user@P# set system no-redirects user@P#
edit interfaces xe-2/1/0 user@P# set
gigether-options loopback
user@P# set unit 0 family inet address [Link]/30 arp [Link] mac [Link] user@P#
top
user@P# edit forwarding-options port-mirroring
user@P# set input rate 1
user@P# set family inet output no-filter-check
user@P# set family inet output interface xe-2/1/0.0 next-hop [Link] user@P#
commit and-quit
user@P> clear interfaces statistics all user@P>
ping [Link] count 1 no-resolve
PING [Link] ([Link]): 56 data bytes
36 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 27f2 0 0000 01 01 7a1f [Link] [Link]
The number of packets matches the default ttl value (64). So far,
it’s business as usual.
Actually, no traffic is being mirrored yet. You could copy traffic from
any other source interface to the mirror destination xe-2/1/0.0, but this
just duplicates the packets. If you want to fill a 10GE interface with
just one ping, you need to do something crazier. How about making
xe-2/1/0.0 not only the mirror destination, but also the mirror source?
NOTE The show interfaces queue command is taking into account Layer 2 headers.
Why are there precisely 10Gbps and no drops? How can it be that
precise? And if you sent one more TTL=10 packet, there would probably
still be no drops. It’s because
TRYTHIS If you send a packet with TTL=255, then you’ll likely see some tail drops.
One of the drawbacks of this looped technique is that the Control Plane
is bothered:
user@P> show system statistics icmp | match "put|
exceed" Output Histogram
Input Histogram
694189 time exceeded /* This value increases all the time */
TryItYourself:GettingRidofTTLExceptions
How can you make the previous particle accelerator work without sending TTL expired
packets to the
Control Plane?
There are basically two main strategies. The first is to make a packet
turn 10,000 times in a loop, while copying the packet (to a different
interface) at each turn. The second is to make 10,000 copies of the
packet in just one turn. Or you can also combine both models. Let’s
start with the first strategy, pure and raw!
Let’s use MPLS. By default, the IPv4 TTL is copied to the MPLS TTL at the
head of a
LSP, and then copied back from MPLS to IPv4 at the tail end. As
discussed in Chapter
1, you can change this default behavior with the no-propagate-ttl knob,
which basically sets MPLS TTL=255 at the head of a LSP, regardless of
the IPv4 TTL value. So you can set the initial IPv4 TTL = 100, make the
packet traverse 100 times a
100-hop static LSP, and you will finally get one packet looping 100 x
100 = 10,000 times. Make sense?
There is still one more hurdle to clear. As seen earlier in this chapter,
it’s better not to cause congestion in your looped ports, or else the
impact of the packet drops is amplified. Instead, making a copy of the
packet at each trip, and then sending the copy out of another non-
looped port is the way to go. This is simply port miroring in Junos OS.
So far so good? But port mirroring is only supported for family inet and
family ccc in the Junos release under test, so MPLS packets cannot be
mirrored – un- less you use yet another trick! Take a deep breath and
check Figure 5.11.
Figure5.11 PortMirroringofMPLSPacketsUsingCCC(circuitcross-connects)
TIP Trio implements lt- inline at the PFE. As for pre-Trio PFEs with
tunnel services implemented at the PIC, make sure the PICs support
at least 2Gbps full duplex per tunnel. Otherwise, it would be better to
use full duplex loops with back-to-back connected 1GE ports instead.
NOTE Make sure your Junos OS release is not affected by: PR/685639: TTL check
skipped
for tunnel packets. Affected maintenance releases are 11.4R1, 11.4R2,
11.4R3,
12.1R1 and 12.1R2.
Let’s go step by step. First, configure the Logical Tunnels that will serve
as a ring for the snake to roll through many times. Execute at P:
user@P> configure
user@P# set chassis fpc 2 pic 0 tunnel-services
user@P# set chassis fpc 2 pic 1 tunnel-services
user@P# set interfaces lt-2/0/0 unit 1 peer-unit 11 encapsulation vlan vlan-id 203 user@P# set
interfaces lt-2/0/0 unit 1 family inet address [Link]/30
user@P# set interfaces lt-2/0/0 unit 1 family mpls user@P#
set protocols mpls interface lt-2/0/0.1
user@P# set interfaces lt-2/0/0 unit 11 peer-unit 1 encapsulation vlan-ccc vlan-id 203 family ccc user@P# set
interfaces lt-2/1/0 unit 11 peer-unit 1 encapsulation vlan-ccc vlan-id 203 family ccc user@P# set protocols
connections interface-switch X interface lt-2/0/0.11
user@P# set protocols connections interface-switch X interface lt-2/1/0.11
user@P# set logical-systems LOOP interfaces lt-2/1/0 unit 1 peer-unit 11 encapsulation vlan vlan-id
203
user@P# set logical-systems LOOP interfaces lt-2/1/0 unit 1 family inet address [Link]/30 user@P# set
logical-systems LOOP interfaces lt-2/1/0 unit 1 family mpls
user@P# set logical-systems LOOP protocols mpls interface lt-2/1/0.1 user@P#
commit and-quit
NOTE The interconnection between the Logical Tunnels is full duplex.
Now let’s build the MPLS snake. You can use the following script to
generate the configuration:
#!/usr/bin/perl
}
else {
}
}
TIP You can load the configuration with load set terminal or load set <filename>.
user@P> configure
You need a route in inet.0 to use it as the ping target:
user@P# set routing-options static route [Link]/32 next-hop [Link] resolve user@P#
commit and-quit
TRYTHIS Follow the snake hop by hop at the forwarding table level.
user@P> configure
This is the same ICMPv4 echo request going 5,000 times forth and 5,000 times back. How
about mirroring all the copies out of P?
user@P# set firewall family ccc filter MIRROR-CCC term MIRROR then port-mirror user@P#
set interfaces lt-2/0/0 unit 11 family ccc filter input MIRROR-CCC user@P# set interfaces lt-
2/1/0 unit 11 family ccc filter input MIRROR-CCC
user@X> configure
Do you want to see the 10,000-times-multiplying effect in a packet capture? Let’s configure
the switch X to achieve that!
Check out Capture 5.1 to watch the MPLS and IPv4 TTL evolution.
What if you raise the initial TTL value or if you increase the hop
number of the snake? Well, up to a value of 127, the number of
mirrored packets would increase, but not if you choose higher values.
Actually, snakes close to 255 hops are quite useless. This may sound
surprising, but a packet capture will tell you why. The answer has to
do with Penultimate Hop Popping.
The expected moment has finally arrived! In order to generate more
than 1Gbps of traffic with one single ping, leave running:
user@P> ping [Link] interval 0.1 ttl 100 no-resolve size 1460
/* Output suppressed */
The 1GE interface is sending traffic at line rate, and discarding excess
traffic. That opens the door to a very juicy set of Class of Service tests
that you’ll see an example of very soon.
TRYTHIS Check the fabric statistics. If you have a Trio PFE, the stats
should be increasing twice as fast as the actual packet rate. The reason
for this appears in Table 3.1.
Figure5.12 PortMirroringofIPv4PacketsUsingNext-hopGroups
Let’s use the existing half duplex loop: ge-2/3/1.202, that you configured
previously as part of a MPLS snake setup, but this time let’s use it for
single-port IPv4 loopback tests. Execute at P:
user@P> clear interfaces statistics all
#!/usr/bin/perl
You can configure the next hop group using this Perl script:
if ((!$ARGV[0]) || (!$ARGV[1])) {
print "Usage: perl [Link] <physical-interface> <mac-address>\n";
exit;
}
One simple value for the MAC address option is a Juniper generic one:
$ perl [Link] ge-2/3/0 [Link]
/* Output Suppressed */
user@P> configure
Once the next-hop group is configured, you just need to mirror the input traffic at ge-2/3/1.202:
Leave running:
user@P> ping [Link] interval 0.1 ttl 250 no-resolve size 1460
/* Output suppressed */
NOTE The two techniques described in this section use a two-stage replication
process.
IPv4Preced
DSCP
ence
3 6
b b
i i
t t
d d B h
bi
bin e e i dec e
n
c c n x
0
00000 x
000 0 000000 0 0
000 0
0
0
00100 x
001 1 001000 8 32
000 2
0
0
1 01000 x
010 2 010000 64
6 000 4
0
0
2 01100 x
011 3 011000 96
4 000 6
0
0
3 10000 x
100 4 100000 128
2 000 8
0
0
4 10100 x
101 5 101000 160
0 000 A
0
0
4 11000 x
110 6 110000 192
8 000 C
0
0
5 11100 x
111 7 111000 224
6 000 E
0
user@P> configure
Firewall filters are your allies. Configure at P a new half-duplex loop able to count packets
based on their IPv4 precedence values:
user@P# edit firewall family inet filter PRECEDENCE-CHECK
user@P# set interface-specific user@P#
set term 0 from precedence 0 user@P# set
term 0 then count prec-0 user@P# set
term 1 from precedence 1 user@P# set
term 1 then count prec-1 user@P# set
term 2 from precedence 2 user@P# set
term 2 then count prec-2 user@P# set
term 3 from precedence 3 user@P# set
term 3 then count prec-3 user@P# set
term 4 from precedence 4 user@P# set
term 4 then count prec-4 user@P# set
term 5 from precedence 5 user@P# set
term 5 then count prec-5 user@P# set
term 6 from precedence 6 user@P# set
term 6 then count prec-6 user@P# set
term 7 from precedence 7 user@P# set
term 7 then count prec-7 user@P# top
user@P# edit interfaces ge-2/3/1 unit 204
user@P# set per-unit-scheduler
user@P# set vlan-id 204 family inet address [Link]/30 arp [Link] mac [Link] user@P# set
family inet filter input PRECEDENCE-CHECK
user@P# commit and-quit
Queued:
Queue: 3, Forwarding classes: network-control
Queued:
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
prec-0-ge-2/3/1.204-i 5376 64
Figure5.13 DefaultCOSTreatmentofaPacketwithIPv4Precedence0inaHalf-duplexLoop
What if you send the echo request with precedence 5? Let’s execute at
P, with the help of the information in Table 5.1:
user@P> clear interfaces statistics all
user@P> clear firewall all
user@P> ping [Link] count 1 no-resolve wait 1 tos 160
/* Output suppressed */
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
prec-5-ge-2/3/1.204-i 5376 64
As you can see above, there is no default IPv4 rewrite-rule, that’s why the
echo request remained with IPv4 precedence 5 all the time. The key
element here is the inet-precedence classifier, which determines the
Forwarding Class that packets received at ge-2/3/1.204 are mapped to. In
other words, it only affects transit traffic in this test. Execute at P:
user@P> show class-of-service classifier name ipprec-compatibility
Classifier: ipprec-compatibility, Code point type: inet-precedence, Index: 13
user@P> configure
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
prec-5-ge-2/3/1.204-i 5376 64
As you can see here, and next in Figure 5.14, the Forwarding Class only
changes in the first hop, when the ICMPv4 echo request exits the
Control Plane. Subsequent hops are ruled exclusively by the
Forwarding Plane, where the lo0.0 filters don’t apply, and only the ge-
2/3/1.204 classifiers do.
Figure5.14
ForwardingClassRemap,viaanOutputlo0.0FirewallFilter,ofaPacketwithIPv4Precedence5
user@P> configure
user@P# set firewall family inet filter lo0-COS term ICMP then dscp 40
user@P> commit and-quit
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
prec-5-ge-2/3/1.204-i 5376 64
user@P> configure
user@P# delete firewall family inet filter lo0-COS term ICMP then dscp user@P#
commit and-quit
NOTE An older knob [edit class-of-service host-outbound-traffic] also
allows you to remap outbound Control Traffic to a different Forwarding
Class and DSCP than the one initially chosen by the RE. This feature is
less flexible since it applies to all the traffic with no granularity.
Going back to Figure 5.14, how can you classify the transit packets as
expedited- forwarding? There are several options, of which the most flexible
is changing the firewall filter chain currently applied to ge-2/3/1.204. The
results are in Figure 5.15. Execute at P:
user@P> configure
user@P# edit firewall family inet filter PREC-TO-FC term PREC5
user@P# set from precedence 5
user@P# set then forwarding-class expedited-forwarding
user@P# set then next term
/* since this is the last term, it will go to the next filter in the chain */
user@P# set interfaces ge-2/3/1.204 family inet filter input-list [ PREC-TO-FC PRECEDENCE-CHECK ]
user@P# commit and-quit
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
prec-5-ge-2/3/1.204-i 5376 64
Figure5.15FurtherFCRemap,viaanInputge-filter,ofaPacketwithIPv4Precedence5
user@P> configure
First, let’s simplify things a little bit:
user@P> configure
Now, configure a filter to count MPLS packets based on the experimental bits, and apply it
to ge-2/3/1.204:
user@P> configure
Ready for a new snake test? Configure at P:
Let’s start first with plain ping with no tos option (by default, it’s 0):
user@P> clear interfaces statistics all
user@P> clear firewall all
user@P> ping [Link] count 1 no-resolve wait 1 ttl 4
PING [Link] ([Link]): 56 data bytes
148 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 0054 b6db 0 0000 01 01 87d1 [Link] [Link]
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
prec-0-ge-2/3/1.204-i 84 1
exp-0-ge-2/3/1.204-i 264 3
TIP If you find it difficult to interpret the results, repeat the test with
increasing values of
TTL, starting from 1 and clearing the counters at each iteration.
Figure 5.16 illustrates the test. When the ICMPv4 echo request is built
by the Routing Engine, the MPLS experimental bits are copied from
the IPv4 precedence. Once the first hop is over, the classification for
transit hops is done upon the code- points – EXP or precedence,
depending on the outermost header – which are all 0. So the
Forwarding Class becomes best-effort. Have a look at the default MPLS
EXP classifier:
Figure5.16 DefaultCOSTreatmentofaPacketwithMPLSEXP=0inaHalf-duplexLoop
Queued:
Packets : 2 0 pps
Bytes : 256 0 bps
Transmitted:
Packets : 2 0 pps
Bytes : 256 0 bps
Queue: 3, Forwarding classes: network-control
Queued:
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
exp-5-ge-2/3/1.204-i 264 3
prec-5-ge-2/3/1.204-i 84 1
Figure5.17DefaultCOSTreatmentofaPacketwithMPLSEXP=5inaHalf-duplexLoopinTrio
Figure 5.17 illustrates the results. The sequence is: host outbound
push, transit swap, transit pop, transit push. The host outbound
operations are performed by the Control Plane, while the transit ones
rely on the Forwarding Plane. Both cases follow a similar logic: copy
the IPv4 precedence into the MPLS EXP bits.
This is a generic fact in all platforms for host outbound MPLS push
operations. However, transit push is a bit different. In pre-Trio
platforms, MPLS interfaces always have an EXP rewrite-rule applied and
the resulting EXP bits depend on the internal COS classification (FC,
PLP) of the packet. On the other hand, Trio plat- forms have no EXP
rewrite-rule applied by default, which explains the IPv4 precedence to
MPLS EXP copy operation you just saw.
user@P> configure
user@P# set class-of-service rewrite-rules exp CUSTOM-EXP-RW import default
user@P# set class-of-service interfaces ge-2/3/1 unit 204 rewrite-rules exp CUSTOM-EXP-RW
user@P# commit and-quit
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
exp-2-ge-2/3/1.204-i 88 1
exp-5-ge-2/3/1.204-i 176 2
prec-5-ge-2/3/1.204-i 84 1
NOTE Although it’s not shown in the picture, in this example the Packet Loss
Priority (PLP)
is low everywhere, except in the hop involving MPLS swap operation.
Figure5.18 COSTreatmentofaPacketwithMPLSEXP=5inaHalf-
duplexLoopwithanEXPRewrite-rule
TryItYourself:PlayingwithMPLSRewriteRules
Modify CUSTOM-EXP-RW so that the EXP values are 5 all over the forwarding path. One
command is enough.
You are about to test COS features of VRFs integrated with a MPLS
core. With no BGP session, and no MPLS network with PEs or Ps
whatsoever. Just a half-duplex local loopback is enough! First,
configure a minimal VRF using a new VLAN on your favorite half-duplex
loop:
user@P# edit interfaces ge-2/3/1 unit 205
user@P# set vlan-id 205
user@P# set family inet address [Link]/30 arp [Link] mac [Link]
user@P# set family inet filter input PRECEDENCE-CHECK
user@P# top
user@P# edit routing-instances VRF-COS
user@P# set instance-type vrf vrf-table-label
user@P# set route-distinguisher 65000:2 user@P#
set vrf-target target:65000:200 user@P# set
interface ge-2/3/1.205
user@P# set routing-options static route [Link]/32 next-hop [Link] user@P#
commit and-quit
The trick here is to send traffic to the VPN label, but you first need to
find its numerical value (in this case it’s 16):
user@P> show route table mpls protocol vpn
16 *[VPN/0] [Link]
to table [Link].0, Pop
user@P> configure
Next, define a static LSP leading to the VRF:
16 *[VPN/0] [Link]
to table [Link].0, Pop
user@P> show firewall | match ge-2/3/1.204 | except " 0" | except filter
exp-5-ge-2/3/1.204-i 176 2
user@P> show firewall | match ge-2/3/1.205 | except " 0" | except filter
prec-5-ge-2/3/1.205-i 84 1
Figure5.19 COSTreatmentofaPacketwithMPLSEXP=5ArrivingtoaVRFviaaHalf-
duplexLoop
user@P> configure
The MPLS packet with EXP=5 is arriving to the VRF from the MPLS core. Suppose that you
want to change the default classification, so that the packet is queued as expedited-forwarding
before exiting the PE-CE interface ge-2/3/1.205. You can do it with an output firewall filter
applied to ge-2/3/1.205, but let’s choose a different approach:
If you send the ICMPv4 echo request again, you should still see it at the
assured-for- warding queue. Why? Well, in the special case of VPN traffic
coming from the MPLS core, it’s the EXP classifier attached to the VRF’s
Label Switched Interface (LSI) that
is the one taking the
lead:
user@P> show class-of-service routing-instance VRF-COS
Routing instance: VRF-COS
user@P> configure
user@P# set class-of-service routing-instances VRF-COS classifiers exp CUSTOM-EXP-CLAS
user@P# commit and-quit
Figure5.20
COSTreatmentofaPacketwithMPLSEXP=5ArrivingtoaVRFwithaCustomLSIClassifier
Imagine that you need to give preferential treatment to traffic sourced from or destined for
certain customers. And you want to do it regardless of the input inter- face. You don’t know
the list of the prefixes assigned to these customers, which, on the other hand, changes very
often. All you are given is the community of their BGP routes: 65000:101. Normally, to test this
you would have to set up a relatively com- plex scenario. However, as a pure Forwarding Plane
feature, you can also do it with a half-duplex loop! First, you need to modify the forwarding
table by tagging the
special routes with a class. There are two kinds of classes: source-class and destina- tion-class,
depending on whether the traffic is classified according to its source or destination address,
respectively. Let’s test destination-class now and leave source- class as an exercise for you to do at
your convenience. Configure at P:
user@P# set routing-options static route [Link]/32 next-hop [Link] community 65000:101 user@P#
set policy-options community SPECIAL-TREATMENT members 65000:101
user@P# set policy-options policy-statement CLASS-SET term SPECIAL-DEST from community SPECIAL-
TREATMENT
user@P# set policy-options policy-statement CLASS-SET term SPECIAL-DEST then destination-class GOLD
user@P# insert routing-options forwarding-table export CLASS-SET before LB
user@P# commit and-quit
You are half-way done. For the moment, traffic is classified as usual:
user@P> clear interfaces statistics all
user@P> ping [Link] count 1 no-resolve wait 1
user@P> configure
You need to define a mapping between destination-class GOLD to forwarding-class expedited-forwarding,
by configuring:
Queued:
Queue: 3, Forwarding classes: network-control
Queued:
MORE? Read sections Configuring SCU or DCU and Applying Filters to Forwarding
Tables
in the Junos technical guides, [Link]
This is just an example of a relatively exotic feature that you can easily
test with a poor-man scenario. Virtually any feature implemented in
the Forwarding Plane can be tested in this manner: unicast RPF checks,
complex firewall filtering or policing, and a large list only limited by
imagination and... well, also by what’s implemented in Junos OS to
date.
Queue Scheduling with Just One Ping
user@P> configure
Remember the one-ping test filling a 1GE port by decoupling MPLS and IPv4 TTL? Let’s start it
again in terminal #1:
user@P> ping [Link] interval 0.1 ttl 100 no-resolve size 1460
PING [Link] ([Link]): 1460 data bytes
36 bytes from [Link]: Time to live exceeded
Vr HL TOS Len ID Flg off TTL Pro cks Src Dst
4 5 00 05d0 f768 0 0000 01 01 41ca [Link] [Link]
/* Output suppressed */
user@P> configure
Currently, all the replicated traffic is going out of ge-2/3/0 as best-effort. Looking back to Figure
5.11, there are two interfaces mirroring traffic: lt-2/0/0.11 and
lt-2/1/0.11. In terminal #2, make one of the interfaces mirror traffic as best-ef- fort, and the
other as expedited-forwarding:
Queued:
Packets : 277013449691 pps
Bytes : 4249371126 609817336 bps
Transmitted:
Packets : 277013449691 pps
Bytes : 4249371126 609817336 bps
Queue: 1, Forwarding classes: expedited-forwarding
Queued:
Packets : 277012349689 pps
Bytes : 4249147070 609775872 bps
Transmitted:
Packets : 1782325 31797
pps Bytes : 2733946054 390200816 bps Tail-dropped
packets : 763229
13649 pps RED-dropped packets :
224569 4243 pps Low :
224569 4243 pps
RED-dropped bytes : 344470114 52078592 bps
Low : 344470114 52078592 bps
Queue: 2, Forwarding classes: assured-forwarding
Queued:
Queue: 3, Forwarding classes: network-control
Queued:
NOTE The Bytes row displays total byte count followed by the bps (bits per
second).
The drops are taking place in the expedited-forwarding queue, due to the
default scheduling:
user@P> show class-of-service interface ge-2/3/0 | match scheduler
Scheduler map: <default>, Index: 2
low
user@P> configure
As a sample of what you can test in this scenario, try to wildly privilege expedited- forwarding in
order to shift drops to the best-effort queue:
TRYTHIS Send traffic in different queues in the Loop Till it Burns setup discussed a
few pages
ago. The packets should be nicely spread according to priorities and
bandwidth reservations.
First, in a full duplex test involving 20 ports, the number of hops in one direction is half
of the number of links: 10.
The original question is tough to answer from a mathematical perspective. The reverse is
easier, though: if the probability of a packet to be dropped in a hop is N%, what would be the
measured loss in the snake test? Assume that the physical links are healthy and all the
routes are in place. If a packet doesn’t reach the receiver, there are 10 possibilities: it may
have been dropped in hop #1, or in hop #2, etc., or finally in hop #10. You already know the
probability for the packet to be dropped in hop #1: N%. For the packet to be dropped in hop
#2, two things must happen: first, that it wasn’t dropped in hop #1, and second, that once
it reaches hop #2 it is dropped there. The probabilities of these two events are (100-N)%
and N%, respectively. The probability for the combined event is: [(100-N)/100]*N %. You
can iterate this logic with the following perl script:
#!/usr/bin/perl
if ($number_of_hops > 0) {
for ($i = 1; $i < $number_of_hops; $i++) {
$drop_probability += ($per_hop_drop_percent / 100) * (1 - $drop_probability);
}
}
Then do a binary search, trying different possible values of $per_hop_drop_percent until you hit
a $drop_per- cent of 10%. The $number_of_hops is always 10:
$ perl [Link] 10 10
The total drop probability in the path is 65.13215599%
$ perl [Link] 10 1
The total drop probability in the path is 9.56179249911955%
So the real throughput is 100-1.05 = 98.95 %. Much better than 90%, wouldn’t you say?
TryItYourself:RemoteLoopbackMode
The key is that icmp-tunneling is active, so the time exceeded message is MPLS switched to
the tail of the snake. Figure 5.21 shows the forwarding path. To move on, remove the
icmp-tunneling knob:
user@P> configure
user@P# delete protocols mpls icmp-tunneling
user@P# commit and-quit
Figure5.21 ForwardingPathofaHalf-duplexIPv4overMPLSSnakePingwithTTL=1
TryItYourself:GettingRidofTTLExceptions
First, stop the particle accelerator in order to clean the state and start from scratch:
user@P> configure
user@P# deactivate interfaces xe-2/1/0 unit 0 family inet filter user@P#
commit and-quit
Now start it again, adding counters to measure the TTL of the packets in the loop:
user@P> configure
user@P# edit firewall family inet filter MIRROR-INET
user@P# set term MIRROR then next term
user@P# set term TTL-1 from ttl 1 user@P#
set term TTL-1 then count TTL-1 user@P# set
term TTL-2 from ttl 2 user@P# set term TTL-
2 then count TTL-2 user@P# set term TTL-3
from ttl 3 user@P# set term TTL-3 then count
TTL-3 user@P# set term TTL-4 from ttl 4
user@P# set term TTL-4 then count TTL-4
user@P# set term TTL-5 from ttl 5 user@P#
set term TTL-5 then count TTL-5 user@P# set
term TTL-6 from ttl 6 user@P# set term TTL-
6 then count TTL-6 user@P# set term TTL-7
from ttl 7 user@P# set term TTL-7 then count
TTL-7 user@P# set term TTL-8 from ttl 8
It’s easy to stop these Control Plane exceptions. Just discard the TTL=1 packets with the
firewall filter: they will still be copied and keep filling the port!
user@P> configure
user@P# set firewall family inet filter MIRROR-INET term TTL-1 then discard user@P#
commit and-quit
Appendix
PE1 (MX80)
CAUTION Do not add a default IPv4 route at CE1. It’s missing on purpose.
interfaces {
ge-1/0/0 {
vlan-tagging;
unit 101 {
vlan-id 101;
family inet {
address [Link]/30;
}
family inet6 {
address fc00::1:2/112;
}
}
unit 111 {
vlan-id 111;
family inet {
address [Link]/30;
}
family iso;
family mpls;
family inet6;
}
}
ge-1/0/1 {
vlan-tagging;
unit 101 {
vlan-id 101;
family inet {
address [Link]/30;
}
family inet6 {
address fc00::1:1/112;
}
}
unit 112 {
vlan-id 112;
family inet {
address [Link]/30;
}
family iso;
family mpls;
family inet6;
}
}
lo0 {
unit 0 {
family inet {
address [Link]/32;
}
family iso {
address 49.0101.1100.1001.00;
}
}
}
}
routing-options {
autonomous-system 65000;
forwarding-table {
export LB;
}
}
protocols {
mpls {
ipv6-tunneling; interface ge-
1/0/0.111; interface ge-
1/0/1.112;
}
bgp {
group IBGP {
type internal;
local-address [Link];
family inet-vpn {
unicast;
}
}
}
isis {
level 1 disable;
interface ge-1/0/0.111 {
point-to-point;
}
interface ge-1/0/1.112 {
point-to-point;
}
interface lo0.0 {
passive;
}
}
ldp {
interface ge-1/0/0.111;
interface ge-1/0/1.112;
}
rsvp {
interface ge-1/0/0.111;
interface ge-1/0/1.112;
}
}
policy-options {
policy-statement LB {
then {
load-balance per-packet;
}
}
}
routing-instances
{ CE1 {
instance-type virtual-router;
interface ge-1/0/0.101; routing-
options {
rib CE1.inet6.0 {
static {
route 0::0/0 next-hop fc00::1:1;
}
}
}
}
VRF1 {
instance-type vrf;
interface ge-1/0/1.101;
route-distinguisher 65000:1; vrf-
target target:65000:100; vrf-
table-label;
}
}
P (MX480)
interfaces {
ge-2/3/0 {
vlan-tagging;
unit 111 {
vlan-id 111;
family inet {
P is a P-router with two physical and four logical uplinks.
address [Link]/30;
}
family iso;
family mpls;
}
unit 113 {
vlan-id 113;
family inet {
address [Link]/30;
}
family iso;
family mpls;
}
}
xe-2/0/0 {
vlan-tagging;
unit 112 {
vlan-id 112;
family inet {
address [Link]/30;
}
family iso;
family mpls;
}
unit 114 {
vlan-id 114;
family inet {
address [Link]/30;
}
family iso;
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address [Link]/32;
}
family iso {
address 49.0101.1101.1011.00;
}
}
}
}
routing-options {
forwarding-table {
export LB;
}
}
protocols {
mpls {
interface ge-2/3/0.111;
interface ge-2/3/0.113;
interface xe-2/0/0.112;
interface xe-2/0/0.114;
}
isis {
level 1 disable;
interface ge-2/3/0.111 {
point-to-point;
}
interface ge-2/3/0.113 {
point-to-point;
}
interface xe-2/0/0.112 {
point-to-point;
}
interface xe-2/0/0.114 {
point-to-point;
}
interface lo0.0 {
passive;
}
}
ldp {
interface ge-2/3/0.111;
interface ge-2/3/0.113;
interface xe-2/0/0.112;
interface xe-2/0/0.114;
}
rsvp {
interface ge-2/3/0.111;
interface ge-2/3/0.113;
interface xe-2/0/0.112;
interface xe-2/0/0.114;
}
}
policy-options {
policy-statement LB {
then {
load-balance per-packet;
}
}
PE2 (MX80)
CAUTION Do not add a default IPv4 route at CE2. It’s missing on purpose.
interfaces {
ge-1/0/0 {
vlan-tagging;
unit 102 {
vlan-id 102;
family inet {
address [Link]/30;
}
family inet6 {
address fc00::2:2/112;
}
}
unit 113 {
vlan-id 113;
family inet {
address [Link]/30;
}
family iso;
family mpls;
family inet6;
}
}
ge-1/0/1 {
vlan-tagging;
unit 102 {
vlan-id 102;
family inet {
address [Link]/30;
}
family inet6 {
address fc00::2:1/112;
}
}
unit 114 {
vlan-id 114;
family inet {
address [Link]/30;
}
family iso;
family mpls;
family inet6;
}
}
lo0 {
unit 0 {
family inet {
address [Link]/32;
filter {
input BLOCK-ICMP;
}
}
family iso {
address 49.0101.1100.2002.00;
}
}
}
}
routing-options {
autonomous-system 65000;
forwarding-table {
export LB;
}
}
protocols {
mpls {
ipv6-tunneling; interface ge-
1/0/0.113; interface ge-
1/0/1.114;
}
bgp {
group IBGP {
type internal;
local-address [Link];
family inet-vpn {
unicast;
}
}
}
isis {
level 1 disable;
interface ge-1/0/0.113 {
point-to-point;
}
interface ge-1/0/1.114 {
point-to-point;
}
interface lo0.0 {
passive;
}
}
ldp {
interface ge-1/0/0.113;
interface ge-1/0/1.114;
}
rsvp {
interface ge-1/0/0.113;
interface ge-1/0/1.114;
}
}
policy-options {
policy-statement LB {
then {
load-balance per-packet;
}
}
}
firewall {
family inet {
filter BLOCK-ICMP {
term ICMP {
from protocol icmp;
then reject;
}
term REST {
then accept;
}
}
}
}
routing-instances {
CE2 {
instance-type virtual-router;
interface ge-1/0/0.102; routing-
options {
rib CE2.inet6.0 {
static {
route ::/0 next-hop fc00::2:1;
}
}
}
}
VRF2 {
instance-type vrf;
interface ge-1/0/1.102;
route-distinguisher 65000:1; vrf-
target target:65000:100; vrf-
table-label;
}
}
X (EX4200)
interfaces {
ge-0/0/10 { mtu 1600; unit 0 {
The switch performs a double role. First, it allows for flexible connections between routers,
and second, it mirrors traffic towards the host.
family ethernet-switching {
port-mode access;
vlan {
members v120;
}
}
}
}
ge-0/0/11
{ mtu
1600; unit
0{
family ethernet-switching {
port-mode trunk;
vlan {
members [ v101 v111 ];
}
filter {
input NO-ARP;
}
}
}
}
ge-0/0/12
{ mtu 1600;
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ v111 v113 ];
}
}
}
}
ge-0/0/13
{ mtu 1600;
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ v113 v102 ];
}
}
}
}
ge-0/0/14
{ mtu 1600;
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ v101 v112 ];
}
filter {
input NO-ARP;
}
}
}
}
ge-0/0/15
{ mtu 1600;
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ v114 v102 ];
}
}
}
}
xe-0/1/0
{ mtu 1600;
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ v112 v114 ];
}
}
}
}
}
firewall {
family ethernet-switching {
filter NO-ARP {
term NO-ARP {
from {
ether-type arp;
vlan v101;
}
then discard;
}
term REST {
then accept;
}
}
}
}
ethernet-switching-options {
analyzer test-server {
input {
ingress {
vlan v101;
vlan v102;
vlan v111;
vlan v112;
vlan v113;
vlan v114;
}
}
output {
vlan {
v120 {
no-tag;
}
}
}
}
}
vlans {
v101 {
vlan-id 101;
}
v102 {
vlan-id 102;
}
v111 {
vlan-id 111;
}
v112 {
vlan-id 112;
}
v113 {
vlan-id 113;
}
v114 {
vlan-id 114;
}
v120 {
vlan-id 120;
}
}
NOTE With the no-tag knob, mirrored packets will only have the original VLAN tag
(101-102,111-114), but not the VLAN 120 tag. Without the knob, there
is a double VLAN stack. You can safely ignore commit warning
messages related to this mirror- ing configuration.
H (FreeBSD)
IMPORTANT The later two pings are expected to fail at this stage.
Verify that everything is fine at the ISIS and LDP level. The following
commands are executed on PE1, you can do similar checks for P and
PE2, too:
user@PE1> show isis adjacency
Interface System L State Hold (secs) SNPA
ge-1/0/0.111 P 2 Up 26 ge-1/0/1.112 P 2 Up
21
No BGP sessions are established, since you did not configure any
neighbors yet (that is expected):
user@PE1> show bgp summary
Groups: 0 Peers: 0 Down peers: 0
Table Tot Paths Act Paths Suppressed History Damp State Pending
bgp.l3vpn.0
0 0 0 0 0 0 user@PE1> show route table CE1
[Link].0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both