Juniper Networks, Inc.
1194 North Mathilda Avenue
Sunnyvale, California 94089
USA
408-745-2000
www.juniper.net
Juniper Networks, Junos, Steel-Belted Radius, NetScreen, and ScreenOS are registered trademarks of Juniper Networks, Inc. in the United
States and other countries. The Juniper Networks Logo, the Junos logo, and JunosE are trademarks of Juniper Networks, Inc. All other
trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the right to change, modify,
transfer, or otherwise revise this publication without notice.
Products made or sold by Juniper Networks or components thereof might be covered by one or more of the following patents that are
owned by or licensed to Juniper Networks: U.S. Patent Nos. 5,473,599, 5,905,725, 5,909,440, 6,192,051, 6,333,650, 6,359,479, 6,406,312,
6,429,706, 6,459,579, 6,493,347, 6,538,518, 6,538,899, 6,552,918, 6,567,902, 6,578,186, and 6,590,785.
JunosE™ Software for E Series™ Broadband Services Routers IP Services Configuration Guide
Writing: Subash Babu Asokan, Mark Barnard, Bruce Gillham, Sarah Lesway-Ball, Brian Wesley Simmons, Fran Singer, Namrata Mehta
Editing: Benjamin Mann
Illustration: Nathaniel Woodward
Cover Design: Edmonds Design
Revision History
July 2010—FRS JunosE 11.2.x
The information in this document is current as of the date listed in the revision history.
YEAR 2000 NOTICE
Juniper Networks hardware and software products are Year 2000 compliant. The Junos OS has no known time-related limitations through
the year 2038. However, the NTP application is known to have some difficulty in the year 2036.
READ THIS END USER LICENSE AGREEMENT (“AGREEMENT”) BEFORE DOWNLOADING, INSTALLING, OR USING THE SOFTWARE.
BY DOWNLOADING, INSTALLING, OR USING THE SOFTWARE OR OTHERWISE EXPRESSING YOUR AGREEMENT TO THE TERMS
CONTAINED HEREIN, YOU (AS CUSTOMER OR IF YOU ARE NOT THE CUSTOMER, AS A REPRESENTATIVE/AGENT AUTHORIZED TO
BIND THE CUSTOMER) CONSENT TO BE BOUND BY THISAGREEMENT. IF YOU DO NOTOR CANNOT AGREE TO THE TERMSCONTAINED
HEREIN, THEN (A) DO NOT DOWNLOAD, INSTALL, OR USE THE SOFTWARE, AND (B) YOU MAY CONTACT JUNIPER NETWORKS
REGARDING LICENSE TERMS.
1. The Parties. The parties to this Agreement are (i) Juniper Networks, Inc. (if the Customer’s principal office is located in the Americas) or
Juniper Networks(Cayman)Limited(if the Customer’s principaloffice is locatedoutside the Americas)(such applicable entity beingreferred
to herein as“Juniper”), and (ii)the person ororganizationthat originally purchased from Juniperor an authorized Juniper reseller the applicable
license(s) for use of the Software (“Customer”) (collectively, the “Parties”).
2. The Software. In this Agreement, “Software” means the program modules and features of the Juniper or Juniper-supplied software, for
which Customer has paid the applicable license or support fees to Juniper or an authorized Juniper reseller, or which was embedded by
Juniper in equipment which Customer purchased from Juniper oran authorized Juniper reseller. “Software” also includes updates, upgrades
and new releases of such software. “Embedded Software” means Software which Juniper has embedded in or loaded onto the Juniper
equipment and any updates, upgrades, additions or replacements which are subsequently embedded in or loaded onto the equipment.
3. License Grant. Subject to payment of the applicablefeesand the limitations andrestrictions set forthherein, Juniper grantsto Customer
a non-exclusive and non-transferable license, without right to sublicense, to use the Software, in executable form only, subject to the
following use restrictions:
a. Customer shall use Embedded Software solely as embedded in, and for execution on, Juniper equipment originally purchased by
Customer from Juniper or an authorized Juniper reseller.
b. Customer shall use the Software on a single hardware chassis having a single processing unit, or as many chassis or processing units
for which Customer has paid the applicable license fees; provided, however, with respect to the Steel-Belted Radius or Odyssey Access
Client software only, Customer shall use such Software on a single computer containing a single physical random access memory space
and containing any number of processors. Use of the Steel-Belted Radius or IMS AAA software on multiple computers or virtual machines
(e.g., Solaris zones) requires multiple licenses, regardless of whether such computers or virtualizations are physically contained on a single
chassis.
c. Product purchase documents, paper or electronic user documentation, and/or the particular licenses purchased by Customer may
specify limitstoCustomer’suse ofthe Software.Such limitsmay restrict use toa maximum number of seats, registeredendpoints, concurrent
users, sessions, calls, connections, subscribers, clusters, nodes, realms, devices, links, ports or transactions, or require the purchase of
separate licenses to use particular features, functionalities, services, applications, operations, or capabilities, or provide throughput,
performance, configuration, bandwidth, interface, processing, temporal, or geographical limits. In addition, such limits may restrict the use
of the Software to managing certain kinds of networks or require the Software to be used only in conjunction with other specific Software.
Customer’s use of the Software shall be subject to all such limitations and purchase of all applicable licenses.
d. For any trial copy of the Software, Customer’s right to use the Software expires 30 days after download, installation or use of the
Software. Customer may operate the Software after the 30-day trial period only if Customer pays for a license to do so. Customer may not
extend or create an additional trial period by re-installing the Software after the 30-day trial period.
e. The Global Enterprise Edition of the Steel-Belted Radius software may be used by Customer only to manage access to Customer’s
enterprise network. Specifically, service provider customers are expressly prohibited from using the Global Enterprise Edition of the
Steel-Belted Radius software to support any commercial network access services.
The foregoing license is not transferable or assignable by Customer. No license is granted herein to any user who did not originally purchase
the applicable license(s) for the Software from Juniper or an authorized Juniper reseller.
4. Use Prohibitions. Notwithstanding the foregoing, the license provided herein does not permit the Customer to, and Customer agrees
not to and shall not: (a) modify, unbundle, reverse engineer, or create derivative works based on the Software; (b) make unauthorized
copies of the Software (except as necessary for backup purposes); (c) rent, sell, transfer, or grant any rights in and to any copy of the
Software,in anyform, to anythird party; (d)removeany proprietary notices, labels,or marks on or in any copyof the Softwareor anyproduct
in which the Software is embedded; (e) distribute any copy of the Software to any third party, including as may be embedded in Juniper
equipment sold in thesecondhandmarket;(f) use any‘locked’ orkey-restricted feature,function, service, application,operation,or capability
without first purchasing the applicable license(s) and obtaining a valid key from Juniper, even if such feature, function, service, application,
operation, or capability is enabled without a key; (g) distribute any key for the Software provided by Juniper to any third party; (h) use the
Software in any manner that extends or is broader than the uses purchased by Customer from Juniper or an authorized Juniper reseller; (i)
use Embedded Software on non-Juniper equipment; (j) use Embedded Software (or make it available for use) on Juniper equipment that
the Customer did not originally purchase from Juniper or an authorized Juniper reseller; (k) disclose the results of testing or benchmarking
of the Software to any third party without the prior written consent of Juniper; or (l) use the Software in any manner other than as expressly
provided herein.
5. Audit. Customer shall maintain accurate records as necessary to verify compliance with this Agreement. Upon request by Juniper,
Customer shall furnish such records to Juniper and certify its compliance with this Agreement.
6. Confidentiality. The Parties agree that aspects of the Software and associated documentation are the confidential property of Juniper.
As such, Customer shall exercise all reasonable commercialefforts to maintain the Software and associated documentation in confidence,
which at a minimum includes restrictingaccess to the Software to Customer employees and contractors havinga need touse the Software
for Customer’s internal business purposes.
7. Ownership. Juniper and Juniper’s licensors, respectively, retain ownership of all right, title, and interest (including copyright) in and to
the Software, associated documentation, and all copies of the Software. Nothing in this Agreement constitutes a transfer or conveyance
of any right, title, or interest in the Software or associated documentation, or a sale of the Software, associated documentation, or copies
of the Software.
8. Warranty, Limitation of Liability, Disclaimer of Warranty. The warranty applicable to the Software shall be as set forth in the warranty
statementthataccompaniesthe Software (the “Warranty Statement”). Nothing inthis Agreement shallgive rise to anyobligation tosupport
the Software. Support services may be purchased separately. Any such support shall be governed by a separate, written support services
agreement. TO THE MAXIMUM EXTENT PERMITTED BY LAW, JUNIPER SHALL NOT BE LIABLE FOR ANY LOST PROFITS, LOSS OF DATA,
OR COSTS ORPROCUREMENT OFSUBSTITUTE GOODSOR SERVICES,OR FORANYSPECIAL,INDIRECT, ORCONSEQUENTIALDAMAGES
ARISING OUTOF THIS AGREEMENT,THE SOFTWARE,OR ANY JUNIPEROR JUNIPER-SUPPLIED SOFTWARE. IN NOEVENT SHALL JUNIPER
BE LIABLE FOR DAMAGES ARISING FROM UNAUTHORIZED OR IMPROPER USE OF ANY JUNIPER OR JUNIPER-SUPPLIED SOFTWARE.
EXCEPT AS EXPRESSLY PROVIDED IN THE WARRANTY STATEMENT TO THE EXTENT PERMITTED BY LAW, JUNIPER DISCLAIMS ANY
AND ALL WARRANTIES IN AND TO THE SOFTWARE (WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE), INCLUDING ANY
IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT DOES
JUNIPER WARRANT THAT THE SOFTWARE, OR ANY EQUIPMENT OR NETWORK RUNNING THE SOFTWARE, WILL OPERATE WITHOUT
ERROR OR INTERRUPTION, OR WILL BE FREE OF VULNERABILITY TO INTRUSION OR ATTACK. In no event shall Juniper’s or its suppliers’
or licensors’ liability to Customer, whether in contract, tort (including negligence), breach of warranty, or otherwise, exceed the price paid
by Customer for the Software that gave rise to the claim, or if the Software is embedded in another Juniper product, the price paid by
Customer for such other product. Customer acknowledges and agrees that Juniper has set its prices and entered into this Agreement in
reliance upon the disclaimers of warranty and the limitations of liability set forth herein, that the same reflect an allocation of risk between
the Parties (including the risk that a contract remedy may fail of its essential purpose and cause consequential loss), and that the same
form an essential basis of the bargain between the Parties.
9. Termination. Any breach of this Agreement or failure by Customer to pay any applicable fees due shall result in automatic termination
of the license granted herein. Upon such termination, Customer shall destroy or return to Juniper all copies of the Software and related
documentation in Customer’s possession or control.
10. Taxes. All license fees payable under this agreement are exclusive of tax. Customer shall be responsible for paying Taxes arising from
the purchase of the license, or importation or use of the Software. If applicable, valid exemption documentation for each taxing jurisdiction
shall be provided to Juniper prior to invoicing, and Customer shall promptly notify Juniper if their exemption is revoked or modified. All
payments made by Customer shall be net of any applicable withholding tax. Customer will provide reasonable assistance to Juniper in
connection with such withholding taxes by promptly: providing Juniper with valid tax receipts and other required documentation showing
Customer’s payment of any withholding taxes; completing appropriate applications that would reduce the amount of withholding tax to
be paid; and notifying and assisting Juniper in any audit or tax proceeding related to transactions hereunder. Customer shall comply with
all applicable tax laws and regulations, and Customer will promptly pay or reimburse Juniper for all costs and damages related to any
liability incurred by Juniper as a result of Customer’s non-compliance or delay with its responsibilities herein. Customer’s obligations under
this Section shall survive termination or expiration of this Agreement.
11. Export. Customer agrees to comply with all applicable export laws and restrictions and regulations of any United States and any
applicable foreign agency or authority, and not to export or re-export the Software or any direct product thereof in violation of any such
restrictions, laws or regulations, or without all necessary approvals. Customer shall be liable for any such violations. The version of the
Software supplied to Customer may contain encryption or other capabilities restricting Customer’s ability to export the Software without
an export license.
12. Commercial Computer Software. The Software is “commercial computer software” and is provided with restricted rights. Use,
duplication, or disclosure by the United States government is subject to restrictions set forth in this Agreement and as provided in DFARS
227.7201 through 227.7202-4, FAR 12.212, FAR 27.405(b)(2), FAR 52.227-19, or FAR 52.227-14(ALT III) as applicable.
13. Interface Information. To the extent required by applicable law, and at Customer's written request, Juniper shall provide Customer
with the interface information needed to achieve interoperability between the Software and another independently created program, on
payment of applicable fee, if any. Customer shall observe strict obligations ofconfidentiality with respect to such information and shall use
such information in compliance with any applicable terms and conditions upon which Juniper makes such information available.
14. Third Party Software. Any licensor of Juniper whose software is embeddedin the Software and any supplier ofJuniper whose products
or technology are embedded in (or services are accessed by) the Software shall be a third party beneficiary with respect to this Agreement,
and such licensor or vendor shallhave theright to enforce this Agreement in its own nameas if it were Juniper. In addition, certain third party
software may be provided with the Software and is subject to the accompanying license(s), if any, of its respective owner(s). To the extent
portions of the Software are distributed under and subject to open source licenses obligating Juniper to make the source code for such
portions publicly available (such as the GNU General Public License (“GPL”) or the GNU Library General Public License (“LGPL”)), Juniper
will make such source code portions (including Juniper modifications, as appropriate) available upon request for a period of up to three
years from the date of distribution. Such request can be made in writing to Juniper Networks, Inc., 1194 N. Mathilda Ave., Sunnyvale, CA
94089, ATTN: General Counsel. You may obtain a copy of the GPL at http://www.gnu.org/licenses/gpl.html, and a copy of the LGPL
at http://www.gnu.org/licenses/lgpl.html .
15. Miscellaneous. This Agreement shall be governed by the laws of the State of California without reference to its conflicts of laws
principles. The provisions of the U.N. Convention for the International Sale of Goods shall not apply to this Agreement. For any disputes
arising under this Agreement, the Parties hereby consent to the personal and exclusive jurisdiction of, and venue in, the state and federal
courts within Santa Clara County, California. This Agreement constitutes the entire and sole agreement between Juniper and the Customer
with respect to the Software, and supersedes all prior and contemporaneous agreements relating to the Software, whether oral or written
(including any inconsistent terms contained in a purchase order), except that the terms of a separate written agreement executed by an
authorized Juniper representative and Customer shall govern to the extent such terms are inconsistent or conflict with terms contained
herein. No modification to this Agreement nor any waiver of any rights hereunder shall be effective unless expressly assented to in writing
by the party to be charged. If any portion of this Agreement is held invalid, the Parties agree that such invalidity shall not affect the validity
of the remainder of this Agreement. This Agreement and associated documentation has been written in the English language, and the
Parties agree that the English version will govern. (For Canada: Les parties aux présentés confirment leur volonté que cette convention de
même que tous les documents y compris tout avis qui s'y rattaché, soient redigés en langue anglaise. (Translation: The parties confirm that
this Agreement and all related documentation is and will be in the English language)).
If the information in the latest release notes differs from the information in the
documentation, follow the JunosE Release Notes.
To obtain the most current version of all Juniper Networks®technical documentation,
see the product documentation page on the Juniper Networks website at
http://www.juniper.net/techpubs/.
Audience
This guide is intended for experienced system and network specialists working with
Juniper Networks E SeriesBroadband Services Routers in an Internet access environment.
E Series and JunosE Text and Syntax Conventions
Table 1 on page xxiv defines notice icons used in this documentation.
or variable to the left or to the right of this
symbol. (The keyword or variable can be
either optional or required.)
[ ]* (brackets and asterisk)
that can be entered more than once.
Represent required keywords or variables.{ } (braces)
Obtaining Documentation
To obtain the most current version of all Juniper Networks technical documentation, see
the Technical Documentation page on the Juniper Networks Web site at
http://www.juniper.net/.
To download complete sets of technical documentation to create your own
documentation CD-ROMs or DVD-ROMs, see the Portable Libraries page at
Copies of the Management Information Bases (MIBs) for a particular software release
are available for download in the software image bundle from the Juniper Networks Web
site athttp://www.juniper.net/.
Documentation Feedback
We encourage you to provide feedback, comments, and suggestions so that we can
improve the documentation to better meet your needs. Send your comments to
techpubs-comments@juniper.net, or fill out the documentation feedback form at
https://www.juniper.net/cgi-bin/docbugreport/. If you are using e-mail, be sure to include
the following information with your comments:
•
Document or topic name
•
URL or page number
•
Software release version
Requesting Technical Support
Technical productsupport isavailable through theJuniper NetworksTechnical Assistance
Center (JTAC). If you are a customer with an active J-Care or JNASC support contract,
JTAC hours of operation—The JTAC centers have resources available 24 hours a day,
7 days a week, 365 days a year.
Self-Help Online Tools and Resources
For quick and easy problem resolution, Juniper Networks has designed an online
self-service portal called the Customer Support Center (CSC) that provides you with the
following features:
Find solutions and answer questions using our Knowledge Base: http://kb.juniper.net/
•
Download the latest versions of software and review release notes:
http://www.juniper.net/customers/csc/software/
•
Search technical bulletins for relevant hardware and software notifications:
https://www.juniper.net/alerts/
•
Join and participate in the Juniper Networks Community Forum:
http://www.juniper.net/company/communities/
•
Open a case online in the CSC Case Management tool: http://www.juniper.net/cm/
To verifyservice entitlement by product serialnumber, use ourSerial Number Entitlement
(SNE) Tool: https://tools.juniper.net/SerialNumberEntitlementSearch/
Opening a Case with JTAC
You can open a case with JTAC on the Web or by telephone.
•
Use the Case Management tool in the CSC at http://www.juniper.net/cm/ .
•
Call 1-888-314-JTAC (1-888-314-5822 toll-free in the USA, Canada, and Mexico).
For international or direct-dial options in countries without toll-free numbers, see
This chapter provides information about configuringrouting policyfor your E Series router.
It describes routingpolicy configuration in general as itmight beused withvarious routing
protocols,such as Border Gateway Protocol (BGP), Intermediate Systemto Intermediate
System (IS-IS), Open Shortest Path First (OSPF), and Routing Information Protocol
(RIP).
This chapter contains the following sections:
•
Overview on page 3
•
Platform Considerations on page 4
•
References on page 4
•
Route Maps on page 4
•
Match Policy Lists on page 19
•
Access Lists on page 20
•
Using the Null Interface on page 32
•
Prefix Lists on page 32
•
Prefix Trees on page 35
•
Community Lists on page 37
•
Using Regular Expressions on page 42
•
Managing the Routing Table on page 47
•
Troubleshooting Routing Policy on page 47
•
Monitoring Routing Policy on page 48
Overview
Routing policy determines howthe system handles the routes it receives from and sends
to neighboring routers. In many cases, routing policy consists of the following:
Determining the routing protocol used to distribute the routes
You can think of routing policy as a way to control the flow of routes into and out of the
router.
The decision about which routes to accept from and advertise to various neighbors has
an important impact on the traffic that crosses a network. Routing policy is used to
enforce business agreements between two or more Internet service providers (ISPs)
concerning the amount and type of traffic that is allowed to pass between them.
You can use one or more of the following mechanisms to configure routing policy:
•
“Route Maps” on page 4
•
“Match Policy Lists” on page 19
•
“Access Lists” on page 20
•
“Prefix Lists” on page 32
•
“Prefix Trees” on page 35
•
“Community Lists” on page 37
Platform Considerations
Configuring routing policies is supported on all E Series routers.
For information about the modules supported on E Series routers:
•
See the ERXModuleGuide for modulessupportedon ERX7xx models,ERX14xx models,
and the Juniper Networks ERX310 Broadband Services Router.
•
See the E120 and E320 Module Guide for modules supported on the Juniper Networks
E120 and E320 Broadband Services Routers.
References
For more information about the protocols discussed in this chapter, see their respective
chapters in this guide and other guides within the JunosE documentation set, and to the
References sections within those chapters.
Route Maps
You can useroutemaps to control and modify routing information and todefine conditions
for redistributing routes between routing domains. Youcan applyroute maps to inbound,
outbound, or redistribution routes. A routemap consists ofmatch clauses and set clauses.
Match clauses specify the attribute values that determine whether a route matches the
route map. Aroute that has thesame attribute valuespasses the match condition. Routes
that pass all the match conditions match the route map. You issue match commands
to define the match conditions for a route map. You can specify the match conditions in
any order. If you do not specify any match conditions in a route map, that route map
matches all routes.
Set clauses definehow the attributes are modifiedfor matching routes. The set conditions
apply only to routes that pass all the match conditions (or a route map with no match
conditions). When a route passes all the match conditions, the router software applies
all set conditions. You issue set commands to define the set conditions for a route map.
You assign a unique string called the map tag to identify each route map. You can have
multiple instances of a route map, where each instance consists of a different group of
clauses. Each instance is identified by a sequence number. When you apply a route map,
the routing protocol evaluates routes against the instance of the route map with the
lowest sequence number. If the routes pass all the match conditions specified in the
lowest-numbered instance, and if all set commands are successfully applied, no other
instance of the route map is considered. However, any routes that do not pass all the
match conditions are evaluated against the next instanceof the route map. For example,
suppose you create two instances of route map boston5, one with sequence number 10
and one with sequence number 25. When you apply boston5, routes are evaluated first
against instance 10; any that do not match are evaluated against instance 25.
When you apply a route map, you specify the permit or deny keyword:
•
If you specify the permit keyword, routes that match the route map are accepted,
forwarded, or redistributed. Routes that do not match the route map are rejected or
blocked.
•
If you specify the deny keyword, routes that match the route map are rejected or
blocked. Routes that do not match the route map are accepted, forwarded, or
redistributed.
A route map must have at least one match clause or oneset clause. If you have no match
clauses, all routes match the route map, and the set conditions apply to all routes. If you
have no set clauses, no action is taken other than that specified by the permit or deny
keyword.
Route Map Configuration Example
Consider the network structure shown in Figure 1 on page 6. Suppose you do not want
router Boston to receive any routes that originate in or pass through router Chicago.
You can use a route map to filter routes based on the autonomous system (AS) path to
accomplish this goal. Use the following commands to configure router NY:
A clause with multiple values matches a route that has any of the values; that is, the
multiple values are logical ORed.
You can also issue successive match commands to add new values to a route map entry
for any of the commands listed above.
This method is equivalent to issuing the following single command:
You cannot specify multiple values for the match metric-type command, because it has
only two acceptable values, which are mutually exclusive. Specifying both values has
the same effect as not specifying a metric type at all; specifying the same value more
than once has no meaning.
Negating Match Clauses
Chapter 1: Configuring Routing Policy
host1(config-route-map)#match ip address lisbon madrid
host1(config-route-map)#match as-path 10 20 30
host1(config-route-map)#match ip address boston
host1(config-route-map)#match ip address newyork
host1(config-route-map)#match ip address boston newyork
If you specify a value when you negate a match command configured in a route map,
only that value for the match entry is deleted. The routing software deletes the entire
match entry only if the entry contains no other values. In some earlier releases, any value
specified witha no match command was ignored, and theentire match entry was deleted.
This change applies to all match commands configured in a route map.
For example, consider the following match entry to route map miami:
host1(config)#ip community-list corporate5 permit 32 463 21
host1(config)#ip community-list dade2 permit 41 53 22
host1(config)#route-map miami permit 1
host1(config-route-map)#match community corporate5 dade2
host1(config-route-map)#exit
host1(config)#exit
host1#show route-map
route-map miami, permit, sequence 10
Match clauses:
match community corporate5 dade2
In earlier releases, issuing a command like the following to remove a community (see
“Community Lists” on page 37) not specified in the entry deleted the whole entry, but
now nothing happens:
host1(config-route-map)#no match community southbeach
host1(config-route-map)#exit
host1(config)#exit
host1#show route-map
route-map miami, permit, sequence 10
Match clauses:
match community corporate5 dade2
If you instead issue the following commands, the specified value is deleted:
host1(config-route-map)#exit
host1(config)#exit
host1#show route-map
route-map miami, permit, sequence 10
Match clauses:
match community corporate5
Issue either of the following commands to delete the entire match community entry:
host1(config-route-map)#no match community
host1(config-route-map)#no match community corporate5 dade2
Matching a Community List Exactly
You can use the exact-match keyword for the match community command to specify
that a match exists only for the exact community numbers specified in the community
list. The exact-match keyword applies only to a standard community list—that is, one
not specified by a regular expression. You cannot use the exact-match keyword with a
community list that is specified by a regular expression.
Consider the following example:
host1(config)#ip community-list 1 permit 100 200 300
host1(config)#exit
host1#show ip community-list
Community standard list 1
permit 0:100 0:200 0:300
host1(config)#route-map example1 permit 10
host1(config-route-map)#match community 1 exact-match
host1(config)#exit
host1#show route-map example1
route-map example, permit, sequence 10
Match clauses:
community (community-list filter): 1 exact-match
The route map example1 permits a route only if the route contains community 100 and
community 200 and community 300 and no additional communities.
If you do not specify the exact-match option, the route map also permits a match on a
route that contains additional communities. For example, a route that contains
communities 100, 200, 300, 400, and 450 matches.
Removing Community Lists from a Route Map
You can use the set comm-list delete command to remove the specified community
list from routes matching the route map, provided that you created the community list
with a single community number per list entry. For example, you cannot remove the
community lists 231:10 and 231:20 with theset comm-list deletecommand if youcreated
them with the following command:
host1(config)#ip community list 1 permit 231:10 231:20
You can, however, remove the listswith theset comm-list delete command if you created
them separately with the following commands:
You can use the match policy-list command to reference a policy list within the route
map. Policy lists are like route maps, but they contain only match clauses and no set
clauses. Youcan createa policylist tocontain a group of match clauses once, referencing
the list in any number of route maps and avoiding the task of having to reenter the match
clauses separately into each route map.
For more information about creating IP policy lists, see “Match Policy Lists” on page 19.
Redistributing Access Routes
Access-internal routes, such as DHCP and AAA/PPP host routes, are host routes to
directly connected clients. Access routes, also known as AAA framed routes, are sourced
by AAA.
The following example shows how you might redistribute access-internal routes and
access routes by matching on a tag:
Chapter 1: Configuring Routing Policy
1.Configure route map tagtest to match tag 30.
host1(config)#route-map tagtest
host1(config-route-map)#match tag 30
2.Configure redistribution into BGP of the access-internal routes and access routes
You can use the set admission-bandwidth command to set a multicast bandwidth for
admission control. Admission control is performed for the join and mapped interface
when the OIF is added to the mroute.
You can use the set qos-bandwidth command to set a multicast bandwidth for QoS
control. The QoS adjustment is made to the join interface when the OIF is added to the
mroute.
NOTE: Both the admission bandwidth and QoS bandwidth are a constant bit rate.
For more information about multicast admission control or QoS adjustment, see
• Use the no version to delete the match clause from a route map or a specified value
from the match clause.
• See match as-path.
match community
• Use to match a community list.
• This command supports inbound and outbound route maps.
• Example
host1(config-route-map)#match community comm5
• Use the no version to delete the match clause from a route map or a specified value
from the match clause.
• See match community.
match distance
match extcommunity
• Use to match any routes being redistributed out of the routing table that have the
specified administrative distance.
• Distance is used to determine the relative preference between routes to the same
prefix in order to pick the best route to that prefix in the routing table. Distance has no
meaning in any other circumstance, and any attempt to match distance fails.
• Example
host1(config-route-map)#match distance 25
• Use the no version to delete the match clause from a route map or a specified value
from the match clause.
• See match distance.
• Use to match an extended community list in a route map.
• You can specify one or more extended community list names in a match clause. If you
specify more than one extended community list, the lists are logically ORed.
Router host1 receivesthe same route from 10.6.2.5 and applies the indelete route map.
BGP compares each list entry with the community attribute. A match is found for the
list entry231:10, andthis community is deleted fromthe community attribute. Similarly,
a match is found for the list entry of 231:20, and this community is deleted from the
community attribute.
• Example
host1(config-route-map)#set comm-list 1 delete
• Use the no version to delete the set clause from a route map.
• See set comm-list delete.
• Use to set the community attribute in BGP updates.
• You can specify a community list number in the range 1–4294967295, or in the new
community format of AA:NN, or one of the following well-known communities:
• local-asr—Prevents advertisement outside the local AS
set dampening
• no-advertise—Prevents advertisement to any peer
• no-export—Prevents advertisement beyond the BGP confederation boundary
• Alternatively, you can use the list keyword to specify the name of a community list
that you previously created with the ip community-list command.
• Example
host1(config-route-map)#set community no-advertise
• Use the none keyword to remove the community attribute from a route.
• Use the no version to delete the set clause from a route map.
• See set community.
• Use to enable BGP route flap dampening only on routes that pass the match clauses
of, and are redistributed by, a particular route map.
• BGP creates a dampening parameter block for each unique set of dampening
parameters—such as suppress threshold, reuse threshold, and so on—used by BGP.
For example, if you have a route map that sets the dampening parameters to one set
of values for some routes and to another set of values for the remaining routes, BGP
uses and stores two dampening parameter blocks, one for each set.
• Use the no version to delete the set clause from a route map.
• See set ipv6 next-hop.
• Use to specify where to import routes when all of a route map's match criteria are met.
• Example
host1(config-route-map)#set level level-2
• Use the no version to delete the set clause from a route map.
• See set level.
• Use to specify a preference value for the AS path.
• Example
host1(config-route-map)#set local-preference 200
set metric
• Use the no version to delete the set clause from a route map.
• See set local-preference.
• Use to set the metric value (for BGP, the MED) for a route.
• To establish an absolute metric, do not enter a plus or minus sign before the metric
value.
• Example
host1(config-route-map)#set metric 10
• To establish a relative metric, specify a plus or minus sign immediately preceding the
metric value. The value is addedto or subtracted from themetric ofany routes matching
the route map. The relative metric value range is 0–4294967295.
• Example
host1(config-route-map)#set metric -25
• You cannot use both an absolute metric and a relative metric within the same route
map sequence. Setting either metric overrides any previously configured value.
• Use the no version to delete the set clause from a route map.
• See set metric.
set metric-type
• Use to set the metric type for a route.
• For BGP, this command affects BGP behavior only in outbound route maps and has
no effect on other types of route maps. Ifthe route map containsboth aset metric-type
and a set metric clause, the set metric clause takes precedence. If you specify the
internal metric type in a BGPoutbound route map, BGPsets theMED ofthe advertised
routes to the IGP cost of the next hop of the advertised route. If the cost of the next
hop changes, BGP is not forced to readvertise the route.
• For BGP, you can specify the following metrics:
• external—Reverts to the normal BGP rules for propagating the MED; this is the BGP
default
• internal—Sets the MED of a received route that is being propagated to an external
peer equal to the IGP cost of the indirect next hop
• For IS-IS, you can specify the following metrics:
• external—Considers only the metric of the route itself is considered for comparison
• internal—Considers both the metric of the route and the cost to the router that
advertised the route are considered for comparison; this is the IS-IS default
• For OSPF, you can specify the following metrics:
• 1—Sets the cost of the external routes so that it is equal to the sum of all internal
costs and the external cost
set origin
set route-class
• 2—Sets the cost of the external routes so that it is equal to the external cost alone;
this is the OSPF default
• Example
host1(config-route-map)#set metric-type internal
• Use the no version to delete the set clause from a route map.
• See set metric-type.
• Use to set the BGP origin of the advertised route.
• Example
host1(config-route-map)#set origin egp
• Use the no version to delete the set clause from a route map.
• See set origin.
• Use to set the route class value. The route-class attribute enables you to associate a
route class with incoming packets based on the destination or source address of the
packet. For example, you can associate different route classes with different VPN
services, while using the route classes to classify packets for quality of service (QoS).
• Example
host1(config-route-map)#set route-class 50
• Use the no version to delete the set clause from a route map.
• Use to set the routes of the specified type (internal, internal-intra, internal-inter, or
external).
• Example
host1(config-route-map)#set route-type internal
• Use the no version to delete the set clause from a route map.
• See set route-type.
• Use to set the tag value of the destination routing protocol.
• Example
host1(config-route-map)#set tag 23
• Use the no version to delete the set clause from a route map.
• See set tag.
set weight
Match Policy Lists
• Use to specify the BGP weight for the routing table.
• The weights assigned withthe set weight command ina route map overridethe weights
assigned using the neighbor weight and neighbor filter-list weight commands.
• Example
host1(config-route-map)#set weight 200
• Use the no version to delete the set clause from a route map.
• See set weight.
Match policy lists are very similar to route maps. However, unlike route maps, match
policy lists can contain only match clauses and no set clauses.
You create match policy lists and then reference those lists within route maps. Because
matchpolicy lists sharethe same match clauses with route maps, theyfunction the same
way, and you can use the same match commands when you create your match policy
lists.
NOTE: For descriptions of all route map match clauses, see “Route Maps” on page 4
.
As in route maps, the match clauses in match policy lists contain permit and deny
statements. When you reference a match policy list within a route map, the route map
evaluates and processes each match clause and permits or denies routes based on the
match policy list configuration.
When you configure match policy lists, keep the following in mind:
•
A route map evaluates and processes all match statements within any match policy
list that it references.
•
You can configure multiple match policy lists within a route map, and you can evaluate
each match policy list by using a logical AND or a logical OR.
•
You can reference match policy lists within a route map that also uses separate match
and set statements (that is, the statements are not part of the match policy list).
•
All match policy lists within a route map match on the incoming attribute only.
ip match-policy-list
• Use to create an IP match policy list and launch the match policy list configuration
• Use the no version to delete the match policy list.
• See ip match-policy-list.
An access list is a sequential collection of permit and deny conditions that you can use
to filter inbound or outbound routes. You can use different kinds of access lists to filter
routes based on either the prefix or the AS path.
To filter routes based on the prefix, you can do any of the following:
•
Define an access list with the access-list or ipv6 access-list command, and apply the
list to routes received from or passed to a neighbor with the neighbor distribute-list
command.
•
Define aprefix list withthe ipprefix-list command, and apply thelist toroutes received
from or passed to a neighbor with the neighbor prefix-list command.
•
Define a prefix tree with the ip prefix-tree command, and apply the list to routes
received from or passed to a neighbor with the neighbor prefix-tree command.
The router compares each route's prefix against the conditions in the list or tree,
one-by-one. If the first match is for a permit condition, the route is accepted or passed.
If the first match is for a deny condition, the route is rejected or blocked. The order of
conditions is critical because testing stops with the first match. If no conditions match,
the router rejects or blocks the address; that is, the last action of any list is an implicit
deny condition for all routes. The implicit rule is displayed by showaccess-list and showconfig commands.
You cannot selectively place conditions in or remove conditions from anaccess list, prefix
list, or prefix tree. You can insert a new condition only at the end of a list or tree.
Configuration Example 1
The following example shows how the implicit deny condition appears:
host1(config)#access-list 1 permit 10.10.10.1 0.0.0.255
host1(config)#access-list 2 permit 10.25.25.1 0.0.0.255
host1(config)#access-list 3 permit any any
host1(config)#show access-list
IP Access List 1:
permit ip 10.10.10.1 0.0.0.255 any
deny ip any any
IP Access List 2:
permit ip 10.25.25.1 0.0.0.255 any
deny ip any any
IP Access List 3:
permit ip any any
The implicit deny rule does not appear in the display for access list 3, because any prefix
matches access list 3.
Configuration Example 2
The following example demonstrates how to use a route map and an access list to
redistribute static routes to IS-IS.
NLPID: 0xcc
IP Address: 192.168.1.105
Metric: 10 IS 0000.0000.6666.01
Metric: 10 IS 0000.0000.3333.00
Metric: 10 IS 0000.0000.7777.00
Metric: 30 IP 20.20.20.0 255.255.255.0
Metric: 30 IP 20.20.21.0 255.255.255.0
Configuration Example 3
The following example demonstrates how to use an access list to filter routes advertised
to a BGP device. Consider the network structure in Figure 2 on page 22.
Figure 2: Filtering with Access Lists
Filtering AS Paths
The following commands configure router Boston to apply access list reject1 to routes
inbound from router SanJose. Access list reject1 rejects routes matching 172.24.160.0/19.
You can use a filter list to filter incoming and outgoing routes based on the value of the
AS-path attribute. Whenever a BGP route passes through an AS, BGP prepends its AS
number to the AS-path attribute. The AS-path attribute is the list of ASs that a route has
passed through to reach a destination.
To filterroutes based onthe AS path, definethe access list withthe ipas-path access-list
command, and apply the list to routes received from or passed to a neighbor with the
neighbor filter-list command. AS-path access lists use regular expressions to describe
the AS path to be matched. A regular expression uses special characters—often referred
to as metacharacters—to define a pattern that is compared with an input string. For a
full discussion of regular expressions, with examples of how to use them, see “Using
Regular Expressions” on page 42.
The router compares each route's AS path with each condition in the access list. If the
first match is for a permit condition, the route is accepted or passed. If the first match is
for a deny condition, the route is rejected or blocked. The order of conditions is critical
because testing stops with the first match. If no conditions match, the router rejects or
blocks the route; that is, the last action of any list is an implicit deny condition for all
routes.
You cannot selectively place conditions in or remove conditions from an AS-path access
list. You can insert a new condition only at the end of an AS-path access list.
Configuration Example 1
Consider the network structure in Figure 3 on page 23.
Suppose you want router London to behave in the following way:
•
Accept routes originated in AS 621 only if they pass directly to router London.
•
Accept routes originated in AS 11 only if they pass directly to router London.
•
Forward routes from AS 282 to AS 435 only if they pass through either AS 621 or AS 11,
but not both AS 621 and AS 11.
Figure 3: Filtering with AS-Path Access Lists
The following commands configure router London to apply filters based on AS path to
routes received from router Berlin and router Paris and to routes forwarded to router
Madrid.
AS-path access list 1 is applied to routes that router London receives from router Paris.
Router London rejects routes with the AS path 11 621 or 11 282 621.
AS-path access list 2 is applied to routes that router London receives from router Berlin.
Router London rejects routes with the AS path 621 11 or 621 282 11.
Router London accepts routes with the AS path 282 11, 282 621, 282 621 11, or 282 11 621.
However, it applies AS-path access list 3 to routes it forwards to router Madrid, and filters
out routes with the AS path 282 621 11 or 282 11 621.
Using Access Lists in a Route Map
You can use a route map instead of the neighbor filter-list command to apply access
lists for filtering routes.
Configuration Example 1
In Figure 4 on page 24, a route map is used to determine the weight for routes learned
by router Chicago.
Figure 4: Route Map Filtering
Accesslist 1 permits any route whose AS-path attribute includes 32 or 837. This condition
permits routes that originate in (or pass through from elsewhere) AS 32 or AS 837. When
these routes are advertised through AS 451 and AS 17 to router Chicago, instance 1 of
route map 1 matches such routes and sets their weight to 25, overriding the neighbor
weight set for updates received from 10.2.2.4.
Access list 2 permits any route whose AS-path attribute indicates that it originates in AS
74. When these routes are advertised through AS 837 and AS 32 to router Chicago,
instance 1 of route map 2 matches such routes and sets their weight to 175, overriding
the neighbor weight set for updates received from 10.5.5.2.
The result of this configuration is that router Chicago prefers routes learned through
router Boston (weight 150) over routes learned through router NY (weight 50), except
that:
access-list
•
Router Chicago prefers routes learned via router NY that passed through AS 837 or AS
32 (weight 50) over the same routes learned via router Boston (weight 25 according
to route map 1).
•
Router Chicago prefers routes originating in AS 74 learned via router NY that passed
through AS 837 and AS 32 (weight 175 according to route map 2) over the same routes
learned via router Boston (weight 150).
• Use to define an IP access list to permit or deny routes based on the prefix.
• Each access list is a set of permit or deny conditions for routes based on matching a
route's prefix.
• A zero in the wildcard mask means that the corresponding bit in the address must be
exactlymatchedby the route. Aone inthe wildcard maskmeans that thecorresponding
bit in the address does not have to be matched by the route.
• Use the neighbor distribute-list command to apply the access list to routes received
from or forwarded to a neighbor.
• Use the log keyword to log an Info event in the ipAccessList log whenever an access
list rule is matched.
• Example
host1(config)#access-list bronze permit ip host any 228.0.0.0 0.0.0.255
• Use the no version to disable advertisement of the default route.
• See default-information originate.
ip as-path access-list
• Use to define an AS-path access list to permit or deny routes based on the AS path.
• Each access list is a set of permit or deny conditions for routes based on matching a
route's AS path to a regular expression. If the regular expression matches the
representation of the AS path of the route as an ASCII string, the permit or deny
condition applies. The AS path does not contain the local AS number.
• The AS path allows substring matching. For example, theregularexpression20 matches
AS path = 20 and AS path = 100 200 300, because 20 is a substring of each path. To
disable substring matching and constrain matching to only the specified attribute
string, place theunderscore (_) metacharacter on both sidesof the string; for example,
_20_.
• Use the neighbor filter-list command to apply the AS-path access list. You can apply
access-list filters to inbound and outbound BGP routes. You can assign weights to
routes matching the AS-path access list.
• Example
host1(config)#ip as-path access-list 1 permit ^\(
• Use the no version to remove the AS-path access list; all entries that belong to this list
are removed.
• See ip as-path access-list.
ipv6 access-list
• Use to define an IPv6 access list to permit or deny routes based on the prefix.
• Each access list is a set of permit or deny conditions for routes based on matching a
You can apply access lists to PIM sparse mode interfaces along with the ip pim join-filter
or ipv6 pim join-filter command to use the access lists as PIM sparse mode join filters.
To configure PIM join filters:
1.Create the various access list services you want to use with the PIM join filter
command.
host1(config)#! create bronze service
host1(config)#! - restrict SSM channels to 232.0.1/24 only
host1(config)#access-list bronze permit ip host any 228.0.0.0 0.0.0.255
host1(config)#access-list bronze permit ip host 1.1.1.1 232.0.1.0 0.0.0.255
host1(config)#access-list bronze permit ip host 2.2.2.2 232.0.1.0 0.0.0.255
host1(config)#
host1(config)#! create silver service
host1(config)#! - bronze service + new channels 232.0.2/24
host1(config)#access-list silver permit ip host any 228.0.0.0 0.0.0.255
host1(config)#access-list silver permit ip host 1.1.1.1 232.0.1.0 0.0.0.255
host1(config)#access-list silver permit ip host 2.2.2.2 232.0.1.0 0.0.0.255
host1(config)#access-list silver permit ip host 1.1.1.1 232.0.2.0 0.0.0.255
host1(config)#access-list silver permit ip host 2.2.2.2 232.0.2.0 0.0.0.255
host1(config)#
host1(config)#! create gold service
host1(config)#! - silver service + new channels 232.0.3/24
host1(config)#access-list gold permit ip host any 228.0.0.0 0.0.0.255
host1(config)#access-list gold permit ip host 1.1.1.1 232.0.1.0 0.0.0.255
host1(config)#access-list gold permit ip host 2.2.2.2 232.0.1.0 0.0.0.255
host1(config)#access-list gold permit ip host 1.1.1.1 232.0.2.0 0.0.0.255
host1(config)#access-list gold permit ip host 2.2.2.2 232.0.2.0 0.0.0.255
host1(config)#access-list gold permit ip host 1.1.1.1 232.0.3.0 0.0.0.255
host1(config)#access-list gold permit ip host 2.2.2.2 232.0.3.0 0.0.0.255
Chapter 1: Configuring Routing Policy
For additional information about how to create access lists, see “Access Lists” on
page 20 .
For information about the ip pim join-filter command, see Configuring PIM for IPv4
Multicast in JunosE Multicast Routing Configuration Guide. For information about the ipv6pim join-filter command, see Configuring PIM for IPv6 Multicast in JunosE Multicast Routing
Configuration Guide.
Clearing Access List Counters
Use theclearaccess-listor clear ipv6 access-list commands to clear access list counters.
clear access-list
clear ipv6 access-list
Creating Table Maps
• Use to clear all access list counters or access list counters in the specified access list.
• Example 1
host1#clear access-list list1
• Example 2
host1#clear ipv6 access-list list2
• There is no no version.
• See clear access-list.
• See clear ipv6 access-list.
For static routes and access routes, you can configure and apply a table map that filters
routes before an access list adds them to the routing table. For static routes, you can use
the ip static-route table-map or ipv6 static-route table-map command. For access
routes, you can use the ip access-route table-map or ipv6 access-route table-map
command.
Use these commands when triggering on the policy values listed in Table 3 on page 30.
For example,you can configure an accesslist androute map tofilter, based on IP address,
any routes that appear in the routing table:
host1(config)#ip access-route table-map just10net
host1(config)#access-list permit10 permit 10.0.0.0 0.255.255.255
host1(config)#access-list permit10 deny any
host1(config)#route-map just10net
host1(config-route-map)#match ip address permit10
Using the same name for both the table map and the route map creates an association
specifying (inthis case) that only IPaddresses that match the access listcriterion appear
in the routing table.
ip access-route table-map
ipv6 access-route table-map
• Use to filter access routes before an access list adds them to the routing table.
• Example 1
• Example 2
• Use the no version to delete the table map.
• See ip access-route table-map.
• See ipv6 access-route table-map.
ip static-route table-map
ipv6 static-route table-map
• Use to filter static routes before adding them to the routing table.
You can useaccesscontrol lists tofilterundesired traffic. Anotherway to handle undesired
traffic is tosend itto the null interface. The router automaticallycreates thenull interface,
which is always up, cannot be deleted, and acts as a data sink. In other words, the null
interface cannot forward or receive traffic. However, the CLI does allow you to access
the null interface.
The E Series router creates the null interface by default; you do not have to manually
create it. You can direct traffic to the null interface by specifying the null 0 keywords
instead of a next-hop or destination address when you configure routes.
interface null
• Use to access the null interface.
• The null interface is a data sink; it does not accept or forward traffic.
• Although you can access the null interface, you cannot configure any values for it or
delete it.
ip route
Prefix Lists
• Example
host1(config)#interface null 0
host1(config-if)#
• There is no no version.
• See interface null.
• Use to configure a static route and redirect traffic from it to the null interface.
• Example
host1(config-if)#ip route 10.10.20.5 null 0
• Use the no version to remove the static route.
• See ip route.
A prefix list is a sequential collection of permit and deny conditions that apply to IP or
IPv6 addresses. Like an access list, the router tests addresses one by one against the
conditions ina prefix list.The first match determines whether therouter accepts or rejects
the address. Because the router stops testing conditions after the first match, the order
of the conditions is critical. If no conditions match, the router rejects the address. An
empty prefix list results in an automatic permit of the tested address.
Unlike access lists, the prefix list specifies a base IP or IPv6 address and a length (the
number of bits applied to the base to determine the network prefix). The tested address
is matched against the prefix.
Use theip prefix-list command to definean IPprefix list, or the ipv6prefix-list command
to define an IPv6 prefix list. The prefix-list keyword with either the match { ip | ipv6 }address or match { ip | ipv6 } next-hop commands enables you to add a clause to a
route map.
The following example creates a prefix list that permits routes with a prefix length up to
24 in the 151.0.0.0/8 network:
host1(config)#ip prefix-list abc permit 151.0.0.0/8 le 24
• Use to clear all hit counts in the prefix lists or the specified entry from the specified
prefix list. (The router increments the hit count by 1 each time an entry matches.)
• Example
host1#clear ip prefix-list abc
• There is no no version.
clear ipv6 prefix-list
ip prefix-list
ipv6 prefix-list
• See clear ip prefix-list.
• Use toclear all hit counts inthe IPv6prefix lists orthe specifiedentry from thespecified
prefix list. (The router increments the hit count by 1 each time an entry matches.)
• Example
host1#clear ipv6 prefix-list abc
• There is no no version.
• See clear ipv6 prefix-list.
• Use to create a prefix list for route filtering and to specify a list entry—a deny or permit
clause for a network address—to the prefix list. Use to add entries to prefix lists.
• The prefix list name can be up to 32 characters long.
• Specify the position of each entry in the list with the seq (sequence) keyword. If you
do not specify a sequence number, the router uses the value of the last sequence
number plus 5.
• Use the ge and le keywords to specify a range of network prefixes. These keywords
have the following values:
• prefix length < ge <= 32
• prefix length < le <= ge
• If you do not specify either the ge or le keyword, an exact match is expected.
• Use the no version to delete all next-hop match clauses from a route map unless you
specify an access list or prefix list, in which case the router removes only the list match
from the route map.
• See match ipv6 next-hop.
A prefix tree is a nonsequential collection of permit and deny conditions that apply to IP
addresses. Like a prefix list, the prefix tree specifies a base IP address and a length, the
number of bits applied to the base to determine the network prefix. The tested address
is matched against the prefix. The prefix tree also enables route summarization.
Using a Prefix Tree
clear ip prefix-tree
However, the prefix tree does not match addresses one by one in sequence against the
listed conditions. The router performs a binary search against the tree structure of the
entries. Ifthe tested address is lessthan aparticular entry, it branches one way to another
test pair; if it is greater than the entry, it branches the other way to another mutually
exclusive test pair. The router stops testing conditions when it finds the best match. If
no conditions match, the router rejects the address. An empty prefix tree results in an
automatic permit of the tested address.
The prefix tree provides a faster search method and matches the test address more
closely than either the access list or the prefix list.
Use the ip prefix-tree command to define an IP prefix tree. Use the prefix-tree keyword
with the match ip address or match ip next-hop commands to add a clause to a route
map. Use the match-set summary prefix-tree command to specify the prefix tree that
summarizes routes for a particular route map.
The following example creates a prefix tree that permits routes with a prefix length of
24 or larger in the 10.10.2.0/24 network:
A community isa logical group of prefixes that share some commonattribute. Community
members can reside on different networks and in different autonomous systems. BGP
enables you to define the community to which a prefix belongs. A prefix can belong to
more than one community. The community attribute lists the communities to which a
prefix belongs.
You can usecommunities to simplifyrouting policies byconfiguring the routinginformation
that a BGP device can accept, prefer, or distribute to other neighbors according to
community membership. When a route is learned, advertised, or redistributed, a BGP
device can set,append, or modify the communityof aroute.When routes are aggregated,
the resulting BGP update contains a community attribute that contains all communities
from all of the aggregated routes (if the aggregate is an AS-set aggregate).
Several well-known communities are predefined. Table 4 on page 37 describes how a
BGP device handles a route based on the setting of its community attribute.
Table 4: Action Based on Well-Known Community Membership
BGP Device ActionWell-Known Community
no-export
no-export-subconfed)
internet
In addition to the well-known communities, you can define local-use communities, also
known as private communities or general communities. These communities serve as a
convenient way to categorize groups of routes to facilitate the use of routing policies.
The community attribute consists of four octets, but it is common practice to designate
communities in the AA:NN format. The autonomous system number (AA) comprises the
higher two octets, and the community number (NN) comprises the lower two octets.
Both are expressed as decimal numbers. For example, if a prefix in AS 23 belongs to
community 411, the attribute could be expressed as 23:411. Use the ip bgp-communitynew-format command to specify that the show commands display communities in this
format. You can also use a regular expression to specify the community attribute.
Does not advertise the route beyond the BGP confederation
boundary
Does not advertise the route to any peers, IBGP, or EBGPno-advertise
Does not advertise the route to any external peerslocal-as (also known as
Advertises this route to the Internet community; by default, all
prefixes are members of the Internet community
Use the set community command in route maps to configure the community attributes.
You can add one or more communities to the attribute, or you can use the list keyword
to add a list of communities to the attribute. By default, the community attribute is not
sent to BGP peers. To sendthe community attribute to a neighbor, use the neighbor sendcommunity command.
A communitylist is a sequential collection of permit and deny conditions.Each condition
describes the community number to be matched. If you issued the ip bgp-communitynew-format command, the community number is in AA:NN format; otherwise, it is in
decimal format (the hexadecimal octets converted to decimal).
The router tests the communityattributeof aroute against each condition ina community
list. The first match determines whether the router accepts (the route is permitted) or
rejects (the routeis denied)a route that hasthe specifiedcommunity. Because the router
stops testing conditions after the first match, the order of the conditions is critical. If no
conditions match, the router rejects the route.
Consider the network structure shown in Figure 5 on page 38.
Figure 5: Community Lists
Suppose you want router Albany to setmetricsfor routes that itforwardstorouterBoston
based on the communities to which the routes belong. You can create community lists
and filter the routes with a route map that matches on the community list. The following
example configures router Albany:
Community list 1 comprises routes with a community of 25; their metric is set to 20.
Community list 2 comprises routes with a community of 62; their metric is set to 75.
Community 3 catches all remaining routes by matching the Internet community; their
metric is set to 85.
ip bgp-community new-format
• Use to specify that communities must be displayed in AA:NN format, where AA is a
number that identifies the autonomous system and NN is a number that identifies the
community within the autonomous system.
• Example
• Use the no version to restore the default display.
Chapter 1: Configuring Routing Policy
host1(config)#ip bgp-community new-format
ip community-list
• See ip bgp-community new-format.
• Use to create a community list for BGP and control access to it.
• The list name can be up to 32 characters long.
• A route can belong to any number of communities, so a community list can have many
entries comprising many communities.
• You can specify one or more community values when you create a community list. A
clause in a route map that includes a list that has more than one value matches only
a route that has all of the values; that is, the multiple values are logical ANDed.
• You can specify community values with a number or a regular expression.
host1:vr1(config-router)#neighbor 192.3.4.5 send-community standard
• Use the no version to specify that common attributes not be sent to a BGP neighbor.
• See neighbor send-community.
set community
• Use to set the community attribute in BGP updates.
• You can specify a community list number in the range 1–4294967295, or in the new
community format of AA:NN, or you can specify one of the following well-known
communities:
• local-as—Prevents advertisement outside the local AS
• no-advertise—Prevents advertisement to any peer
• no-export—Prevents advertisement beyond the BGP confederation boundary
• Alternatively, you can use the list keyword to specify the name of a community list
that you previously created with the ip community-list command.
• You can use this command with inbound, outbound, and redistribution route maps.
• Use the none keyword to remove the community attribute from a route.
• Example
host1(config)#route-map 1
host1(config-route-map)#set community no-advertise
• Use the no version to remove the set clause from a route map.
• See set community.
Extended Community Lists
The router supportsthe BGPextendedcommunity attribute defined in Internet draft BGP
ExtendedCommunities Attribute— draft-ietf-idr-bgp-ext-communities-07.txt (February
2004 expiration). This attribute enables thedefinition ofa type ofIP extended community
and extended community list unrelated to the community list that uses regular
expressions.
NOTE: IETF drafts are valid for only six months from the date of issuance. They must
be considered as works in progress. For the latest drafts, please see the IETF Web site
at http://www.ietf.org.
BGP devices can use the extended community attribute to control routes much like they
use the community attribute to determine routes that they accept, reject, or redistribute.
A BGP device can append the extended community attribute to a route that does not
have the attribute before it advertises the route. For routes that do have the attribute,
BGP can modify the attribute.
• Use to create an extended community list for BGP and control access to it.
• A route can belong to any number of communities, so an extended community list can
have many entries comprising many communities.
• You can specify one or more community values when you create an extended
community list. A clause in a route map that includes a list that has more than one
value matches only a route that has all of the values; that is, the multiple values are
logical ANDed.
• Use the rt keyword to specify a route target community, which consists of one or more
routers that can receive a set of routes advertised by BGP that carry the extended
community attribute.
• Use the soo keyword to specify a site-of-origin community, which consists of one or
more routers that inject into BGP a set of routes that carry the extended community
attribute.
A route matches this community list only if it belongs to at least all three communities
in extended community list boston1: communities 100:2, 100:3, and 100:4.
• Use the no version to remove a single extended community list entry if you specify the
permit or deny keyword and a path expression. Otherwise, the router removes the
entire community list.
• See ip extcommunity-list.
• Use to match an extended community list in a route map.
• You can specify one or more extended community list names in a match clause. If you
specify more than one extended community list, the lists are logically ORed.
• Use the no version to remove the set clause from the route map.
• See set extcommunity.
show ip extcommunity-list
Use to display information about a specific extended community list or all extended
•
community lists.
• Example
host1#show ip extcommunity-list
IP Extended Community List dresden1:
permit soo 10.10.10.10:15
IP Extended Community List bonn:
deny rt 12:12
• See show ip extcommunity-list.
Using Regular Expressions
You can use regular expressions when you define AS-path access lists and community
lists to more easily filter routes. A regular expression uses special characters—often
referred to as metacharacters—to define a pattern that is compared with an input string.
AS-path Lists
For an AS-path access list, the input string is the AS path of the routes to which the list
is applied with the route-map or neighbor filter-list commands. If the AS path matches
the regular expression in the access list, the route matches the access list.
ExampleThe following commands apply access list 1 to routes inbound from BGP peer 10.5.5.2.
Accesslist 1 usesa regular expressiontodeny routes thatoriginatein autonomous system
ExampleThe following commands apply route map 5 to routes forwarded to BGP peer 10.5.5.4.
Community Numbers
Chapter 1: Configuring Routing Policy
For a community list, the input string is the community attribute of the routes to which
the list is applied using a route-map command. If the community attribute matches the
regular expression in the community list, the route matches the community list.
Route map 5 uses a regular expression to match community numbers ending with 305,
setting the weight of matching routes to 150.
host1(config-router)#neighbor 10.5.5.4 remote-as 425
host1(config-router)#neighbor 10.5.5.4 route-map 5 out
host1(config-router)#exit
host1(config)#route-map 5 permit 10
host1(config-route-map)#match community 305$
host1(config-route-map)#set weight 150
When you use a regular expression to match a community number, use the appropriate
formatfor the communitynumber inthe community list. Ifyou issue the ip bgp-communitynew-format command, the community number has the format AA:NN where AA is a
number that identifies the autonomous system, and NN is a number that identifies the
community within the autonomous system. Otherwise, the community number is an
integer in the range 1–4294967295.
Metacharacters
Each regular expression consists of one or more metacharacters and zero or more
complete or partial AS or community numbers. Table 5 on page 43 describes the
metacharacters supported for regular expression pattern-matching.
Specifies patterns for multiple use when followed by one of the multiplier
metacharacters: asterisk (*), plus sign (+), or question mark (?).
Matches any enclosed character; specifies a range of single characters.[ ]
Used within brackets to specify a range of AS or community numbers.– (hyphen)
Matches a^, a $, a comma, a space, a {,or a }. Placed on either side of astring
to specify a literal and disallow substring matching. Numerals enclosed by
underscorescan be preceded orfollowed by anyof the characters listed above.
Matches characters on either side of the metacharacter; logical OR.|
Using Metacharacters as Literal Tokens
You can remove thespecial meaning of a metacharacter by preceding it with a backslash
(\). Sucha construction denotes that themetacharacter isnot treatedas ametacharacter
for that regular expression. It is simply a character or token with no special meaning, just
as a numeral has no special meaning. The backslash applies only to the character
immediately following it in the regular expression.
On an E Series router, you are likely to use the backslash only for the parentheses
characters, ( or ). BGP indicates a segment of an AS path that is of type AS-confed-set
or AS-confed-seq by enclosing that segment with parentheses.
ExampleThe following AS-path access list uses a regular expression to match routes that have
an AS-path attribute that begins with any AS-confed-set or AS-confed-seq:
host1(config)#ip as-path access-list 1 permit ^\(
The following AS-path access list uses a regular expression to match routes that have
an AS-path attribute that ends with any AS-confed-set or AS-confed-seq:
host1(config)#ip as-path access-list 1 permit \)$
The following AS-path access list uses a regular expression to match routes that have
an AS-path attribute that includes the specific AS-confed-set or AS-confed-seq, (100
Table 6 on page 45 lists some representative regular expressions that you might use in
an AS-path access list or community list, along with sample attribute values that match
or do not match the regular expression.
For information about using AS-path access lists, see “Access Lists” on page 20. For
information about using community lists, see “Community Lists” on page 37.
Managing the Routing Table
You can clear all routes from the IP routing table, and then enable the owning
protocols—BGP, OSPF, RIP—to reinstall the routes.
clear ip routes
• Use to clear all routing entries or a specified entry from the IP routing table.
Matched AS-Path or Community
Attribute
Includes the number 200 (as opposed
to the pattern consisting of numeral 2,
numeral 0, numeral 0)
Our implementation of regular
expressions is not literal. Substring
matching is enabled by default.
Specifying 200(no underscores) results
in a match on 200 and on 2005. The
underscore metacharacter disables
substring matching.
Example
33 200 422 48^200$
^200 500$
but not
33 20 422 48 51 2005
• Example
host1#clear ip routes
• There is no no version.
• See clear ip routes.
ip refresh-route
• Use toreinstall routes removedfrom theIP routing table by theclearip route command.
• Example
host1#ip refresh-route
• There is no no version.
• See ip refresh-route.
Troubleshooting Routing Policy
You can turn on debugging for routing policy by issuing the log severity debug
ipRoutePolicy command from Global Configuration mode. You can specify different
levels of severity for ipRoutePolicy. For more information about using log commands for
troubleshooting, see Managing the System in JunosE System Basics Configuration Guide.
You can monitor the following aspects of routing policy using show commands:
CommandsTo Display
Access lists
show access-list
show ip as-path access-list
show ipv6 access-list
show ip community-listCommunity lists
show ip match-policy-listPolicy lists
show ip prefix-listPrefix lists
show ip prefix-treePrefix trees
show ip protocolsProtocols
show ip redistributeRedistribution policies
show ip routeRoutes
show route-mapRoute maps
show ip route slot 5 192.168.5.4Interfaces and next hops
show ip staticStatic routes
show ip trafficTraffic
You can use theoutput filtering feature of the show command to include or exclude lines
of output based on a text string that you specify. For details, see Command Line Interface
in JunosE System Basics Configuration Guide.
show access-list
show ipv6 access-list
• Use to display information about access lists.
• The displayed information includes the instances of each access list.
• Use the detail keyword to display the automatically assigned element ID for each
access list entry. Only rules that you explicitly create have element IDs.
• Example 1
host1#show access-list
IP Access List 1:
permit ip host 172.31.192.217 any
permit ip 12.40.0.0 0.0.0.3 any
deny ip any any
IP Access List 2:
permit ip 172.19.0.0 0.0.255.255 any
deny ip 0.0.0.0 255.255.255.255 any
IP Access List 10:
permit ip any any
IP Access List 11:
deny ip any any
• Example 2
host1#show access-list detail
IP Access List 1:
1: permit ip host 172.31.192.217 any
2: permit ip 12.40.0.0 0.0.0.3 any
deny ip any any
• See show access-list.
• See show ipv6 access-list.
show ip community-list
Use to display information about AS-path access lists.•
• Example
host1#show ip as-path-access-list
AS Path Access List 1:
permit .*
AS Path Access List 2:
deny .*
AS Path Access List 3:
permit _109_
deny .*
AS Path Access List 4:
permit _109$
deny .*
AS Path Access List 10:
deny _109$
permit ^108_
deny .*
• See show ip as-path-access-list.
• Use to display community list information.
• Display varies based on whether you issued the ip bgp community new-format
command.
• Example 1—If you did not issue the ip bgp community new-format command, the
display appears as follows:
host1#show ip community-list
Community List 1:
permit 81200109
permit 81200110
permit 81200108
Community List 2:
deny 81200109
permit 81200110
permit 81200108
Community List 4:
permit local-as
Community List 5:
permit no-advertise
Community List 6:
permit no-export
Community List 7:
permit internet
• Example 2—If you did issue the ip bgp community new-format command, the display
appears as follows:
host1#show ip community-list
Community List 1:
permit 1239:1005
permit 1239:1006
permit 1239:1004
Community List 2:
deny 1239:1005
permit 1239:1006
permit 1239:1004
Community List 4:
permit local-as
Community List 5:
permit no-advertise
Community List 6:
permit no-export
Community List 7:
permit internet
show ip match-policy-list
show ip prefix-list
• See show ip community-list.
Use to display configured policy lists.•
• Example
host1#show ip match-policy-list
match-policy-list list1, permit
Match clauses:
match access-list addrList1
match distance 100
• See show ip match-policy-list.
• Use to display information about the prefix lists currently configured on the router.
• Use the summary keyword to display abbreviated information about prefix lists.
• Example 1
host1#show ip prefix-list
Prefix-list with the last deletion/insertion: def
ip prefix-list name abc: 4 entries
seq 5 permit 192.168.0.0/16 le 24
seq 10 permit 192.178.0.0/16 le 24
seq 15 deny 195.178.0.0/16 le 24
seq 20 deny 195.178.0.0/16 le 32
ip prefix-list name def: 1 entries
seq 5 deny 192.170.0.0/16
• Example 2
host1#show ip prefix-list summary
Total memory used for prefix-list: 310 bytes
Prefix-list with the last deletion/insertion: def
ip prefix-list name abc:
count: 4, range entries: 4, sequences: 5-20
ip prefix-list name def:
count: 1, range entries: 0, sequences: 5-5
• See show ip prefix-list.
• Use to display information about the prefix trees currently configured on the router.
• Use the summary keyword to display abbreviated information about prefix trees.
• Example 1
host1#show ip prefix-tree
Prefix-tree with the last deletion/insertion: t_abc5
ip prefix-tree name t_abc1: 1 entries
permit 108.243.0.0/16
ip prefix-tree name t_abc2: 3 entries
permit 101.10.254.0/24
permit 102.10.248.0/21
permit 103.10.192.0/18
permit 108.109.0.0/16
permit 108.109.241.0/24
ip prefix-tree name t_abc3: 1 entries
deny 108.0.0.0/8
• Example 2
host1#show ip prefix-tree summary
Total memory used for prefix-tree: 860 bytes
Prefix-tree with the last deletion/insertion: t_abc5
ip prefix-tree name t_abc1:
count: 1
ip prefix-tree name t_abc2:
count: 5
ip prefix-tree name t_abc3:
count: 1
• See show ip prefix-tree.
show ip protocols
• Use to display detailed information about the protocols currently configured on the
router.
• Use the summary keyword to display only a list of the configured protocols.
• For field descriptions, see the show commands for the individual routing protocols in
their respective Configuration Guide chapters.
• Example
host1#show ip protocols
Routing Protocol is “ bgp 1”
Default local preference is 100
IGP synchronization is enabled
Always compare MED is disabled
Router flap damping is disabled
Administrative Distance: external 20 internal 200 local 200
Neighbor(s):
No neighbors are configured
Routing for Networks:
Routing Protocol is “ ospf 255” with Router ID 100.100.100.1
Distance is 110
Address Summarization:
None
Routing for Networks:
show ip redistribute
Routing Protocol is “ rip”
Router Administrative State: enable
System version RIP1: send = 1, receive = 1 or 2
Update interval: 30 seconds
Invalid after: 180 seconds
hold down time: 120 seconds
flushed interval: 300 seconds
Filter applied to outgoing route update is not set
Filter applied to incoming route update is not set
No global route map
Distance is 120
Interface Tx Rx Auth
Routing for Networks:
10.2.1.0/255.255.255.0
• See show ip protocols.
• Use to display configured route redistribution policy.
host1#show ip redistribute
To ospf, From static is enabled with route map 4
To ospf, From connected is enabled with route map 3
• See show ip redistribute.
• Use to display the current state of the routing table, including routes that are not used
for forwarding.
• Youcan display allroutes, a specific route, all routesbeginning witha specifiedaddress,
routes for a particular protocol (BGP, IS-IS, OSPF, or RIP), locally connected routes,
internal control routes, static routes, or summary counters for the routing table.
• Field descriptions
• Prefix—IP address prefix
• Length—Prefix length
• Type—Protocol type
• Next Hop—IP address of the next hop
• Dist—Distance metric for the route
• Met—Number of hops
• Intf—Interface type and interface specifier
• Example 1
host1#show ip route
Protocol/Route type codes:
I1- ISIS level 1, I2- ISIS level2,
I- route type intra, IA- route type inter, E- route type external,
i- metric type internal, e- metric type external,
O- OSPF, E1- external type 1, E2- external type2,
N1- NSSA external type1, N2- NSSA external type2
• The displayed information includes the instances of each access list such as match
and set commands.
• Example
host1(config)#route-map 1 permit 10
host1(config-route-map)#match community 44
host1(config-route-map)#set local-pref 400
host1(config-route-map)#exit
host1(config)#exit
host1#show route-map 1
route-map 1, permit, sequence 10
Match clauses:
match community 44
Set clauses:
set local-pref 400
This chapter describes how to configure Network Address Translation (NAT) on your
ERX router; it contains the following sections:
•
Overview on page 61
•
Platform Considerations on page 62
•
References on page 62
•
NAT Configurations on page 63
•
Network and Address Terms on page 64
•
Understanding Address Translation on page 65
•
Address Assignment Methods on page 66
•
Order of Operations on page 66
•
PPTP and GRE Tunneling Through NAT on page 67
•
Packet Discard Rules on page 68
•
Before You Begin on page 68
•
Configuring a NAT License on page 68
•
Limiting Translation Entries on page 69
•
Specifying Inside and Outside Interfaces on page 69
•
Defining Static Address Translations on page 69
•
Defining Dynamic Translations on page 71
•
Clearing Dynamic Translations on page 76
•
NAT Configuration Examples on page 76
•
Tunnel Configuration Through NAT Examples on page 83
•
GRE Flows Through NAT on page 84
•
Monitoring NAT on page 84
Overview
The Internet faces the challenges of conserving IP address space while continuing to
provide scalability in routing. Network Address Translation (NAT) helps address these
challengesby allowing the conservation of registered IP addresses withinprivatenetworks
and simplifying IP addressing management tasks through a form of transparent routing.
NAT enables you to translate IP addresses between two address realms (for example,
between an intranet network that uses private, not publicly routable addresses and the
Internet, or betweentwooverlapping,privatenetworks).When incoming traffic is received,
the IP addresses are translated back for delivery within the private network.
Using NAT at the edge of your intranet provides the following advantages:
•
Allows unregistered private addresses to connect to the Internet by translating those
addresses into globally registered IP addresses
•
Increases network privacy by hiding internal IP addresses from external networks
Platform Considerations
For information about modules that support NAT on ERX14xx models, ERX7xx models,
and the ERX310 Broadband Services Router:
•
See ERX Module Guide, Table 1, Module Combinations for detailed module specifications.
•
See ERX Module Guide, Appendix A, Module Protocol Support for information about the
modules that support NAT.
Module Requirements
References
NOTE: The E120 and E320 Broadband Services Routers do not support configuration
of NAT.
To configure NAT on ERX7xx models, ERX14xx models, and the ERX310 router, you must
install a Service Module (SM). For information about installing modules in E Series
Broadband Services Routers, see the ERX Hardware Guide.
Unlike other line modules, SMs do not pair with corresponding I/O modules that contain
ingress and egress ports. Instead, they receive data from and transmit data to other line
modules with access to ingress and egress ports on their own associated I/O modules.
For a list of the modules that support NAT, see ERX Module Guide, Appendix A, ModuleProtocol Support.
For more information about NAT, consult the following resources:
RFC 3027-Protocol Complications with the IP Network Address Translator (January
2001)
You can configure NAT in several different ways. Each of the following configuration
methods provides a solution for different configuration requirements:
•
Traditional NAT
•
Bidirectional NAT
•
Twice NAT
Traditional NAT is the most common method of using address translation. Its primary
use is translating private addresses to legal addresses for use in an external network.
When configured for dynamicoperation,hosts withina privatenetwork can initiate access
to the external(public) network, but external nodeson theoutside network cannot initiate
access to the private network.
Addresses on the private network and public network must not overlap. Also, route
destination advertisements onthe publicnetwork (for example,the Internet) can appear
within theinside network, butthe NAT router doesnot propagateadvertisements of local
routes that reference private addresses out to the public network.
There are two types of traditional NAT—basic NAT and NAPT.
Basic NAT
Basic NAT provides translation for IP addresses only (called a simple translation) and
places the mapping into a NAT table. In other words, for packets outbound from the
private network, the NAT router translates the source IP address and related fields (for
example, IP, TCP, UDP, and ICMP header checksums). For inbound packets, the NAT
router translates the destination IP address (and related checksums) for entries that it
finds in its translation table.
CAUTION: Although NAT is the simplest translation method, it is the least secure. By
not including port or external host information in the translation, basic NAT allows
access to any port of the private host by any external host.
NAPT
Network Address Port Translation (NAPT) extends the level of translation beyond that
of basic NAT; it modifies both the IP address and the transport identifier (for example,
the TCP or UDP port number, or the ICMP query identifier) and places the mapping into
the translation table (this entry is called an extended translation). This method can
translate the addressesand transport identifiers ofmany private hosts into afewexternal
addresses and transport identifiers, to make efficient use of globally registered IP
addresses.
Similar to basic NAT, for outbound packetsNAPT translatesthe source IPaddress, source
transport identifier, and related checksum fields. For inbound packets NAPT translates
the destination IP address, destination transport identifier, and checksum fields.
Bidirectional NAT
Bidirectional (or two-way) NAT adds support to basic NAT for theDomain Name System
(DNS) so public hosts can initiate sessions into the private network, usually to reach
servers intended for public access.
When anoutside host attempts to resolvethe nameof aninside hoston aprivatenetwork,
the NAT router intercepts the DNS reply and installs an address translation to allow the
outside host to reach the inside host by using a public address. When the outside host
initiatesa connection withthe insidehost onthe privatenetwork, the NAT routertranslates
that public destinationaddress to theprivateaddressof theinside hostand, on thereturn
path, replaces the source address with the advertised public address.
You might need to perform some additional configuration to allow public access from
the Internet to a DNS server that resides in the private domain. (See “Bidirectional NAT
Example” on page 78.)
The same address space requirements and routing restrictions apply to bidirectional
NAT that weredescribed for traditional NAT. The difference between these twomethods
is that the DNS exchange might create entries within the translation table.
Twice NAT
In twice NAT, both the source and destination addresses are subject to translation as
packets traverse the NAT router in either direction. For example, you would use twice
NAT if you are connecting two networks in which all or some addresses in one network
overlap addresses in another network, whether the network is private or public.
Network and Address Terms
The NAT implementation defines an address realm as either inside or outside, with the
router that is running NAT acting as the defining boundary between the two realms.
From a NAT perspective, an inside network is the local portion of a network that uses
private,not publicly routable IP addresses that you want to translate. An outside network
is the public portion of a network that uses legitimate, publicly routable IP addresses to
which you want private hosts to connect.
The addresses that are translated by NAT between address realms are labeled as inside
or outside, and as local or global. When reading the terms in the following sections, keep
the following definitions in mind:
•
The terms inside and outside refer to the host that the address is associated with.
•
The terms local and global refer to the network on which the address appears.
The inside local address is a configured IP address that is assigned to a host on the inside
network. Addresses may be globally unique (not requiring translation), allocated from
the private address space defined in RFC 1918, or officially allocated to some other
organization.
Inside Global Addresses
The inside global address is the translated IP address of an inside host as seen by an
outside host and network. Addresses may be allocated from a globally unique address
space (often provided by the ISP,if theinside address isconnectedto theglobal Internet).
Outside Local Addresses
The outside local address is the translated IP address of an outside host as it appears to
the insidenetwork. Addressesmay begloballyunique (notrequiring translation),allocated
from the private address space defined in RFC 1918, or officially allocated to some other
organization.
Chapter 2: Configuring NAT
Outside Global Addresses
The outside global address is the configured, publicly routable IP address assigned to a
host on the outside network.
Understanding Address Translation
Address translation can occur one of two ways: inside or outside source translation.
Inside Source Translation
Inside source translation is the most commonly used NAT configuration. When an inside
host sends a packet to the outside network, the NAT router translates the source
information(either thesourceaddress or the source address/port pair)and, in the inbound
direction, restores the original information (this time operating on thedestination address
or address/port pair).
For outbound traffic, the NAT router translates the inside local address (or address/port)
into the inside global address (or address/port), either through a statically defined
translation or dynamically created translation. For inbound traffic, a translation must be
found to revert the inside global address (or address/port) into the inside local address
(or address/port), or the packet is not routed into the inside network.
NOTE: Dynamic inside source translations are established by outbound traffic.
You use inside source translation in traditional and bidirectional NAT configurations.
Outside Source Translation
Outside source translation is used inNAT configurations only when addresses ofexternal
hosts might create a conflict on the private network. This complementary translation
process is performed on the opposite addressing fields in the IP packet. When an outside
host sends a packet to the inside network, the NAT router translates the source
information (either the source address or the source address/port pair) and, in the
outbound direction, restores the original information (this time operating on the
destination address or address/port pair).
For inboundtraffic, the NAT routertranslates the outside global address (or address/port)
into the outside local address (or address/port), either through a statically defined
translation or dynamically created translation. For outbound traffic, a translation must
be found to revert the outside local address (or address/port) into the outside global
address (or address/port), or the packet is not routed into the outside network.
NOTE: Dynamic outside source translations are established by inbound traffic.
You use outside source translation along with inside source translation to configure twice
NAT.
Address Assignment Methods
NAT uses one of two methods to assign a translated IP address: static translation or
dynamic translation.
Static Translations
You enter static translations as direct configuration settingsthat remain inthe translation
table until you remove them. You use static translations when you must initiate
connections from both the inside and outside interfaces, or when the translation is not
subject to change.
Dynamic Translations
Dynamic translationsuse access list rules,to determine whetherto apply NAT to incoming
traffic, and NAT address pools, from which a NAT translation can obtain IP addresses.
You use dynamic translation when you want the NAT router to initiate and manage
address translation and session flows between address realms on demand.
Order of Operations
This section describes the order of operations for both inside-to-outside and
outside-to-inside translation.
Inside-to-Outside Translation
Inside-to-outside translation occurs in the following order:
1.Inside (privately addressed) trafficenters the router onan interface marked as inside.
2.A route lookup is performed.
3.If the next interface is marked as outside, the router sends the traffic to the server
4.The server module performs the appropriate translation.
5.The router forwards the packet to the appropriate egress line module.
6.The line module sends thepacket as outbound traffic using a globally unique source
address (inside sourcetranslation),destinationaddress (outside source translation),
and ports (NAPT).
Outside-to-Inside Translation
Outside-to-inside translation occurs in the following order:
1.Traffic from the outside, public domain enters the router.
2.All traffic from an interface that is marked outside, whether or not it requires NAT, is
sent to the server module.
3.The server module searches for an associated NAT match.
4.If the server module:
•
Finds a NAT match, and the destination interface is marked as inside, the server
module performs the appropriate translation and sends the packet to the
appropriate destination.
Chapter 2: Configuring NAT
•
Does not find a NAT match, and the destination interface is marked as inside, the
server module drops the packet.
•
Does not find a NAT match, and the destination interface is not marked as inside,
the server module processes the packet normally for its destination.
PPTP and GRE Tunneling Through NAT
You can configure NAT traversal support for GRE flows using simple translations (Basic
NAT). Because PPTP uses an enhanced GRE encapsulation for the PPP payload,
configuring for GRE flows also supports NAT traversal for PPTP tunnels.
NOTE: Neither port translation (NAPT) nor Firewall traversal for GRE packets is
supported for GRE flows.
When configured, the following types of translations are supported for GRE and PPTP
tunnels:
•
Inside source static simple translations (inbound and outbound)
•
Outside source static simple translations (inbound and outbound)
•
Inside source dynamic simple translations (inbound and outbound)
•
Outside source dynamic simple translations (inbound and outbound)
•
Combinations of the preceding translations (for example, twice NAT)
For all supported types of traffic (TCP, UDP, ICMP, and GRE), NAT discards packets in
the following cases:
•
When the translation table is full (that is, no more entries can be added).
•
When the address pool is exhausted for outbound packets with inside source dynamic
translation.
•
When no match can be found for the destination addresses of inbound packets.
•
When the address pool is exhausted for inbound packets with outside source dynamic
translation.
In addition, NAT discards GRE packets under the following conditions:
•
When the GRE packets match an NAPT rule.
•
When Firewall is functioning.
Before You Begin
You can configure certain IP interfaces to participate in Network Address Translation.
This chapter discusses how to configure NAT to function for certain IP interfaces. For
information about general IP interface configuration, see Configuring IP in JunosE IP, IPv6,and IGP Configuration Guide.
Configuring a NAT License
You must configure a NAT license before you can use any NAT commands on the ERX
router.
license nat
• Use to specify a NAT license.
• Purchase a NAT license to allow NAT configuration on the ERX router.
NOTE: Acquire the license from Juniper Networks Customer Services and Support or
from your Juniper Networks sales representative.
You can configure the maximum number of dynamic translation entries that the
translation table contains in global configuration mode for a given virtual router.
ip nat translation max-entries
• Use tospecify themaximum numberof dynamictranslation entriesthat the translation
table can contain in global configuration mode for the given virtual router.
• Use the no version to remove the configured limit and return the maximum number of
translation entries to the default, which is no enforced limit, as capacity allows.
• See ip nat translation max-entries.
Specifying Inside and Outside Interfaces
Chapter 2: Configuring NAT
You must mark interfaces that participate in NAT translation as residing on the inside or
the outside network.
CAUTION: Only packets routed between an inside and an outside interface are subject
to translation.
You can unmark an interface by using the no version of this command.
ip nat
• Use to mark an IP interface as participating in NAT translation.
• Use the keyword (inside or outside) to specify the side of the network on which the
interface resides.
• Example
host (config-if) # ip nat inside
• Use the no version to unmark the interface (the default) so that it does not participate
in NAT translation.
• See ip nat.
Defining Static Address Translations
Static address translation establishes aone-to-one mappingbetween a localand global
address or local and global address/port pair. When you specify a static address
translation or address/port pair translation, you issue commands to indicate how the
translation is applied, along with more specific variables that further define the type of
translation.
CAUTION: You must mark interfaces that participate in NATtranslation as on the inside
or the outside network. See “Specifying Inside and Outside Interfaces” on page 69 for
details.
Creating Static Inside Source Translations
You use the ip nat inside source static command to create static translations from a
local IP address to a global IP address, and to untranslate the destination address when
a packet returns from the outside network to the inside network. When you configure
traditional NAT (both basic NAT and NAPT), you only need to use this command alone.
However, when you configure twice NAT, you must also use “ip nat outside source static”
on page 70 .
The ip nat inside source static command creates a simple (IP address only) or extended
(IP address, port,and protocol) entry in the translation table that maps thetwo addresses.
ip nat inside source static
• Use to create static translations for a source address (or address/port pair) when
routing a packet from the inside network to the outside network, and to untranslate
the destination address (or address/port pair) when a packet returns from the outside
network to the inside network.
• A static translation created with the ip nat inside source static command enables any
outside host to contact the inside host by using the inside global address of the inside
host. A static translation can be used by traffic that is initiated in either direction
• Example 1—Simple address translation
host (config) # ip nat inside source static 10.1.2.3 171.69.68.10
• Use the no version to remove the static translationand purge the associated translations
from the translation table.
• See ip nat inside source static.
Creating Static Outside Source Translations
Less commonly used, outsidesourcetranslationenablesyou to set uptranslation between
two non-unique or not publicly routable networks (for example, two separate networks
that use overlapping IP address blocks).
ip nat outside source static
• Use to translate the source address when routing a packet from the outside network
to theinside network, andto untranslate the destination address when a packet travels
from the inside network to the outside network.
• Creates a simple (IP address only) or extended (IP address, protocol, and port) entry
in the translation table that maps the two addresses.
• A static translation created with the ip nat outside source static command enables
any inside host to contact the outside host by using the outside local address of the
outside host.A static translation can beused bytrafficthat isinitiatedin either direction.
• Example 1—Simple address translation
host (config) # ip nat outside source static 171.69.68.10 10.1.2.3
• Use the no version to remove the static translationand purge the associated translations
from the translation table.
• See ip nat outside source static.
Defining Dynamic Translations
Dynamic translations use access list rules, to determine whether or not to apply NAT to
incoming traffic, and NAT address pools, from which a NAT translation can allocate IP
addresses. You use dynamic translation when you want the NAT router to initiate and
manage address translation and session flows between address realms on demand.
Chapter 2: Configuring NAT
To configure dynamic translations:
•
Define any access list rules that the NAT router uses to decide which packets need
translation.
•
Define an address pool from which the NAT router obtains addresses.
•
Define inside and outside source translation rules for the NAT router to create NAT
translations.
•
Mark interfaces as inside or outside.
•
(Optional) Modify any translation timeout values.
Creating Access List Rules
Before you create a dynamic translation, create the access list rules that you plan to
apply to the translation. For information about configuring access lists, see “Configuring
Routing Policy” on page 3.
The router evaluates multiple commands for the same access list in the order they were
created. An undefined access list implicitly contains arule to permit any. A defined access
list implicitly ends with a rule to deny any.
NOTE: The access lists do not filter any packets; they determine whether the packet
requires translation.
You use the access-list command to create an access list.
• Use to define an IP access list to permit or deny translation based on the addresses in
the packets.
• Each access list is a set of permit or deny conditions for routes that are candidates for
translation (that is, moving from the inside network to the outside network).
• A zeroin thewildcardmask means that theroutemust exactlymatch the corresponding
bit in the address. A one in the wildcard mask means that the route does not have to
match the corresponding bit in the address.
• Use the log keyword to log an Info event in the ipAccessList log whenever matching
an access list rule.
• Example
host1(config)#access-list bronze permit ip host any 228.0.0.0 0.0.0.255
• Use the no version to delete the access list (by not specifying any other options), the
specified entry in the access list, or the log for the specified access list or entry (by
specifying the log keyword).
• See access-list.
Defining Address Pools
Before you can configure dynamic translation, create an address pool. An address pool
is agroup of IP addresses from whichthe NAT router obtains anaddress when dynamically
creating a new translation. You can create address pools with either a single range or
multiple, nonoverlapping ranges.
When you create a single range, you specify the starting and ending IP addresses for the
range in the root ip nat pool command. However, when you create multiple,
nonoverlapping ranges, you omit the optional starting and ending IP addresses in the
root ip nat pool command; this launches the IP NAT Pool Configuration
(config-ipnat-pool) mode.
The config-ipnat-pool modeuses an addresscommand to specifya range ofIP addresses.
You can repeat this command to create multiple, nonoverlapping ranges.
When you create or edit address pools, keep the following in mind:
•
•
•
Starting and ending IP addresses for the specified range are inclusive and must reside
on the same subnet.
Address ranges are verified against other ranges in the specified pool to exclude range
overlaps. Additional verification occurs when the pool is associated with a translation
rule and the router can determine whether the rule is inside or outside.
You cannot change the network mask if configured ranges already exist.
•
The network mask (or prefix length) is used to recognize host addresses that end in
either all zeros or all ones. These addresses are reserved as broadcast addresses and
are not allocated from an address pool, even if they are included in an address pool
range.
•
You cannot remove an address pool if the pool is part of a translation rule or if any of
the ranges within the pool are still in use. You must issue the clear ip nat translation
command to clear any ranges before you can remove the pool to which they apply.
• Use to specify a range of IP addresses in config-ipnat-pool mode; you can repeat the
You can use the CLI to define dynamic translation rules for inside and outside sources.
CAUTION: You must mark interfaces that participate in NAT translation as on the inside
or the outside network. See “Specifying Inside and Outside Interfaces” on page 69 for
details.
You can create a dynamic translation rule to configure inside source or outside source
translation. If the NAT router cannot locate a matching entry in its translation database
for a given packet, it evaluates the access list of all applicable dynamic translation rules
(inside source translation rules foroutbound packets and outside source translation rules
for inbound packets) against the packet. If an access list permits translation, the NAT
router tries to allocate an address from the associated address pool to install a new
translation.
When you create dynamic translation rules, keep the following in mind:
You can associatea listwith onepool atany given time. Associating alist witha different
pool replaces the previous association.
•
The optional overload keyword for inside source translation specifies that the router
employ NAPT.
•
You can configure dynamic NAPT for insidesourcetranslationonly;you cannot configure
dynamic NAPT for outside source translation.
•
When no match occurs for any dynamic translation rule, the NAT router does not
translate the packet.
•
When an address pool is empty, the NAT router drops the packet.
•
Access lists and pools do not have to exist when you are defining dynamic translation
rules; you may create them after you define the dynamic translations.
Creating Dynamic Inside Source Translation Rules
Use the ip nat inside source list command to create a dynamic inside source translation
rule. This command creates a translation rule that:
ip nat inside source list
•
Translates insidelocal source addresses to insideglobal addresses when packets from
the inside network are routed to the outside network
•
Translates outside local source addresses to outside global addresses when packets
from the outside network are routed to the inside network.
•
Use theoverloadkeyword to specify thatthe translation create NAPT entries(protocol,
port, and address) in the NAT table.
The no version of this command removes the dynamic translation rule, but does not
remove any previously created translations (resulting from the rule evaluation) from the
translation table. To remove active translations from the translation table, see “Clearing
Dynamic Translations” on page 76.
• Use to create dynamic translation rules that specify when to create a translation for
a source address whenrouting apacketfrom theinside network to theoutside network.
• Example
host (config) #ip nat inside source list translation1 pool pool1
• Use the overload keyword to specify that the translation create extended entries
(protocol, port, and address) in the translation table for NAPT.
• Use the no version to remove the dynamic translation rule; this command does not
remove any dynamic translations from the translation table.
• See ip nat inside source list.
Creating Dynamic Outside Source Translation Rules
Use theip nat outside source list command to createa dynamicoutside source translation
rule. This command dynamically translates outside global source addresses to outside
local addresses when packets are routed from the outside network to the inside network