Routing Policy
此内容尚不支持你的语言。
IP Prefix List View
Section titled “IP Prefix List View”Table 1 IP Prefix List View
| Command | Purpose |
|---|---|
| show ip prefix-list [summary|detail|list_name] | Display IP prefix list configuration. |
show ip prefix-list [summary|detail| list_name]
Section titled “show ip prefix-list [summary|detail| list_name]”[Command]
show ip prefix-list [summary|detail|list_name]
[Purpose]
Display IP prefix list configuration.
[Parameters]
| Parameter | Description |
|---|---|
| list_name | Specify the name of IP prefix list. |
[View]
Privileged User View
[Use Cases]
sonic# show ip prefix-list list1ZEBRA: ip prefix-list list1: 2 entries seq 3 permit 10.0.0.0/24 ge 25 le 26 seq 4 permit 20.0.0.0/24 ge 25 le 26OSPF: ip prefix-list list1: 2 entries seq 3 permit 10.0.0.0/24 ge 25 le 26 seq 4 permit 20.0.0.0/24 ge 25 le 26BGP: ip prefix-list list1: 2 entries seq 3 permit 10.0.0.0/24 ge 25 le 26 seq 4 permit 20.0.0.0/24 ge 25 le 26ISIS: ip prefix-list list1: 2 entries seq 3 permit 10.0.0.0/24 ge 25 le 26 seq 4 permit 20.0.0.0/24 ge 25 le 26IP Prefix List Config
Section titled “IP Prefix List Config”Table 2 IP Prefix List Config
| Command | Purpose |
|---|---|
| ip prefix-list list_name [seq sequence_number] {permit|deny} {any|A.B.C.D/M [ge ge|le le]} | Add an IP prefix list. |
ip prefix-list
Section titled “ip prefix-list”[Command]
ip prefix-list list_name [seq sequence_number] {permit|deny} {any|A.B.C.D/M [ge ge|le le]}
[Purpose]
Add an IP prefix list for reference by ROUTE-MAP.
[Parameters]
| Parameter | Description |
|---|---|
| list_name | Specify the name of IP prefix list. |
| sequence_number | Specify the sequence number. |
| A.B.C.D/M | Specifiy the network segment that this table entry matches. |
| ge | Specify the minimum prefix length, and the range is from 0 to 32. |
| le | Specify the maximum prefix length, and the range is from 0 to 32. |
[View]
Global Configuration View
[Notes]
The relationship between le, ge and length is: length <= ge <= le; Configuration of logically conflicting table entries within the same prefix list is not allowed. The list_name and sequence_number uniquely identify a table entry, and the IP prefix is not allowed to be the same between different table entries. Run command no ip prefix-list list_name [seq sequence_number] {permit|deny} {any|A.B.C.D/M [ge ge|le le]} to delete IP prefix list.
[Use Cases]
sonic# configure terminalsonic(config)# ip prefix-list list1 seq 3 permit 10.0.0.0/24 le 26 ge 25Route-Map
Section titled “Route-Map”Route-Map View
Section titled “Route-Map View”Table 3 Route-Map View
| Command | Purpose |
|---|---|
| show route-map [route-map|json] | Display route map. |
show route-map [ route-map|json]
Section titled “show route-map [ route-map|json]”[Command]
show route-map [route-map|json]
[Purpose]
Display route map.
[Parameters]
| Parameter | Description |
|---|---|
| route-map | Route map name. |
[View]
Privileged User View
[Use Cases]
sonic# show route-mapZEBRA:route-map: test Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap permit, sequence 1000 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemapOSPF:route-map: test Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap permit, sequence 1000 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemapOSPF6:route-map: test Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap permit, sequence 1000 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemapBGP:route-map: test Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: as-path exclude 1 31 comm-list 1 Call clause: Action: Exit routemap permit, sequence 1000 Invoked 0 Match clauses: community 10 Set clauses: as-path prepend 1 1 Call clause: Action: Exit routemapISIS:route-map: test Invoked: 0 Optimization: enabled Processed Change: false permit, sequence 10 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemap permit, sequence 1000 Invoked 0 Match clauses: Set clauses: Call clause: Action: Exit routemapRoute-Map Config
Section titled “Route-Map Config”Table 4 Route-Map Config
| Command | Purpose |
|---|---|
| route-map route-map {permit|deny} seq-num | Create a route map and enter Route-map Configuration View. |
| description description | Specify the description for the route-map. |
| matchas-path as_path_filter_name | Match AS-path list. |
| match community {community_list_number|community_list_name} [exact-match] | Match BGP community list. |
| match extcommunity {extcommunity_list_number|extcommunity_list_name} | Match BGP/VPN extended community list. |
| match {ip|ipv6} address {prefix-len length|prefix-list list_name} | Match address of route. |
| match {ip|ipv6} next-hop {prefix-len length|prefix-list list_name|address{A.B.C.D|X:X::X:X}|type blackhole} | Match next-hop address of route. |
| match local-preference preference_value | Match local-preference of route. |
| match metric metric_value | Match metric of route. |
| match peer{A.B.C.D|X:X::X:X|interface_name} | Match peer address. |
| set as-path prepend {as-path|last-as number} | Prepend to the as-path. |
| set as-path exclude AS-number | Exclude from the as-path. |
| setcommunity AA:NN | Set BGP Community. |
| set community none | Set no BGP Community. |
| set distance distance | Set BGP Administrative Distance to use. |
| set extcommunitynone | Set no extended community attribute. |
| set extcommunity rt ASN:NN_OR_IP-ADDRESS:NN | Set Route Target extended community. |
| set extcommunity soo ASN:NN_OR_IP-ADDRESS:NN | Set Site-of-Origin extended community. |
| setip next-hop {A.B.C.D|peer-address} | Set next-hop IP address. |
| set ipv6 next-hop {local X:X::X:X|global X:X::X:X|peer-address} | Set next-hop IPv6 address. |
| set local-preference preference_value | Set local-preference of route. |
| set metric {metric_value|rtt|+rtt|-rtt} | Set metric value. |
| set weight weight | Set BGP weight for routing table. |
route-map route-map {permit|deny} seq-num
Section titled “route-map route-map {permit|deny} seq-num”[Command]
route-map route-map {permit|deny} seq-num
[Purpose]
Create a route map and enter Route-map Configuration View.
[Parameters]
| Parameter | Description |
|---|---|
| route-map | Route map name. |
| seq-num | Sequence number, the range is from 1 to 65535. |
[View]
Global Configuration View
[Notes]
Run command no route-map route-map {permit|deny} seq_num to delete the route map.
[Use Cases]
sonic(config)# route-map test permit 100sonic(config-route-map)#description description
Section titled “description description”[Command]
description description
[Purpose]
Specify the description for the route-map.
[Parameters]
| Parameter | Description |
|---|---|
| description | In string form. |
[View]
Route-map Configuration View
[Notes]
Run command no description description to delete description.
[Use Cases]
sonic# configure terminalsonic(config)# route-map test permit 1000sonic(config)# description testmatch as-path as_path_filter_name
Section titled “match as-path as_path_filter_name”[Command]
match as-path as_path_filter_name
[Purpose]
Match AS-path list.
[Parameters]
| Parameter | Description |
|---|---|
| as_path_filter_name | AS-path list. |
[View]
Route-map Configuration View
[Notes]
Run command no match as-path as_path_filter_name to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match as-path testmatch community {community_list_number|community_list_name} [exact-match]
Section titled “match community {community_list_number|community_list_name} [exact-match]”[Command]
match community {community_list_number|community_list_name} [exact-match]
[Purpose]
Match BGP community list.
[Parameters]
| Parameter | Description |
|---|---|
| community_list_number | Community-list number, range from 1 to 500. 1-99 as standard and 100-500 as expanded. |
| community_list_name | Community name. |
| exact-match | Exact match. |
[View]
Route-map Configuration View
[Notes]
Run command no match community {community_list_number|community_list_name} [exact-match] to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match community testmatch ext community {extcommunity_list_number|extcommunity_list_name}
Section titled “match ext community {extcommunity_list_number|extcommunity_list_name}”[Command]
match ext community {extcommunity_list_number|extcommunity_list_name}
[Purpose]
Match BGP/VPN extended community list.
[Parameters]
| Parameter | Description |
|---|---|
| extcommunity_list_number | Community-list number, range from 1 to 500. 1-99 as standard and 100-500 as expanded. |
| extcommunity_list_name | Specify extcommunity-list. |
[View]
Route-map Configuration View
[Notes]
Run command nomatch extcommunity {extcommunity_list_number|extcommunity_list_name} to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match extcommunity 100match {ip|ipv6} address {prefix-len length|prefix-list list_name}
Section titled “match {ip|ipv6} address {prefix-len length|prefix-list list_name}”[Command]
match {ip|ipv6} address {prefix-len length|prefix-list list_name}
[Purpose]
Match address of route.
[Parameters]
| Parameter | Description |
|---|---|
| length | IP address length. |
| list_name | Specify the name of IP prefix list. |
[View]
Route-map Configuration View
[Notes]
Run command no match {ip|ipv6} address {prefix-len length|prefix-list list_name} to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match ip address prefix-list testmatch {ip|ipv6} next-hop {prefix-len length|prefix-list list_name|address {A.B.C.D|X:X::X:X}|type blackhole}
Section titled “match {ip|ipv6} next-hop {prefix-len length|prefix-list list_name|address {A.B.C.D|X:X::X:X}|type blackhole}”[Command]
match {ip|ipv6} next-hop {prefix-len length|prefix-list list_name|address {A.B.C.D|X:X::X:X}|type blackhole}
[Purpose]
Match next-hop address of route.
[Parameters]
| Parameter | Description |
|---|---|
| length | IP address length. |
| list_name | Specify the name of IP prefix list. |
| A.B.C.D | IPv4 address. |
| X:X::X:X | IPv6 address. |
[View]
Route-map Configuration View
[Notes]
Run command no match {ip|ipv6} next-hop {prefix-len length|prefix-list list_name|address {A.B.C.D|X:X::X:X}|typeblackhole} to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match ip next-hop type blackholematch local-preference preference_value
Section titled “match local-preference preference_value”[Command]
match local-preference preference_value
[Purpose]
Match local-preference of route.
[Parameters]
| Parameter | Description |
|---|---|
| preference_value | Route preference, range from 0 to 4294967295. |
[View]
Route-map Configuration View
[Notes]
Run command nomatch local-preference preference_value to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match local-preference 12match metric metric_value
Section titled “match metric metric_value”[Command]
match metric metric_value
[Purpose]
Match metric of route.
[Parameters]
| Parameter | Description |
|---|---|
| metric_value | Route metric, range from 0 to 4294967295. |
[View]
Route-map Configuration View
[Notes]
Run command no match metric metric_value to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match metric 12match peer {A.B.C.D|X:X::X:X|interface_name}
Section titled “match peer {A.B.C.D|X:X::X:X|interface_name}”[Command]
match peer {A.B.C.D|X:X::X:X|interface_name}
[Purpose]
Match peer address.
[Parameters]
| Parameter | Description |
|---|---|
| A.B.C.D | IPv4 address |
| X:X::X:X | IPv6 address |
| interface_name | interface name |
[View]
Route-map Configuration View
[Notes]
Run command no match peer {A.B.C.D|X:X::X:X|interface_name} to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# match peer 1.1.1.1set as-path prepend {as-path|last-as number}
Section titled “set as-path prepend {as-path|last-as number}”[Command] set as-path prepend {as-path|last-as number}
[Purpose]
Prepend to the as-path.
[Parameters]
| Parameter | Description |
|---|---|
| as-path | AS number, range from 1 to 4294967295. Specify multiple AS numbers separated by spaces. |
| last-as number | Use the last AS-number in the as-path. The number range is 1~10. |
[View]
Route-map Configuration View
[Notes]
set as-path prepend {as-path|last-as number} to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set as-path prepend 100 200set as-path exclude AS-number
Section titled “set as-path exclude AS-number”[Command]
set as-path exclude AS-number
[Purpose]
Exclude from the as-path.
[Parameters]
| Parameter | Description |
|---|---|
| AS-number | AS number, range from 1 to 4294967295. Specify multiple AS numbers separated by spaces. |
[View]
Route-map Configuration View
[Notes]
Run command no set as-path exclude AS-number to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set as-path exclude 12set community
Section titled “set community”[Command]
set community AA:NN
[Purpose]
Set BGP Community.
[Parameters]
| Parameter | Description |
|---|---|
| AA:NN | Community number in AA:NN format (where AA and NN are (0-65535)) or local-AS|no-advertise|no-export|internet|graceful-shutdown|accept-own-nexthop|accept-own|route-filter-translated-v4|route-filter-v4|route-filter-translated-v6|route-filter-v6|llgr-stale|no-llgr|blackhole|no-peer or additive |
[View]
Route-map Configuration View
[Notes]
Run command no set community AA:NN to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set community 12set community none
Section titled “set community none”[Command]
set community none
[Purpose]
Set no BGP Community.
[View]
Route-map Configuration View
[Notes] Run command no set community to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set community noneset distance distance
Section titled “set distance distance”[Command]
set distance distance
[Purpose]
Set BGP Administrative Distance to use.
[Parameters]
| Parameter | Description |
|---|---|
| distance | Range from 0 to 255. |
[View]
Route-map Configuration View
[Notes]
Run command no set distance distance to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set distance 12set extcommunity none
Section titled “set extcommunity none”[Command]
set extcommunity none
[Purpose]
Set no extended community attribute.
[View]
Route-map Configuration View
[Notes]
Run command no set extcommunity to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set extcommunity noneset extcommunity rt ASN:NN_OR_IP-ADDRESS:NN
Section titled “set extcommunity rt ASN:NN_OR_IP-ADDRESS:NN”[Command]
set extcommunity rt ASN:NN_OR_IP-ADDRESS:NN
[Purpose]
Set Route Target extended community.
[Parameters]
| Parameter | Description |
|---|---|
| ASN:NN_OR_IP-ADDRESS:NN | VPN extended community. When specifying more than one, separate them with a space. |
[View]
Route-map Configuration View
[Notes]
Run command no set extcommunity rt ASN:NN_OR_IP-ADDRESS:NN to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set extcommunity rt 100:1:2set extcommunity soo ASN:NN_OR_IP-ADDRESS:NN
Section titled “set extcommunity soo ASN:NN_OR_IP-ADDRESS:NN”[Command]
set extcommunity soo ASN:NN_OR_IP-ADDRESS:NN
[Purpose]
Set Site-of-Origin extended community.
[Parameters]
| Parameter | Description |
|---|---|
| ASN:NN_OR_IP-ADDRESS:NN | VPN extended community. When specifying more than one, separate them with a space. |
[View]
Route-map Configuration View
[Notes]
Run command no set extcommunity soo ASN:NN_OR_IP-ADDRESS:NN to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set extcommunity soo 100:1:2set ip next-hop {A.B.C.D|peer-address}
Section titled “set ip next-hop {A.B.C.D|peer-address}”[Command]
set ip next-hop {A.B.C.D|peer-address}
[Purpose]
Set next-hop IP address.
[Parameters]
| Parameter | Description |
|---|---|
| A.B.C.D | IPv4 address. |
| peer-address | Use peer address (for BGP only) |
[View]
Route-map Configuration View
[Notes]
Run command no set ip next-hop A.B.C.D to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set ip next-hop 1.1.1.1set ipv6 next-hop {local X:X::X:X|global X:X::X:X|peer-address}
Section titled “set ipv6 next-hop {local X:X::X:X|global X:X::X:X|peer-address}”[Command]
set ipv6 next-hop {local X:X::X:X|global X:X::X:X|peer-address}
[Purpose]
Set next-hop IPv6 address.
[Parameters]
| Parameter | Description |
|---|---|
| local X:X::X:X | IPv6 local address. |
| global X:X::X:X | IPv6 global address. |
| peer-address | Use peer address (for BGP only) |
[View]
Route-map Configuration View
[Notes]
Run command no set ipv6 next-hop local X:X::X:X to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set ipv6 next-hop local 100::1set local-preference preference_value
Section titled “set local-preference preference_value”[Command]
set local-preference preference_value
[Purpose]
Set local-preference of route.
[Parameters]
| Parameter | Description |
|---|---|
| preference_value | Preference value (0-4294967295) |
[View]
Route-map Configuration View
[Notes]
Run command no set local-preference preference_value to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set local-preference 12set metric {metric_value|rtt|+rtt|-rtt}
Section titled “set metric {metric_value|rtt|+rtt|-rtt}”[Command]
set metric {metric_value|rtt|+rtt|-rtt}
[Purpose]
Set metric value.
[Parameters]
| Parameter | Description |
|---|---|
| metric_value | Metric value (use +/- for additions or subtractions) (-4294967295-4294967295). |
| rtt | Assign round trip time. |
| +rtt | Add round trip time. |
| -rtt | Subtract round trip time. |
[View]
Route-map Configuration View
[Notes]
Run command no set metric {metric_value|rtt|+rtt|-rtt } to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set metric 12set weight weight
Section titled “set weight weight”[Command]
set weight weight
[Purpose]
Set BGP weight for routing table.
[Parameters]
| Parameter | Description |
|---|---|
| weight | Weight value, range from 0 to 4294967295. |
[View]
Route-map Configuration View
[Notes]
Run command no set weight weight to delete the configuration.
[Use Cases]
sonic(config)# route-map test permit 1000sonic(config-route-map)# set weight 12