Information Technology Reference
In-Depth Information
Filtering show ip cef Output with a Regular Expression
Example 4-3
R1#show ip cef | include Ethernet0/0
172.16.0.0/16 192.168.12.2 Ethernet0/0
192.168.12.0/24 attached Ethernet0/0
192.168.12.2/32 192.168.12.2 Ethernet0/0
192.168.23.0/24 192.168.12.2 Ethernet0/0
192.168.25.0/24 192.168.12.2 Ethernet0/0
192.168.36.0/24 192.168.12.2 Ethernet0/0
To type a question mark in a regular expression on the router, first press Ctrl-V (Escape for
CLI), and then you can enter ? .
NOTE
Regular expressions are used extensively in pattern matching to define BGP policies, such
as AS_PATH filtering. The AS_PATH attribute lists, in reverse order, the AS numbers,
separated by blank spaces, that the prefix has traversed. You can use the command show ip
bgp regexp to verify the result of the configured regular expressions.
Table 4-7 shows some examples of common AS_PATH pattern matching using regular
expressions.
Table 4-7 Examples of AS_PATH Pattern Matching Using Regular Expressions
AS_PATH Pattern
Usage
. *
Matches all path information—for example, no filtering.
^$
Matches updates originated from the local AS.
^200$
Matches all paths that start and end with AS 200—that is, only updates
originated and sent from AS 200 (no AS prepending and no
intermediary). For example, this does not match 200 200.
_200$
Matches all routes originated from AS 200, including those prepended
with 200.
^200
Matches any updates received from the neighboring AS 200, such as
200, 200 100, 200 300 100, 2001, and so on.
_200_
AS_PATH contains AS 200 (the prefix passed through AS 200 but not
necessarily originated by or received directly from AS 200), such as 200,
200 100, 300 200 100, and so on.
^100(_100)*(_400)*$
Matches paths from AS 100 and its immediate neighbor AS 400, such as
100, 100 100, 100 400, 100 400 400, 100 100 100 400 400, and so on.
 
Search WWH ::




Custom Search