For many people, this is the only book on JUNOS they will need." Pradeep Sindhu, CTO and Founder, Juniper Networks "This cookbook is superb.. A Juniper Networks core router would have to
Trang 1By Aviva Garrett
Publisher: O'Reilly Pub Date: April 2006 Print ISBN-10: 0-596-10014-0 Print ISBN-13: 978-0-59-610014-8 Pages: 682
Table of Contents | Index
The Juniper Networks routing platforms are becoming the go-to solution for core, edge, metro and remote office networks, and JUNOS software is behind it all The operating system is so full of industrial-strength routing protocols and IP innovations that those treading into the world of JUNOS will need clarification, explanation, and a showcase
example or two Look no further This JUNOS Cookbook provides it all and more.
dollar training course, but JUNOS's interprocess sophistication can be baffling unless you know the shortcuts and tricks, as well as those rays of illuminating comprehension that
Yes, you can mine through the 5,000 pages of documentation or take a two-thousand-can come only from those who live with it JUNOS Cookbook is the first comprehensive
book about JUNOS software and it provides over 200 time-saving step-by-step techniques including discussions about the processes and alternative ways to perform the same task It's been tested and tech-reviewed by field engineers who know how to take JUNOS out for
a spin and it's applicable to the entire line of M-, T-, and J-series routers JUNOS Cookbook
will not only pay for itself the first few times you use it, it will make your network easier to manage and update.
"Aviva Garrett has done a tremendous job of distilling the features of JUNOS software in a form that will be useful for a wide audience-students, field engineers, network architects, and other networking professionals alike will benefit from this book For many people, this
is the only book on JUNOS they will need."
Pradeep Sindhu, CTO and Founder, Juniper Networks
"This cookbook is superb Aviva Garrett has masterfully assembled a complete set of practical real-world examples with step-by-step instructions Security, management,
routing: it's all here!"
Stephen Gill, Research Fellow, Team Cymru
"A technical time-saver for any NOC or SOC working with JUNOS It's clear, concise, and
Trang 2informative recipes are are an invaluable resource " Scott A McIntyre, Security Officer, XS4ALL Internet B.V
Trang 3By Aviva Garrett
Publisher: O'Reilly Pub Date: April 2006 Print ISBN-10: 0-596-10014-0 Print ISBN-13: 978-0-59-610014-8 Pages: 682
Recipe 1.13 Configuring the Router by Copying Text from a Terminal Window Recipe 1.14 Backing Up the Router's Configuration
Trang 6Recipe 7.10 Choosing Primary and Preferred Interface Addresses Recipe 7.11 Using the Management Interface
Recipe 7.12 Finding Out What IP Addresses Are Used on the Router Recipe 7.13 Configuring Ethernet Interfaces
Recipe 7.23 Dealing with Nonconfigurable Interfaces
Recipe 7.24 Configuring Interfaces Before the PICs Are Installed Chapter 8 IP Routing
Recipe 8.9 Load-Balancing Traffic Flows
Trang 10Recipe 16.7 Configuring Multiple RPs in a PIM-SM Domain Anycast PIM Recipe 16.8 Limiting the Group Ranges an RP Services
Trang 11Printed in the United States of America
Published by O'Reilly Media, Inc., 1005 Gravenstein HighwayNorth, Sebastopol, CA 95472
O'Reilly books may be purchased for educational, business, orsales promotional use Online editions are also available for
Copyeditor: Laurel R.T.
Ruma
Cover Illustrator: Riverside Natural History
Proofreader: Matt
Hutchinson Illustrators:
Robert Romano, Jessamyn Read, and Lesley Borash
Trang 12Many of the designations used by manufacturers and sellers todistinguish their products are claimed as trademarks Wherethose designations appear in this book, and O'Reilly Media, Inc.was aware of a trademark claim, the designations have beenprinted in caps or initial caps
While every precaution has been taken in the preparation of thisbook, the publisher and author assume no responsibility for
errors or omissions, or for damages resulting from the use ofthe information contained herein
ISBN: 0-596-10014-0
[M]
Trang 13The early days at Juniper Networks were not for the faint ofheart Joining during the hiring rush of early 1997, I found thatthe cubes and offices of the small office in Santa Clara,
California were already packed with experienced old
handspeople whom I knew had been around the block oncebefore and would not be shy of expressing themselves
Everyone had strong views on nearly every aspect of building arouter from scratch If you had the misfortune to sit next to abusy conference room, a good pair of headphones and large CDcollection were required to drown out the arguments Designmeetings often became heated, and egos were occasionallybruised Our friends from previous employers taunted us withpredictions of doom
Despite the arguments, we were all united and driven by onesolitary goal: to win the competition to build the best Internetcore router available This was a serious challenge, consideringthe primary competition was a 300-pound gorilla in the form ofCisco Systems Beating Cisco would require us to produce arouter that tackled the perceived weaknesses in its core routerplatform A Juniper Networks core router would have to provideline-rate performance (which, for the M40 router meant
forwarding around 40 million packets per second), robust corerouting protocols, and stable control software In short, it had
to make customers really want to use it
The performance requirements meant that the network traffichad to be forwarded entirely in hardware This was somethingthat had never before been attempted for a core network
router As a result, the hardware design of the M40 looked likescience fiction to Juniper recruits who had worked on other
networking products The entire forwarding path of the routerwas constructed from four Application Specific Integrated
Trang 14verification team to check that the designs were functionallycorrect Since Silicon Valley was littered with networking
startups that had failed because of silicon design problems,there was enormous pressure on the ASIC teams to get it rightfirst time We all knew that a failed ASIC would probably sinkthe company
Not that there was any less pressure on the software teams.Convincing customers to deploy a brand newand essentiallyuntriedcore router into the very heart of their networks is anenormous task A new router that crashes, forwards packetserratically, or just basically behaves weirdly won't make anyfriends in the network operations team and will find itself
unceremoniously removed from the network The problem isthat designing and implementing a core router that works
completely reliably is a feat that has defeated many companies.And those were "simple" routers where the packets had beenforwarded by software In contrast, not only did the Juniperrouter require robust routing protocols that could scale to thelargest networks, but it also had to have a robust software
infrastructure on the CPU-based control boards that managedthe fiendishly complicated packet-forwarding ASICs Just likethe ASIC team, the software team had to get it right the firsttime
The JUNOS team started from a basic FreeBSD software baseand reworked much of the network software in the kernel Newuser daemons were written, and a carrier-grade routing
protocol suite was implemented The routing protocols had to
be designed to scale to the largest networks and be robust
enough to withstand wild fluctuations in the networks aroundthem, something that the competing routers often struggled
Trang 15design high-quality routing protocol implementations Potentialcustomers still had to be convinced that the new protocol
implementations would interoperate safely within their existingnetworks To allow early evaluation, a fledgling JUNOS systemappeared in the form of Olive, which was a standard rackmount
PC pretending to be a JUNOS routing engine board This
prototype system was delivered to potential customers to givethem a feel for the current state of the system and to allow therouting protocols to be debugged
Juniper had outgrown the offices it occupied in Santa Clara andmoved to Mountain View, just off of Highway 237 We didn'ttrust the movers to shift the servers between sites and decided
to move all the systems ourselves At one point, we realizedthat all of Juniper's primary software servers were loaded intojust one car; paranoia dictated that we split them between twocars just in case something happened on the short drive to thenew office We drove gingerly to the new site once the rush
hour had finished and breathed a huge sigh of relief when allthe servers powered up again We also got a surprise bonuswhen we arrived at the new site The previous occupants of ournew office block had left a huge rat's nest of network cables intheir old data center; they'd obviously decided that it was justtoo much work to untangle it However, since money was tight,
we refused to throw the huge bundle of cables out and spentthe next couple of weeks teasing CAT5 cables out of the jumbleduring quiet moments There were enough cables from the
bundle to let us completely rewire the first software engineeringlab for free
Throughout 1997 and early 1998, all the Juniper engineeringteams worked pretty much flat-out to finish the M40 The
engineering labs were seldom quiet, and it was hard to tell theweekends from the weekdays by counting cars in the parkinglot The software teams designed and implemented a truly
Trang 16FreeBSD kernel extensions were added to provide support forchassis management and new Juniper network interfaces Aclean user interface was designed and implemented to provide
a seamless interface to the system and prevent users from
having to edit raw configuration files by hand An entire
embedded microkernel was written to manage the packet-forwarding engine boards in the system (a fully-loaded M40would have nine PFE-related boards), which would allow users
to exchange configuration and status messages with the routingengine and each other Drivers for the embedded microkernelwere written to manage the ASICs and to allow the route
engine to configure the PFE The size and complexity of the
software required to manage just the various control boardseventually grew to rival the route engine itself
The real headache for the software team was that the hardwarewasn't available to test with It can take many months after asystem is assembled in the engineering lab to get it to a usablestate as a complete system But Juniper couldn't afford for us tospend six months in the lab; there just wasn't enough money ortime The solution was to get extremely creative with test
equipment, evaluation boards, and generic PCs before the finalhardware was available All sorts of emulation environmentswere developed to allow the new routing engine and embeddedsoftware to be debugged ahead of the actual hardware For
months, we used a motley collection of machines cobbled
together from parts and equipment that emulated the final
hardware We didn't really have to disguise the lab for externalvisitorsthey wouldn't have been able to guess that each rattybundle of machines was a virtual M40
The payback from this approach was enormous When the
hardware finally arrived, it took just one week in the
engineering lab for the first network packets to be forwardedsuccessfully! Considering the complexity of the routing engineand PFE interaction, this was a monumental achievement and
Trang 17September of 1998
Designing and implementing the first release of the JUNOS
software was an unforgettable time Although the reader maythink I've concentrated way too much on the hardware, the
JUNOS software is intrinsically the way it is because of the
hardware That it has gone through so many iterations sincethen, and continues to evolve with the advancement of Juniperrouters, is the first item you should learn in this book
The second thing that you should know is that although creatingthe JUNOS software really was a team effort, Aviva Garrett hadthe dubious task of documenting our efforts In fact, she wrotethe first manual And then, as the manager of Juniper Networkstechnical publications, she led the effort from Version 1.0 untilvery recently, somewhere after 7.x Now she has come backand worked on this marvelous book for an entire year, revisitingeverything we once did and everything that has evolved since
those early days JUNOS Cookbook represents a full circle for
the JUNOS software suite somehow, looping from those early,midday conference room marathons to today's ability to route alarge portion of the world's network traffic Aviva and her team
of reviewers and technical experts have broken it all down intobite-size recipes and discussions that make today's complexarray of features seem like that simple, erudite version we
Trang 18The JUNOS software comprises several dozen processes, ordaemons, rather than a single process, so you can stop asingle process and restart it without having to reboot theentire router
Trang 19The actual forwarding of packets is performed by customhigh-speed Application-Specific Integrated Circuits (ASICs),while routing is performed by a CPU in a small PC that isbuilt into the router This separation of the routing and
The first version of JUNOS software, released in 1998 with thefirst router, the M40 router, focused on features for large-
capacity Internet service provider (ISP) and telephone company(telco) networks Like any network operating system, additionsare regularly being made to the software to incorporate newtechnologies, protocols, and feature sets The JUNOS software
is updated four times per year JUNOS Cookbook was written for
Release 7.4, which shipped at the end of 2005 You will find,however, that most of the recipes in this book also work on
earlier software releases, and they should continue to work onfuture releases All recipes in this book were developed on M7i
Trang 20JUNOS Cookbook is not intended to replace the detailed feature
information available on the Juniper Networks web site
provide details about how particular protocols actually work,and you can find this information in the Internet EngineeringTask Force (IETF) Request for Comment (RFC) and Internet
draft documents (http://www.ietf.org), as well as in a wide
router configuration or script that you can use to resolve thatparticular problem A discussion section then describes the
solution, how it works, and when you should or should not use
Trang 21I have tried to construct the recipes so that you can turn
directly to the one that addresses your specific problem and find
a useful solution without needing to read the entire book If thesolution includes terms or concepts you are not familiar with,the chapter introductions should help bridge the gap Many
recipes refer to other recipes or chapters that discuss relatedtopics I have also included a variety of references to other
sources in case you need more background information on aparticular subject
The chapters are organized by the feature or protocol
discussed If you are looking for information on a particular
feature such as BGP, MPLS, or SNMP, you can turn to that
chapter and find a variety of related recipes Most chapters listbasic problems first and any unusual or complicated situationslast But there are some exceptions to this, such as where I
Trang 22Describes how to use IPSec to encrypt and secure trafficThe next three chapters focus on managing the router:
Explains how to properly set the time on your router, bothmanually and using NTP, to synchronize time across allnetwork devices
Discusses router interfaces and how to configure interfaceproperties, including the physical device itself as well as allnetwork addresses associated with an interface, includingIPv4, IPv6, and ISO addresses
The next six chapters cover various aspects of IP routing:
Trang 23Looks at IP routing in general, including routing tables,route preferences, and selecting active routes
Discusses routing policy, which control the routes that arestored in and advertised from the routing tables Thischapter also covers firewall filters, which are applied totraffic entering and exiting router interfaces
Trang 24Discusses MPLS, which is commonly used along with RSVPfor traffic engineering
Italic
Used for commands, filenames, directories, script variables,keywords, emphasis, technical terms, and Internet domainnames
Constant width
Trang 26Acknowledgments
I have been a professional technical writer for 25 years, and Inever imagined how huge an undertaking it would be to write abook on JUNOS software as the sole responsible author Writingany technical book, especially one like this, is never a projectthat a single person does by herself There are always manypeople involved to review the topics included in the book,
answer questions, review drafts, and set up and maintain labequipment Many people helped me in all these areas, providing
me both with general help and with comments in their
particular area or areas of JUNOS and networking expertise.Without their time and patience, this book would not have beenpossible These people include Zaid Albanna, Arthi Ayyangar,Serpil Bayraktar, Ron Bonica, Avram Dorfman, Jeff Doyle, Simon
Trang 27Julian Lucek, Ivan Lum, Umesh Mangla, Pedro Marques, BrianMatheson, Scott McIntyre, Ina Minei, Andrew Partan, PrakeshPatil, David Ranch, Yakov Rehkter, Rich Salaiz, Phil Shafer,
Nischal Sheth, Gary Tate, Paras Trivedi, Quaizar Vohra, Jim
Washburn, Chris White, and Kiho Yum Vijay Gill, John Heasley,and Scott McIntyre helped by providing JUNOS output used toexplain a few of the recipes
Mike Bushong was a great help in setting up and maintainingthe router labs used to develop this book Richard Hendricks,Brian Matheson, and Michael Estrada also helped with the lab.Sonia Saruba considerably improved on my writing by editingthe entire manuscript
I would also like to thank a few key people who encouraged me
to undertake and continue this project, especially Patrick Ames,who kept me focused, and also Michael Taillon, Scott Kriens,and Allen Lo
Everybody at O'Reilly was great to work with I particularly
appreciate the input from my editors, David Brickner and MikeLoukides They helped to create a book of which we can all beproud
Finally, I must thank my husband David and my daughter Sagefor helping me through this project
Aviva Garrett Saratoga, California
Trang 28
Chapter 1 Router Configuration and File Management
Recipe 1.12 Configuring the Router by Copying a File from
a Server
Recipe 1.13 Configuring the Router by Copying Text from aTerminal Window
Recipe 1.14 Backing Up the Router's Configuration
Trang 29Recipe 1.17 Loading a Previous Router Configuration
Recipe 1.18 Creating an Emergency Rescue Configuration
Series Routers
Recipe 1.19 Backing Up Filesystems on M-Series and T-Recipe 1.20 Backing Up Filesystems on J-Series RoutersRecipe 1.21 Restoring a Backed-Up Filesystem
Series and T-Series Routers
Recipe 1.22 Installing a Different Software Release on M-Series Routers
Recipe 1.23 Installing a Different Software Release on J-Recipe 1.24 Creating an Emergency Boot Disk
Recipe 1.25 Gathering Software Version Information
Recipe 1.26 Gathering Hardware Inventory InformationRecipe 1.27 Finding Out How Long the Router Has Been Up
Recipe 1.28 Gathering Information Before Contacting
Support
Recipe 1.29 Managing Routers with Similar ConfigurationsRecipe 1.30 Managing Redundant Routing Engines
Recipe 1.31 Using the Second Routing Engine to Upgrade
to a New Software Version
Trang 30Juniper Networks routers are specialized network devices thatrun network operating system software, which is called JUNOSsoftware In this book, we talk about JUNOS features that run
series and T-series platforms are larger routers typically used
on the J-series, M-series, and T-series router platforms The M-by network service providers, telephone companies, large
enterprise companies, and universities The J-series routers aresmaller routers designed for use by businesses and other
organizations to connect multiple sites or to connect to the
Internet The JUNOS software is pre-installed on a new JuniperNetworks routers: when you turn the router on, the softwareautomatically starts running The first task you have to perform
is configuring the router
JUNOS software is distributed as a set of modular software
packages that contain the various components of the software
A given JUNOS software release runs on all J-series, M-series,and T-series routers The examples in this book are based onthe JUNOS 7.4 release of the software on either M20 routers orJ2300 routers, but all are applicable for the most recent JUNOSreleases and for future releases on the M-, T-, and J-series
families of routers
This chapter discusses basic router configuration, including how
to configure the router for the first time, configuring from thecommand-line interface ( CLI), loading and saving configurationfiles, and working with the filesystems and files used by theJUNOS software It also discusses how to upgrade the JUNOSsoftware and how to gather hardware and software inventoryinformation
When you first start a router, you must configure basic networkinformation, such as the router name, IP address, and domainname, so that the router is reachable on the network You then
Trang 31JUNOS CLI Modes
Throughout this book, we'll show you how to use the JUNOS CLI
to configure and monitor the router While it is beyond the
scope of this book to describe the design of the CLI and all itscapabilities, this section gives an overview of the CLI modesand describes a few of the basic features Throughout the rest
of this chapter, we'll give more examples of CLI features Forcomplete information about the JUNOS CLI, refer to the JUNOSproduct documentation on the Juniper Networks web site,
Trang 32in which mode, and how to keep track of which mode you areworking in Throughout the rest of this book, we'll show youhow to work in both modes as you configure the router and
throughout this book, so by paying attention to the prompt thatprecedes each command, you can determine whether you issuethe command in operational or configuration mode
When you first log in to a JUNOS router, you are in operationalmode The commands available in operational mode let youmonitor router and network operations For example, you canget information about the router's hardware and software, thenetwork traffic that is coming to the router, and configured
routing protocols Throughout this book, we'll show you how touse operational mode commands to check what is happening onthe router
You can use a number of operational mode commands, groupedtogether into related commands, to monitor your router andnetwork On the router, you can find out what the commandsare by typing a question mark ( ?) to activate the online help Ifyou type a ? at the top level of operational mode, you see thebroad types of commands you can use to monitor the routerand perform operations not related to configuring the router:
Trang 34Use to log out of the CLI and the router
configure
Use to enter configuration mode so you can configure therouter
When you enter configuration mode, the prompt changes from
a line before the prompt, [ edit], indicates that you are in
configuration mode Specifically, [edit] indicates that you are atthe top of the configuration hierarchy, which is similar to being
Trang 35save Save configuration to ASCII file
set Set a parameter
show Show a parameter
status Show users currently editing configuration top Exit to top level of configuration
up Exit one level of configuration
wildcard Wildcard operations
When creating or modifying a configuration, you primarily use
the edit and set commands to control which configuration
Trang 36to using the Unix cd command to move to a different directory)
returns to the top of the hierarchy, [edit] (this command is
similar to the Unix cd / command) At the top level, use the exit
The show command displays the items in the configuration,starting at the current hierarchy level If you start at the [edit]
Trang 37+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 07:36:18
Discard
Trang 38…
aviva@router> show route < > in prompt indicates operational mode inet.0: 20 destinations, 20 routes (19 active, 0 holddown, 1 hidden) + = Active Route, - = Last Active, * = Both
Trang 40> igmp IGMP options
> isis IS-IS options
> l2circuit Configuration for Layer 2 circuits over MPLS > ldp LDP options