Skip to content
Ask AI

Route Map

[Command] show route-mapWORD

[Purpose] Display data about each daemons knowledge of individual route-maps

[Parameter]

ParameterDescription
WORDroute-map name

[View] System view

[Use Cases]

sonic# show route-map

[Command] clear route-map countersWORD

[Purpose] Clear counters that are being stored about the route-map utilization so that subsuquent show commands will indicate since the last clear

[Parameter]

ParameterDescription
WORDroute-map name

[View] System view

[Use Cases]

sonic# clear route-map counters

[Command] show ip prefix-list {detail|summary|NAME}

[Purpose] Display the IP prefix list

[View] System view

[Use Cases]

sonic# show ip prefix-list summary

bgp large-community-list {standard|expanded} NAME {permit|deny}

Section titled “bgp large-community-list {standard|expanded} NAME {permit|deny}”

[Command] **bgp large-community-list {standard|expanded}NAME{permit|deny}**LARGE-COMMUNITY **no bgp large-community-list {standard|expanded}NAME{permit|deny}**LARGE-COMMUNITY

[Purpose] This command defines a new standard large-community-list

[Parameter]

ParameterDescription
StandardStandard community list
ExpandedExpanded community list
NAMECommunity list name
LARGE-COMMUNITYlarge community in ‘aa:bb:cc’ format

[View] System configuration view

[Notes] When filtering BGP large community attributes, you can configure multiple filter criteria within the same entry. The relationship between filter criteria is “AND,” which means all filter criteria must be matched for the rule to be considered a match. For example, with the command “bgp large-community-list standard test 10 permit 100:1:1200:1:1300:1:1,” the rule will be considered a match only when all three large community values (100:1:1, 200:1:1, and 300:1:1) are simultaneously present.

Within a single list, multiple rules have an “OR” relationship. For example, with the commands “bgp large-community-list standard test 10 permit 100:1:1” and “bgp large-community-list standard test 20 permit 200:1:1,” when searching for rules within the “test” group, matching either 100:1:1 or 200:1:1 will be considered a match.

[Use Cases]

sonic# configure terminal
sonic(config)# bgp large-community-list standard as permit aa:bb:cc

[Command] route-mapWORD**{permit|deny}ORDER no route-map*WORD*****{permit|deny}**ORDER

[Purpose] Configure the order’th entry in route-map-name with Match Policy of either permit or deny

[Parameter]

ParameterDescription
WORDroute-map name
ORDERSequence to insert to/delete from existing route-map entry (1..65535)

[Notes] This command unconfigures the order entry in the routing table name.

[View] System configuration view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233

[Command] ip prefixNAME**[seqnumber] {permit|deny} {any|A.B.C.D/M{ge|le}length}** no ip prefixNAME

[Purpose] Configures an IP prefix list or one entry in the IP prefix list

[Parameter]

ParameterDescription
NAMESpecifies the name of an Ip prefix list
seq numberSpecifies the sequence number of the entry in the IP prefix list. The value is an integer ranging from 1 to 4294967295, By default, the sequence number increases with a step of 5 according to the configuration order, and the first number is 1.
permitSpecifies the matching mode of the IP prefix list as permit. In permit mode, if the IP address to be filtered is in the defined prefix range, the IP address matches the route-policy and no longer match against the next entry. Otherwise, the IP address continues to match against the next entry
denySpecifies the matching mode of the IP prefix list as deny. In deny mode, if the IP address to be filtered is in the defined prefix range, the IP address fails to match the route-policy and cannot match against the next entry. Otherwise, the IP address continues to match against the next entry
anyAll IP address
A.B.C.D/MSpecifies the IP address
ge lengthSpecifies the minimum value of the mask length range
le lengthSpecifies the maximum value of the mask length range
descriptionSpecifies the description information of the IP prefix list

[Notes] An IP prefix list can be used as a filter or as filtering conditions of a route-map

The matching principle of table entries in the address prefix list is: match according to the ordinal ID from smallest to largest, and no other table entries will be matched after the filtered route hits a certain table entry, and the route that cannot match any table entry is deemed to have failed the filter and will not enter any subsequent processing

[View] System config view

[Use Cases]

sonic(config)# ip prefix-list test permit 1.1.1.0/24 ge 32

[Command] match {ip|ipv6} address {prefix-lenLENGTH**|prefix-listPREFIX-LIST-NAME}** no match {ip|ipv6} address {prefix-lenLENGTH**|prefix-listPREFIX-LIST-NAME}**

