UDP port reflection

hello rene,

I have a question that is related to two topics: multicast and port forwarding.
i have a data stream of 239.10.10.1 with destination udp port 4001, due to some application limitations, i want to change the output port to 4002, Can we do that the same in cisco router??

Hey lagapidis,

this method is not working in my router,
set port 4002
is not avialable in 4451 cisco router

Hello VB

My apologies, you are absolutely correct. My response was incorrect and I have since deleted it. Route maps used for PBR operate at Layer 3 of the OSI model, and are not directly associated with any parameters found at the Transport layer, such as port numbers. I had responded without testing my assumptions.

In any case, to answer your original question, it is indeed possible to achieve the redirection of a UDP data stream from one port to another on a Cisco router, effectively changing the destination port of the data packets. You can use NAT to do this. NAT doesn’t only translate the IP addresses, but also the Transport Layer port numbers. However, the involvement of multicast in your particular scenario introduces a level of complexity that must be considered.

Given your requirement, you want to translate the destination port of incoming UDP packets from port 4001 to port 4002. To do so, you can use Port Address Translation (PAT). Here’s a simplified example of how you might configure this on a Cisco router. This example assumes that the interface receiving the multicast traffic is GigabitEthernet0/0 and the inside network is associated with GigabitEthernet0/1. Adjust these interface names as necessary for your router’s configuration.

ip access-list extended REDIRECT_UDP_PORT
permit udp host 239.10.10.1 any eq 4001

route-map PORT_REDIRECT permit 10
 match ip address REDIRECT_UDP_PORT
 set ip next-hop <next-hop-IP-address>

interface GigabitEthernet0/0
 ip policy route-map PORT_REDIRECT

ip nat inside source static udp 239.10.10.1 4001 interface GigabitEthernet0/1 4002

This configuration does a few things:

  1. Access List: It first defines an access list that matches UDP packets destined for port 4001 coming from the IP 239.10.10.1.
  2. Route Map: It uses a route map to apply specific actions to packets that match the access list criteria, such as setting the next hop IP address. (Replace <next-hop-IP-address> with the actual next-hop IP address for your setup.)
  3. NAT Configuration: It configures NAT to translate the source port 4001 to 4002 for packets that match the access list criteria. Note that this command might need to be adjusted based on your router’s version and the specific interfaces you’re working with. Also, NAT typically operates on unicast traffic, and special considerations may be needed for multicast streams.

Like I mentioned before, there’s an important caveat when working with multicast traffic: traditional NAT and PAT operations are designed for unicast traffic. Multicast traffic routing uses different mechanisms, such as IGMP and PIM, to manage how multicast streams are distributed across a network. The modification of multicast traffic ports through a router might not be straightforward or even supported in the same way as unicast traffic, depending on your network setup and the capabilities of your specific Cisco router model.

Given the complexity of working with multicast traffic and port translations, I highly recommend consulting the specific documentation for your Cisco router model and possibly reaching out to Cisco support for guidance. If at all possible, I would even try to find a different solution to the original problem.

Let us know how you get along, and if we can be of any further help.

I hope this has been helpful!

Laz