match port

Configures matching based on TCP or UDP source or destination port for a route-map sequence number.

Syntax

match port { eq | gt | lt } port-num-1
match port neqport-num-1 [port-num-32 ]
match port range port-num-1 port-num-2
no match port { eq | gt | lt } port-num-1
no match port neqport-num-1 [port-num-32 ]
no match port range port-num-1 port-num-2

Command Default

Source port or destination port matching is not configured.

Parameters

eq port-num-1
Specifies that matching occurs when the packet source port or destination port is equal to the specified port number, which must be a valid UDP or TCP port number in the range from 0 through 65535.
gt port-num-1
Specifies that matching occurs when the packet source port or destination port is greater than the specified port number, which must be a valid UDP or TCP port number in the range from 0 through 65535.
lt port-num-1
Specifies that matching occurs when the packet source port or destination port is less than the specified port number, which must be a valid UDP or TCP port number in the range from 0 through 65535.
neqport-num-1 [port-num-32 ]
Specifies that matching occurs when neither the packet source port nor packet destination port is equal to all of the specified ports. Specified ports must be a valid UDP or TCP port number in the range from 0 through 65535.
range port-num-1 port-num-2
Specifies that matching occurs when the packet source port or destination port is within the specified range of port numbers, which must be valid UDP or TCP port numbers in the range from 0 through 65535.

Modes

Route-map configuration mode

Usage Guidelines

When match protocol and match port are specified in the same stanza, the protocol specified by the match protocol command must be either TCP or UDP.

Up to 128 match port statements are allowed per route-map sequence number for the following options:
  • eq
  • range
Only one match port statement is allowed per route-map sequence number for the following options:
  • lt
  • gt
  • neq

When multiple match port configurations exist, matching occurs when traffic matches any one of the configured ports.

Note

Note

Configuring the range option may create a lot of TCAM entries (due to rule expansion).

The no form of the command disables the configuration.

Examples

The following example shows how to configure matching based on port numbered 45 for sequence number 4 in a route-map named rm; a match occurs when either the packet source or destination port is in the range from 3 through 6000.

device# configure terminal
device(config)# route-map rm permit 4
device(config-route-map-rm/permit/4)# match port range 3 6000

The following example shows how to configure matching based on port for sequence number 4 in a route-map named rm; a match occurs when both the packet source port and packet destination port are not equal to 34 and 56 and 67.

device# configure terminal
device(config)# route-map rm permit 4
device(config-route-map-rm/permit/4)# match port neq 34 56 67