Networking basics
ROS 2 systems often communicate across a network, for example between a laptop and a robot computer. This page introduces the Linux networking commands used in the workshop.
IP addresses
Each network interface normally has an IP address. An address such as
192.168.3.42 identifies a computer on a local network.
Show the interfaces and their addresses:
ip addr
Show only the addresses assigned to the computer:
hostname -I
Interface names vary between computers. Typical names include:
lo: the local loopback interfaceenp...oreth...: an Ethernet interfacewlp...orwlan...: a Wi-Fi interface
The older ifconfig command may not be installed by default. Prefer
ip addr on current Ubuntu systems.
Check connectivity with ping
ping tests whether another machine is reachable:
ping -c 4 192.168.3.42
The -c 4 option stops after four requests. Without it, press Ctrl+C to
stop the command.
A successful response looks similar to:
64 bytes from 192.168.3.42: icmp_seq=1 ttl=64 time=1.23 ms
A failed ping can mean that the target is offline, connected to a different network, using a different address, or blocking ping with a firewall.
Connect with SSH
SSH opens a secure terminal on another computer:
ssh student@192.168.3.42
The first connection may ask you to confirm the remote host fingerprint. Verify the address before accepting it. Leave the remote session with:
exit
Copy files with scp
Copy a local file to a remote computer:
scp my_file.txt student@192.168.3.42:/home/student/
Copy a remote file into the current local directory:
scp student@192.168.3.42:/home/student/my_file.txt .
Copy a directory recursively:
scp -r my_directory student@192.168.3.42:/home/student/
ROS 2 networking checklist
For two ROS 2 computers to discover each other:
Connect them to the same network.
Confirm that they can reach each other.
Use compatible ROS 2 distributions and middleware configurations.
Set the same
ROS_DOMAIN_IDon machines that should communicate.Check firewall and multicast settings if discovery still fails.
Display the configured domain:
printenv ROS_DOMAIN_ID
Exercise
Connect to the network specified by the instructor.
Find your computer’s IP address with
ip addrorhostname -I.Exchange IP addresses with another participant.
Test both directions with
ping.If SSH is enabled, connect to the other computer using the account provided by the instructor.