[Purpose] Matches the specified prefix-list

[Parameter]

ParameterDescription
LENGTHMatch prefix length of IP address
PREFIX-LIST-NAMEMatch entries of prefix-lists

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match ip address prefix-list test

match {ip|ipv6} next-hop {prefix-len LENGTH|prefix-list PREFIX-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 PREFIX-LIST-NAME|address{A.B.C.D|X:X::X:X}|type blackhole}”

[Command] match {ip|ipv6} next-hop {prefix-lenLENGTH**|prefix-listPREFIX-LIST-NAME|address{A.B.C.D|X:X::X:X }|type blackhole} no match {ip|ipv6} next-hop {prefix-len*LENGTH*****|prefix-listPREFIX-LIST-NAME|address{A.B.C.D|**X:X::X:X }|type blackhole}

[Purpose] Match the next-hop

[Parameter]

ParameterDescription
LENGTHMatch prefix length of IP address
PREFIX-LIST-NAMEMatch entries of prefix-lists
A.B.C.DIP address of next-hop
X:X::X:XIPv6 address of next-hop

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match ip next-hop type blackhole

[Command] match as-pathString no match as-pathString

[Purpose] Matches the specified as_path.

[Parameter]

ParameterDescription
StringAS path access-list name

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match as-path test

[Command] match metricMETRIC no match metricMETRIC

[Purpose] Matches the specified metric.

[Parameter]

ParameterDescription
METRICvalue (0..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match metric 12

[Command] match tagTAG no match tagTAG

[Purpose] Matches the specified tag value associated with the route. 

[Parameter]

ParameterDescription
TAGTag value (1..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match tag 12

[Command] match local-preferenceMETRIC no match local-preferenceMETRIC

[Purpose] Matches the specified local-preference. 

[Parameter]

ParameterDescription
METRICMetric value (0..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match local-preference 12

[Command] match communityCOMMUNITY-LIST no math communityCOMMUNITY-LIST

[Purpose] Matches the specified community_list. 

[Parameter]

ParameterDescription
COMMUNITY-LISTCommunity-list name

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match community test

[Command] **match peer {A.B.C.D|**X:X::X:X |INTERACE_NAME} **no match peer {A.B.C.D|**X:X::X:X |INTERACE_NAME}

[Purpose] This is a BGP specific match command. Matches the peer ipv6 address if the neighbor was specified in this manner.

[Parameter]

ParameterDescription
A.B.C.DIP address of peer
X:X::X:XIPv6 address of peer
INTERFACE_NAMEInterface name of peer

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match peer 1.1.1.1

[Command] match peer local no match peer local

[Purpose] Matches the peer static or redistributed routes. 

[Notes] This command unmatches peer-to-peer static or redistributed routes.

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match peer local

match source-protocol {kernel|connected|static|rip|ripng|ospf|ospf6|isis|bgp|eigrp|nhrp|table|vnc|babel|sharp|openfabric}

Section titled “match source-protocol {kernel|connected|static|rip|ripng|ospf|ospf6|isis|bgp|eigrp|nhrp|table|vnc|babel|sharp|openfabric}”

[Command] match source-protocol {kernel|connected|static|rip|ripng|ospf|ospf6|isis|bgp|eigrp|nhrp|table|vnc|babel|sharp|openfabric} no match source-protocol {kernel|connected|static|rip|ripng|ospf|ospf6|isis|bgp|eigrp|nhrp|table|vnc|babel|sharp|openfabric}

[Purpose] This is a ZEBRA specific match command. Matches the originating protocol specified. 

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match source-protocol static

[Command] match source-instanceINSTANCE no match source-instanceINSTANCE

[Purpose] This is a ZEBRA specific match command.

[Parameter]

ParameterDescription
INSTANCEThe instance number (0..255)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# match source-instance 2

[Command] set tagTAG no set tagTAG

[Purpose] Set a tag on the matched route.

[Parameter]

ParameterDescription
TAGTag value (1..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set tag 12

[Command] set ip next-hopA.B.C.D no set ip next-hopA.B.C.D

[Purpose] Set the BGP nexthop address

[Parameter]

ParameterDescription
A.B.C.DIP address

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set ip next-hop 1.1.1.1

[Command] set ip next-hop peer-address no set ip next-hop peer-address

[Purpose] Set the BGP nexthop address to the address of the peer

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set ip next-hop peer-address

[Command] set ip next-hop unchanged no set ip next-hop unchanged

[Purpose] Set the route-map as unchanged

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set ip next-hop unchanged

[Command] set ipv6 next-hop peer-address no set ipv6 next-hop peer-address

[Purpose] Set the BGP nexthop address to the address of the peer.

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set ipv6 next-hop peer-address

[Command] set ipv6 next-hop prefer-global no set ipv6 next-hop prefer-global

[Purpose] For Incoming and Import Route-maps if we receive a v6 global and v6 LL address for the route, then prefer to use the global address as the nexthop.

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set ipv6 next-hop prefer-global

[Command] set ipv6 next-hop globalX:X::X:Xno set ipv6 next-hop globalX:X::X:X**

[Purpose] Set the next-hop to the specified IPV6_ADDRESS for both incoming and outgoing route-maps.

[Parameter]

ParameterDescription
X:X::X:XIPv6 address of next hop

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set ipv6 next-hop global 100::1

[Command] set local-preferencePREFERENCE no set local-preferencePREFERENCE

[Purpose] Subtract the BGP local preference.

[Parameter]

ParameterDescription
PREFERENCEPreference value (0-4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set local-preference 12

[Command] set distanceDISTANCE no set distanceDISTANCE

[Purpose] Set the administrative distance

[Parameter]

ParameterDescription
DISTANCEDistance value (0..255)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set distance 12

[Command] set weightWEIGHT no set weightWEIGHT

[Purpose] Set the route’s weight.

[Parameter]

ParameterDescription
WEIGHTvalue (0..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set weight 12

[Command] set metric {METRIC|rtt|+rtt**|-rtt}** no set metric {METRIC|rtt|+rtt**|-rtt}**

[Purpose] Set the BGP attribute MED to a specific value.

[Parameter]

ParameterDescription
METRIC2147483647..2147483647

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set metric 12

[Command] set as-path prepend [AS_PATH] [last-asNUMBER**]** no set as-path prepend [AS_PATH] [last-asNUMBER**]**

[Purpose] Set the BGP AS path to prepend.

[Parameter]

ParameterDescription
AS_PATHAS number (1..4294967295)
NUMBERNumber of times to insert (1..10)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set as-path prepend 12

[Command] set as-path exclude [AS_NUMBER] no set as-path exclude [AS_NUMBER]

[Purpose] Drop AS-NUMBER from the BGP AS path.

[Parameter]

ParameterDescription
AS_NUMBERAS number (1..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set as-path exclude 12

[Command] set community [COMMUNITY] no set community [COMMUNITY]

[Purpose] Set the BGP community attribute.

[Parameter]

ParameterDescription
COMMUNITYCommunity number in AA:NN format (where AA and NN are (0-65535)) or local-AS|no-advertise|no-export|internet or additive

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set community 12

[Command] set origin {egp|igp|incomplete} no set origin {egp|igp|incomplete}

[Purpose] Set BGP route origin.

[Notes] This command cancels the BGP route origin setting.

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set origin igp

[Command] set tableTABLEID no set tableTABLEID

[Purpose] Set the BGP table to a given table identifier.

[Parameter]

ParameterDescription
TABLEIDKernel routing table id (1..4294967295)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# set table 12

[Command] on-match {gotoNUMBER**|next}** no on-match {gotoNUMBER**|next}**

[Purpose] Proceed on to the next entry in the route-map

[Parameter]

ParameterDescription
NUMBERNumber (1..65535)

[View] Route-map view

[Use Cases]

sonic# clear route-map counters
sonic(config)# route-map test permit 233
sonic(config-route-map)# on-match next

[Command] set srcip-address

[Purpose] Set the preferred source address for matching routes when installing in the kernel

[Parameter]

ParameterDescription
ip-addressIPv4/IPv6 address

[View] Route-map view

[Use Cases]

sonic(config)# route-map RM_SET_SRC permit 10
sonic(config-route-map)# set src 30.11.0.48

[Command] ip protocolprotocolroute-maproutemap

[Purpose] Filter which routes will install in the kernel

[Parameter]

ParameterDescription
protocolkernel/connected/static/rip/ospf/isis/bgp/any
routemaprouter map name

[View] System configuration view

[Use Cases]

sonic(config)# ip protocol bgp route-map RM_SET_SRC