Got it

BGP as-path-filter for Directly connected and next two ASNs

Created: Nov 29, 2021 06:58:03Latest reply: Nov 29, 2021 07:19:25 435 5 0 0 0
  HiCoins as reward: 0 (problem unresolved)

Hello all,

I need help on as-path-filter regex to allow prefixes of my directly connected upstream ASN, his customers and his next connected customers.

Idea is to shorten the BGP table by taking prefixes of my immediate neigbours and their neighbours and possibly their next neighbours. 


In Cisco we use sometjing like  ^45820_[0-9]+_[0-9]+_[0-9]*$

I've searched but there is no documentation in Huawei for such a regex.

Can someone please help?


Thanks

DP

Featured Answers

Recommended answer

chenhui
Admin Created Nov 29, 2021 07:11:13

Hi,
Actually, you can use that regular expression directly on Huawei devices.
Just as the example below:

#

ip as-path-filter t1 ^45820_[0-9]+_[0-9]+_[0-9]*$

#

route-policy r1 permit node 10 

 if-match as-path-filter t1

#

View more
  • x
  • convention:

PanchakS
PanchakS Created Nov 30, 2021 01:25:21 (0) (0)
 
All Answers
Hello,
We're working on your problem. Please be patient.
View more
  • x
  • convention:

Hi,
Actually, you can use that regular expression directly on Huawei devices.
Just as the example below:

#

ip as-path-filter t1 ^45820_[0-9]+_[0-9]+_[0-9]*$

#

route-policy r1 permit node 10 

 if-match as-path-filter t1

#

View more
  • x
  • convention:

PanchakS
PanchakS Created Nov 30, 2021 01:25:21 (0) (0)
 
BAZ
BAZ MVE Author Created Nov 29, 2021 07:19:25


A regular expression is a mode matching tool. You can create a matching mode based on specified rules and then match target objects based on the matching mode. A regular expression consists of 1 to 256 common characters and special characters.

  • Common characters

A regular expression matches a string against the defined common characters. The common characters include all uppercase and lowercase letters, digits, underscores, punctuations, and some special symbols. For example, a matches the letter "a" in "abc", 10 matches the digits "10" in "10.113.25.155", and @ matches the symbol "@" in "xxx@xxx.com".

  • Special characters

Special characters are a set of symbols with special meanings which are provided to flexibly create matching modes. The special characters are also called metacharacters. Table 1 describes special characters and their syntax.

Table 1 Description of special characters

Special Character

Function

Example

\

Defines an escape character, It converts a special or common character next to it to a common character.

\* matches the asterisk (*).

^

Matches the starting position of the string.

^10 matches 10.10.10.1 instead of 20.10.10.1.

$

Matches the ending position of the string.

1$ matches 10.10.10.1 instead of 10.10.10.2.

*

Matches the preceding element zero or more times.

10* matches 1, 10, 100, 1000, and so on.

(10)* matches null, 10, 1010, 101010, and so on.

+

Matches the preceding element one or more times.

10+ matches 10, 100, 1000, and so on.

(10)+ matches 10, 1010, 101010, and so on.

?

Matches the preceding element zero or one time.

NOTE:

Currently, if you enter the regular expression (?) on Huawei data communications devices, the command help information is displayed. Huawei data communications devices do not support special characters in the regular expression (?).

10? matches 1 or 10.

(10)? matches null or 10.

.

Matches any single character.

0.0 matches 0x0, 020, and so on.

.oo. matches book, look, tool, and so on.

()

Defines a subexpression, which can be null. Both the expression and the subexpression should be matched.

100(200)+ matches 100200, 100200200, and so on.

x|y

Matches x or y.

100|200 matches 100 or 200.

1(2|3)4 matches 124 or 134, rather than 1234, 14, 1224, and 1334.

[xyz]

Matches any single character in the regular expression.

[123] matches the character 2 in 255.

[^xyz]

Matches any character that is not in the regular expression.

[^123] matches any character except 1, 2, and 3.

[a-z]

Matches any character within the specified range.

[0-9] matches any character ranging from 0 to 9.

[^a-z]

Matches any character beyond the specified range.

[^0-9] matches all non-numeric characters.

A simple regular expression does not contain any special character. For example, you can create a simple regular expression "hello" to match the character string "hello" only. In practice, multiple common and special characters are used together to match a character string with special features.

  • Degeneration of special characters

Certain special characters degenerate to common characters when they are placed at certain positions in a regular expression.

    • The special characters following "\" match special characters themselves.

    • The special characters "*", "+", and "?" are placed at the starting position of the regular expression. For example, +45 matches +45 and abc(*def) matches abc*def.

    • The special character "^" is placed at any position except the start of the regular expression. For example, abc^ matches abc^.

    • The special character "$" is placed at any position except the end of the regular expression. For example, 12$2 matches 12$2.

    • A right parenthesis ")" or right bracket "]" is not paired with a corresponding left parenthesis "(" or bracket "[". For example, abc) matches abc) and 0-9] matches 0-9].


View more
  • x
  • convention:

PanchakS
PanchakS Created Nov 30, 2021 01:25:33 (0) (0)
 

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.