match source-port

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

Syntax

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

Command Default

Matching based on source port is not configured.

Parameters

eq port-num-1
Specifies that matching occurs when the packet source 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 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 is less than the specified port number, which must be a valid UDP or TCP port number in the range from 0 through 65535.
neq port-num-1 [port-num-32 ]
Specifies that matching occurs when the packet destination port is not equal to all of the specified ports. You can specify a maximum of 32 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 is within the specified range of port numbers, which must be a 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 source-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 source-port statements are allowed per route-map sequence number for the following options:
  • eq
  • range

When multiple match source-port statements of the same type exist, matching occurs when traffic matches any one of the statements.

Only one match source-port statement is allowed per route-map sequence number for the following options:
  • lt
  • gt
  • neq
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 a source port numbered 45 for sequence number 4 in a route-map named rm.

device# configure terminal
device(config)# route-map rm permit 4
device(config-route-map-rm/permit/4)# match source-port eq 45

The following example shows how to configure matching based on source port for sequence number 4 in a route-map named rm; a match occurs when traffic source port is 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 source-port neq 34 56 67