Skip to content
  • Home
  • About the Blog
  • About the Author
  • Sitemap

Abdur Rosyid's Blog

Just a few notes on mechanical engineering and robotics

How to establish ROS1 network between multiple machines

July 5, 2021 by Abdur Rosyid

In ROS1, one machine/robot should serve as ROS Master whereas all the other machines/robots/devices in the same ROS network serve as ROS Clients. ROS Master can be a computer or a robot. The ROS Client can be a computer, a robot, or a device. The following is some steps to setup ROS1 network between multiple machines/robots/devices:

Step 1: To avoid a dynamic change of the IP addresses of all the machines to be connected, the IP addresses of all the machines should be set as static IPs. This can be done in two ways: 1) using GUI or 2) manual setup. The GUI can be found in Settings > Network. The manual setup of a static IP address can be performed as follows:

1 List all the network interfaces available in the computer by typing this command in the terminal:

ip a

or:

ip link show

The output will look like this:

1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s3:  mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 08:00:27:2f:a4:ad brd ff:ff:ff:ff:ff:ff

Notice the network interface you would like to provide a static IP address.

2 Open /etc/network/interfaces. It will look like this:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

3 Add the static IP information of the network interface of interest. Let’s say you want to assign a static IP address to the network interface “enp0s3”, then the following lines should be added to /etc/network/interfaces:

auto enp0s3
iface enp0s3 inet static
        address 10.1.1.83
        netmask 255.0.0.0
        gateway 10.1.1.1
        dns-nameservers 8.8.8.8 8.8.4.4

Step 2: Type in the bashrc file in every computer, which can be either a development computer or a robot computer:

export ROS_MASTER_URI = http://ip_of_master_computer:11311 
export ROS_IP = ip_of_local_computer

Alternatively, ROS_HOSTNAME can also be used instead of ROS_IP, so that it looks like this:

export ROS_MASTER_URI = http://ip_of_master_computer:11311 
export ROS_HOSTNAME = hostname_of_local_computer

ROS_MASTER_URI should be the same in all the computers because there is only one ROS Master in the ROS network. ROS_IP or ROS_HOSTNAME is the IP address or the hostname of the local computer, respectively. The IP address of a computer’s network card can be found by typing this command in the terminal:

ifconfig

The output of this command will look like this:

Assuming that this computer is connected to the ROS network through Wifi, then the IP address is the one indicated under the “wlan0” entry, i.e. 10.25.0.128.

To find the hostname of a local computer, there are two ways: 1) looking at the hostname in /etc/hostname, or 2) looking at the hostname in an opened terminal; the hostname is what comes after @ in the terminal prompt. The hostname of a computer can be changed by opening /etc/hostname and changing the hostname in this file.

Step 3: List in /etc/hosts the IP addresses and the hostnames of all the computers (both the development computer and the robot’s computer(s)) and the devices that are expected to be connected in the ROS network.

Step 4: Test the connectivity by pinging other machines in the ROS network.

Post navigation

Previous Post:

How to Install ROS1 (Melodic)

Next Post:

Package in ROS1

Leave a Reply Cancel reply

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

Categories

  • STEM 101
  • Robotics
  • Kinematics
  • Dynamics
  • Control
  • Robot Operating System (ROS)
  • Robot Operating System (ROS2)
  • Software Development
  • Mechanics of Materials
  • Finite Element Analysis
  • Fluid Mechanics
  • Thermodynamics

Recent Posts

  • Pull Request on Github
  • Basics of Git and Github
  • Conda vs Docker
  • A Conda Cheat Sheet
  • Installing NVIDIA GPU Driver on Ubuntu

Archives

  • June 2025
  • July 2021
  • June 2021
  • March 2021
  • September 2020
  • April 2020
  • January 2015
  • April 2014
  • March 2014
  • March 2012
  • February 2012
  • June 2011
  • March 2008
© 2026 Abdur Rosyid's Blog | WordPress Theme by Superbthemes