Modbus TCP/IP Port 502 (IANA Default Port 502) – What It Is, How It Works, Security & Configuration Guide

By | November 16, 2025

In almost every industrial plant today, you’ll find at least a few devices communicating over Modbus TCP/IP—PLCs, power meters, drives, analyzers, and sometimes entire SCADA systems built around it. Even though Modbus is one of the simplest industrial protocols, people still run into problems with connections, firewalls, and port settings. And most of those issues trace back to one thing:

The Modbus TCP/IP port (IANA).

If you’re setting up or troubleshooting a system that uses Modbus over Ethernet, understanding how the port works—and why the protocol relies on it—is essential. This article breaks everything down in clear, and include the details needed to use Modbus correctly.

The Default Modbus TCP/IP Port: 502

Let’s start with the most important fact:

Modbus TCP/IP uses port 502 by default (IANA)

This port is officially assigned by IANA and has become the universal standard for Modbus devices. Whether you’re working with Siemens, Schneider, WAGO, Beckhoff, or a generic energy meter from a lesser-known brand, you’ll almost always see port 502 used for communication.

Why does this matter?

Because when you know a device is listening on port 502, you immediately have a starting point for configuration, testing, and troubleshooting.

Why the Industry Uses Port 502

Modbus TCP/IP wasn’t designed to compete with high-speed industrial Ethernet protocols. Its strength is simplicity. Port 502 fits perfectly into that concept because:

  • It provides a consistent location where devices listen for Modbus requests
  • Manufacturers don’t need custom port assignments
  • You avoid port conflicts with EtherNet/IP, PROFINET, and other industrial protocols
  • SCADA and PLC systems can automatically scan and connect without extra setup

In other words: port 502 keeps Modbus TCP “plug and play.”

How Communication Works on Modbus TCP/IP Port 502

Modbus TCP/IP uses a client–server architecture. A PLC can be either one, depending on how the system is designed.

Here’s the simple overview:

  • The server (or Modbus “slave”) listens on port 502
  • The client (PLC, SCADA, or HMI) sends requests
  • The server reads or writes registers
  • A response is returned over the same port

Because everything passes through port 502, it acts as the “front door” for Modbus TCP devices.

What a Modbus TCP Packet Looks Like (Simplified)

If you were to look inside a Modbus TCP message using a tool like Wireshark, you’d see two main parts:

Modbus TCP-IP Frame Structure
Modbus TCP-IP Frame Structure

1. MBAP Header

Contains:

  • Transaction ID
  • Protocol ID
  • Length
  • Unit ID

2. PDU

Contains:

  • Function code (like reading holding registers)
  • Data (such as register numbers and values)

You don’t need to memorize the structure, but understanding it helps when diagnosing communication delays or inconsistent data responses.

Where You See Port 502 in Real Systems

Here are a few practical examples you’ll encounter in actual installations:

1. PLC Communicating With Energy Meters

A Siemens S7-1200 reads Modbus TCP registers from multiple energy meters. All the meters listen on port 502.

2. SCADA Monitoring an Entire Facility

A SCADA server may connect to dozens—or hundreds—of Modbus TCP devices, all through port 502.

3. Gateways Bridging Modbus RTU and Modbus TCP

A gateway might take RS-485 data from older Modbus RTU devices and make them available on Ethernet through port 502.

4. Multiple PLCs Sharing Data

Some PLCs support both roles:

  • They act as Modbus TCP/IP servers on port 502
  • They act as clients sending requests to other devices

This mixed architecture is surprisingly common in water treatment, manufacturing, and energy monitoring systems.

Can You Change the Modbus TCP Port?

Short answer: usually, yes.

Many devices allow you to run Modbus TCP on a different port. This is almost always done for security or network segmentation.

Common alternatives include:

  • 1502
  • 8502
  • 10502

However, if you change the port, everything else must also match:

  • PLC configuration
  • SCADA/HMI settings
  • Firewall rules

If one piece doesn’t match, communication stops.

Performance Tips for Stable Modbus Communication

Modbus TCP is simple, but it isn’t optimized for heavy, real-time traffic. Here are some practical ways to make communication smoother:

1. Read registers in larger blocks

One large read is better than 20 small reads.

2. Limit the number of clients

Some devices can only accept 1–5 connections at once.

3. Use static IP addresses

Modbus devices rarely move or change roles.

4. Keep the network architecture clean

Avoid unnecessary hops through routers.

These small steps prevent many of the performance problems people experience.

Troubleshooting Modbus TCP/IP Port 502 Issues

When Modbus TCP/IP doesn’t work, the port is often the issue. Here are the most common causes:

1. Firewall blocking port 502

Always check this first.

2. Wrong Unit ID

Even in TCP, some gateways require a specific Unit ID.

3. Incorrect register interpretation

Common mistakes:

  • Wrong data type
  • Wrong byte order
  • Two-byte vs. four-byte values
  • Mixing hex and decimal addresses

4. Too many clients connected

Many devices limit simultaneous connections.

Useful diagnostic tools

These tools make it easy to see what’s happening on port 502.

Real Wireshark Capture of Modbus TCP/IP Traffic on Port 502

Wireshark capture showing Modbus queries and responses on Modbus TCP/IP Por 502.
Wireshark capture showing Modbus TCP queries and responses on port 502.

The screenshot above shows a real Modbus TCP/IP communication captured in Wireshark using the filter:

tcp.dstport == 502

This filter isolates all packets sent to port 502, which is the default listening port for Modbus TCP servers.

In this capture, you can clearly see:

  • Source and destination IP: 127.0.0.1 (loopback test)
  • Protocol: Modbus/TCP
  • Function Code: 3 (Read Holding Registers)
  • Transaction IDs: Increasing for every request
  • Alternating Query/Response packets
  • TCP info: Seq, Ack, and segment lengths
  • Raw Modbus data: Shown in the hex pane at the bottom

This is exactly what a healthy Modbus TCP/IP cycle looks like:
a Query from the client → a Response from the server → repeated continuously.

What the highlighted packet shows

The highlighted packet details:

  • Destination Port: 502
  • Function Code: 3 (0x03)
  • Start Address: 0000
  • Quantity: 0010
  • Register values: Visible in the hex dump

This is the most common type of Modbus TCP message: reading holding registers from a device.

Security Considerations for Port 502

Modbus TCP has no built-in security:

  • No encryption
  • No authentication
  • No login
  • No user roles

For that reason, protecting port 502 is critical.
Here are practical steps:

1. Put Modbus devices on separate VLANs

Prevents unauthorized access from corporate networks.

2. Allow only trusted IP addresses

Block everything else.

3. Use a VPN for remote access

Never expose port 502 directly to the internet.

5. Use industrial firewalls

They can detect and block abnormal Modbus commands.

Conclusion

Port 502 may seem like a small detail, but it plays a huge role in making Modbus TCP/IP one of the most widely adopted industrial communication protocols in the world. Understanding how this port works—and how to secure and troubleshoot it—gives you a major advantage when designing or maintaining industrial systems.

Whether you’re integrating new meters, adding devices to a SCADA network, or troubleshooting communication failures, knowing the basics of port 502 makes your job easier and your systems more reliable.

Author: Zakaria El Intissar

I'm an automation and industrial computing engineer with 12 years of experience in power system automation, SCADA communication protocols, and electrical protection. I build tools and write guides for Modbus, DNP3, IEC 101/103/104, and IEC 61850 on ScadaProtocols.com to help engineers decode, analyze, and troubleshoot real industrial communication systems.

Leave a Reply

Your email address will not be published. Required fields are marked *