Inferensys

Glossary

ROS 2 Domain ID

A ROS 2 Domain ID is a network segmentation integer that isolates ROS 2 graphs, preventing nodes in different domains from discovering or communicating with each other.
Enterprise console with connected nodes and monitoring panels for orchestrated systems.
NETWORK SEGMENTATION

What is ROS 2 Domain ID?

A core networking concept in ROS 2 that isolates robotic systems on shared physical networks.

A ROS 2 Domain ID is an integer identifier (0-232) set via the ROS_DOMAIN_ID environment variable that logically segments a network, creating isolated ROS 2 communication domains. Nodes sharing the same Domain ID can discover and communicate with each other, forming a single ROS graph, while nodes with different IDs are completely invisible to one another, even on the same physical network. This mechanism provides essential network-level isolation for multi-robot systems or development environments.

The default Domain ID is 0. Changing this value is a fundamental step for deploying multiple independent robotic systems on a shared network segment, such as in a lab or warehouse, preventing accidental cross-talk. It also enables safe parallel development and testing by isolating a developer's local ROS graph from other active systems. The Domain ID is a foundational layer of the ROS 2 DDS-based architecture, acting as a filter during the node discovery process managed by the underlying Data Distribution Service middleware.

ROS 2 DOMAIN ID

Key Features and Characteristics

The ROS 2 Domain ID is a fundamental network isolation mechanism. Its primary features define how it segments communication, its practical configuration, and its role in system architecture.

01

Network Segmentation via Integer ID

A ROS 2 Domain ID is a simple integer (0-232) that creates a logical partition on a network. Nodes sharing the same Domain ID can discover and communicate with each other, forming a single ROS Graph. Nodes with different IDs are completely invisible to one another, as if they were on separate physical networks. This segmentation is enforced at the Data Distribution Service (DDS) middleware layer, which handles all discovery and data exchange.

  • Default Value: The default domain ID is 0 (ROS_DOMAIN_ID=0).
  • Range: Valid IDs range from 0 to 232 (as defined by the DDS RTPS protocol).
  • Isolation Principle: No discovery packets, topics, services, or actions are transmitted between domains.
02

Configuration via Environment Variable

The domain ID for a ROS 2 node is set exclusively through the ROS_DOMAIN_ID environment variable. This variable must be set before the node process is launched and is read during the node's initialization. The value is not a node parameter and cannot be changed at runtime.

  • Setting the Variable: export ROS_DOMAIN_ID=42
  • Process-Specific: Each terminal/session can have its own ROS_DOMAIN_ID, allowing a single machine to host nodes in multiple domains.
  • Launch File Integration: The variable is typically set in shell scripts or within launch files using the env argument to configure entire subprocess trees.
03

Primary Use Case: Logical Isolation

The core purpose is to run multiple independent ROS 2 systems on the same physical network without interference. This is critical for:

  • Development and Testing: Isolating a developer's experimental robot graph from the production system running on the same lab network.
  • Multi-Robot Fleets: Operating several identical robots in the same space, where each robot must only communicate with its own onboard nodes.
  • Simulation vs. Reality: Running a high-fidelity simulation (in one domain) alongside a physical robot (in another) on the same workstation without cross-talk.
  • Security Sandboxing: Containing systems to prevent accidental or malicious command of physical hardware.
04

Interaction with DDS and Multicast

Domain ID isolation is implemented by the underlying DDS implementation. The ID modifies the multicast addresses and ports used for node discovery and data traffic.

  • Multicast Groups: DDS uses specific IP multicast groups (e.g., 239.255.0.1) for discovery. The Domain ID alters the final octet of this address.
  • Port Calculation: Data ports are also offset by the domain ID, ensuring complete network stack separation.
  • Implication: For domains to function correctly, the network infrastructure must support and route the required multicast traffic, which can be a consideration in restricted enterprise environments.
05

Limitations and Considerations

While powerful for isolation, Domain IDs have specific constraints:

  • No Inter-Domain Communication: By design, there is no built-in ROS mechanism for communication across domains. Bridging requires external tools like a custom ROS Bridge or shared non-ROS interfaces (e.g., sockets).
  • Not a Security Feature: Domain isolation is a logical convenience, not a security boundary. It prevents accidental communication but does not provide authentication or encryption. For secure systems, SROS2 (ROS 2 Security) must be used in conjunction.
  • System-Wide Setting: All nodes that need to communicate must be launched with the exact same environment variable value; a single typo (ROS_DOMAIN_ID=10 vs. ROS_DOMAIN_ID=11) creates two isolated systems.
06

Best Practices for System Design

Effective use of Domain IDs involves deliberate system architecture:

  • Standardize IDs: Document and standardize domain IDs across teams (e.g., 0 for production, 1-10 for developer sandboxes, 42 for simulation).
  • Use in CI/CD Pipelines: Set unique domain IDs for each parallel automated test run to prevent interference between simultaneous robot simulations.
  • Combine with Namespaces: For complex multi-robot systems, use Domain IDs for physical robot isolation, and ROS namespaces (/robot1, /robot2) for logical organization within a single robot's graph.
  • Verify with CLI Tools: Use ros2 topic list and ros2 node list to confirm node visibility is constrained to the intended domain.
NETWORK SEGMENTATION COMPARISON

ROS 2 Domain ID vs. Other Isolation Methods

A comparison of the primary methods for isolating ROS 2 communication graphs, highlighting the operational trade-offs for development, testing, and production.

Feature / MetricDomain ID (ROS_DOMAIN_ID)Network Namespace / VLANSeparate Physical NetworkROS 2 Security (SROS 2)

Primary Isolation Layer

Application (DDS Discovery)

OSI Layer 3 (IP)

OSI Layer 1/2 (Physical/Data Link)

Application (Authentication/Encryption)

Configuration Complexity

Trivial (Single Integer)

Moderate (OS/VLAN config)

High (Hardware wiring & config)

High (PKI, policy files)

Runtime Overhead

Negligible

Low (Kernel routing)

None

High (Cryptographic ops)

Supports Multiple Graphs on Single Host

Supports Cross-Subnet Communication

Prevents Accidental Cross-Talk

Prevents Malicious Interference

Typical Use Case

Development, CI/CD, logical separation

Testing, multi-tenant hosts

Production, safety-critical systems

Production, untrusted networks

ROS 2 DOMAIN ID

Frequently Asked Questions

A ROS 2 Domain ID is a network segmentation integer that isolates ROS 2 graphs, preventing nodes in different domains from discovering or communicating with each other. Below are common questions about its function, configuration, and use cases.

A ROS 2 Domain ID is an integer (0-232) used to logically segment a network, ensuring that ROS 2 nodes can only discover and communicate with other nodes sharing the same ID. It is set via the ROS_DOMAIN_ID environment variable. This mechanism prevents interference between separate robotic systems or development teams operating on the same physical network, such as in a shared lab or on a common Wi-Fi network. The Domain ID is a core part of the Data Distribution Service (DDS) discovery protocol that underpins ROS 2.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.