0% found this document useful (0 votes)
187 views3 pages

BGP Regex

This document provides examples of regular expressions used with BGP route filtering and summarization commands. It includes regular expressions to match routes originating from or passing through certain autonomous systems, routes with specific AS path lengths, privately originated routes, and routes from directly connected or downstream autonomous systems. Examples of common regular expression usage are provided for show commands like show route and show ip bgp along with explanations of what each expression matches.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views3 pages

BGP Regex

This document provides examples of regular expressions used with BGP route filtering and summarization commands. It includes regular expressions to match routes originating from or passing through certain autonomous systems, routes with specific AS path lengths, privately originated routes, and routes from directly connected or downstream autonomous systems. Examples of common regular expression usage are provided for show commands like show route and show ip bgp along with explanations of what each expression matches.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

noc@re0-EDGE-BG-1# run monitor traffic interface ae2.

0 detail matching "ip && ud


p && port 1900" no-resolve
monitor traffic matching " host 192.168.0.1 && udp && port 9997 "
admin@host> monitor traffic interface ge-0/0/1 matching "icmp or tcp"
user@host> monitor traffic matching ether[0] & 1 !=0
user@host> monitor traffic matching tcp || udp
Citanje file-a
monitor traffic read-file SNIFER.pcap
JNCIS SP Soricieli

show route terse community-name BOTH


show route terse community 65010:4321
show route community *:1111 detail
show route community 65010:4...
show route terse community *:...1
AS regex
show route aspath-regex ".*1$" ---->match rute koje su originate u AS 1
show route terse aspath-regex ".* 65060" --->match route koje su generisane u AS
65060
show route terse aspath-regex "65060 .*" ---> match sve rute iz neighbor-ovog AS
-a (AS 65060)
show route terse aspath-regex ".* (65040|65060)" --->match route koje su generi
sane u AS65040 ili 65060
show route terse aspath-regex ".* 65030 .+"
AS imaju 65030

-->match route koje kao tranzitni

show route protocol bgp terse aspath-regex "()" ----> match NULL AS PATH , rute
u okviru naseg AS-a
show route terse aspath-regex ".* 65080 .*" ----> sve bgp rute koje su rutirane
preko as-a 65080 + rute iz AS 65080
. 65020 This expression matches an AS Path with a length of 3 where the first AS
is
65010 and the last AS is 65020. The AS in the middle of the path can be any sing
le AS number.
65030? This expression matches an AS Path with a length of 0 or 1. A path length
of 0 is represented by the null AS Path. If a value appears, it must be 65030.
. (65040|65050)? This expression matches an AS Path with a length of 1 or 2. The
first AS

in the path can be any value. The second AS in the path, if appropriate, must be
either 65040
or 65050.
65060 .* This expression matches an AS Path with a length of at least 1. The fir
st AS number must
be 65060, and it may be followed by any other AS number any number of times or n
o AS numbers.
This expression is often used to represent all BGP routes from a particular neig
hboring AS network.
.* 65070 This expression matches an AS Path with a length of at least 1. The las
t AS number must
be 65070, and it may be preceded by any other AS number any number of times or n
o AS numbers.
This expression is often used to represent all BGP routes that originated from a
particular AS network.
.* 65080 .* This expression matches
65080 AS
number must appear at least once in
by any other
AS number any number of times. This
P routes that
have been routed by a particular AS

an AS Path with a length of at least 1. The


the path. It may be followed by or preceded
expression is often used to represent all BG
network.

.* (64512-65535) .* This expression matches an AS Path with a length of at least


1. One
of the private AS numbers must appear at least once in the path. It may be follo
wed by or preceded by any other AS number any number of times. This expression is useful at t
he edge of a
network to reject routes containing private AS numbers.
() This expression matches an AS Path with a length of 0. The null AS Path repre
sents all BGP
routes native to your local Autonomous System.
****************** C I S C O *************************
http://blog.ine.com/2008/01/06/understanding-bgp-regular-expressions/
show ip bgp regexp ^$

> Localy originated route ( empty AS PATH )

**** show ip bgp regexp ^8534_ > Learned from AS - rute


( AS 8534 )
*> 91.201.136.0/23 194.247.195.62
250
287 44287 44287 44287 44287 i
*> 91.201.136.0/22 194.247.195.62
250
287 44287 44287 44287 44287 i
*> 91.201.137.0/24 194.247.195.62
250
*> 91.201.138.0/23 194.247.195.62
250
287 44287 44287 44287 44287 i
*> 91.240.6.0/24
194.247.195.62
250
66 i
*> 91.240.6.0/23
194.247.195.62
250
*> 91.240.7.0/24
194.247.195.62
250
*> 195.250.96.0/22 194.247.195.62
300
*> 195.250.96.0/19 194.247.195.62
300
*> 195.250.100.0/22 194.247.195.62
300

iz neighbor-ovog AS-a
0 8534 44287 44287 44
0 8534 44287 44287 44
0 8534 44287 i
0 8534 44287 44287 44
0 8534 25467 8400 582
0
0
0
0
0

8534
8534
8534
8534
8534

58266 i
58266 i
i
i
i

*> 195.250.104.0/21 194.247.195.62


*> 195.250.112.0/20 194.247.195.62

300
300

0 8534 i
0 8534 i

**** show ip bgp regexp _8534$ > Originated in AS 100 ****


Network
Next Hop
Metric LocPrf Weight
*> 195.250.96.0/22 194.247.195.62
300
0
*> 195.250.96.0/19 194.247.195.62
300
0
*> 195.250.100.0/22 194.247.195.62
300
0
*> 195.250.104.0/21 194.247.195.62
300
0
*> 195.250.112.0/20 194.247.195.62
300
0
show ip bgp regexp _8534

Path
8534
8534
8534
8534
8534

i
i
i
i
i

> Any instance of AS 8534

****show ip bgp regexp ^8534_([0-9]+) - matches prefixes from the clients of di


rectly connected AS 8534
Network
Next Hop
*> 91.201.136.0/23 194.247.195.62
287 44287 44287 44287 44287 i
*> 91.201.136.0/22 194.247.195.62
287 44287 44287 44287 44287 i
*> 91.201.137.0/24 194.247.195.62
*> 91.201.138.0/23 194.247.195.62
287 44287 44287 44287 44287 i
*> 91.240.6.0/24
194.247.195.62
66 i
*> 91.240.6.0/23
194.247.195.62
*> 91.240.7.0/24
194.247.195.62

Metric LocPrf Weight Path


250
0 8534 44287 44287 44
250

0 8534 44287 44287 44

250
250

0 8534 44287 i
0 8534 44287 44287 44

250

0 8534 25467 8400 582

250
250

0 8534 58266 i
0 8534 58266 i

show ip bgp regexp ^([0-9]+)$


> AS PATH lenght 1
show ip bgp regexp ^([0-9]+)_([0-9]+)$
> AS PATH LENGHT 2 ( direktno poveza
ni klijenti na AS naseg upstream provajdera )
show ip bgp regexp ^8771_[0-9]*$ > isto kao predhosni ,samo se ovde daje AS 877
1 ( my upstream ) i njegovi direktno konektovani customeri
https://networklessons.com/bgp/bgp-regular-expressions-examples/
^([0-9]+)_51 - matches prefixes from AS 51 where AS 51 is behind one of our di
rectly connected AS es.
^(51_)+([0-9]+) - matches prefixes from the clients of directly connected AS 51,
where AS 51 might be doing AS PATH prepending.
^51_([0-9]+_)+ - matches prefixes from the clients of directly connected AS 51
, where the clients might be doing AS PATH prepending.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy