UDP ports

Is the IP port adjustable?

This question is sometimes asked by IT departments who need control over the IP port usage on their network.

Protocol:

The KNX System specifications specifies that UDP (User Datagram Protocol) is used for KNXnet/IP connections rather than TCP (Transmission Control Protocol) and therefore the following commentary on Ports and Messaging is in relation to UDP.

Device and Driver Ports:

There are four logical UDP ports allocated for each tunnel connection between the KNXnet/IP driver and a KNXnet/IP Interface device. Two ports (one for Control and one for Data) are at the device and two ports are at the driver (Control and Data). The Control port is used for such activities such as ‘Opening’ and ‘Closing’ the connection and for ‘Heart-Beat’. The Data port is used for Point Data.

Port numbers:

It is usual that KNXnet/IP Interface devices use port 3671 for both Control and Data but this may not always be the case. In the KNXnet/IP driver, the two ports it uses to communicate with the device are allocated dynamically when establishing and maintaining a connection. In this way, the driver can separate the messaging between multiple devices concurrently by allocating different port numbers. In the driver the Control and Data ports for each device will always be different.

Port number selection:

The port numbers used by the KNXnet/IP Interface device will be set by the ETS tool (providing that the device is able to be configured). The port numbers which are chosen dynamically by the KNXnet/IP driver for each Local Interface will be in a range between a port-minimum (0-65535) and port-maximum (0-65535). The default values of these are 3500 and 4000 although they can be changed during setup of the driver. (See Knx Network/Local Interface). Clearly if the range is reduced then this will start to restrict the number of potential device connections and ultimately if the range offers only one port number, the driver will not function because two ports is a minimum for each device connection.

Recycling port numbers:

When dynamically choosing a new port number, the KNXnet/IP driver will choose the next available port number by starting at the port-minimum (default setting) or by cycling through the range, this choice of behavior being selectable during setup of the driver. (See Knx Network/Local Interface).