ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question


asked 2016-11-18 17:15:58 -0500

otamachan gravatar image


In my understanding according to the wiki, ROS_IP is for the IP address of the host machine where a ROS node runs and ROS_HOSTNAME is for a resolvable host name. But I'm confused because an IP address is also a resolvable name(maybe resolved name?). So even when I set an IP address to ROS_HOSTNAME, everything works well.

I saw the source codes and found that both are treated almost same(rocpp, rospy).

So my questions are

  1. Why are there two environmental variablesROS_IP and ROS_HOSTNAME, even though both are treated almost same?
  2. Is it better to always use ROS_HOSTNAME to avoid network troubles? I've seen some people have troubles because they set both variables and ROS_IP doesn't work as they expected.

Thanks in advance.

edit retag flag offensive close merge delete


As a general comment, whenever I've had ROS networking issues exporting ROS_HOSTNAME=$ROS_IP fixes them.

spmaniato gravatar image spmaniato  ( 2016-11-19 18:09:24 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-08 19:09:22 -0500

130s gravatar image

updated 2017-12-08 20:52:03 -0500

Not an answer, but IMO this is a worthwhile thing to discuss as a possible improvement in ros_comm, so I opened a ticket.

The example section in the NetworkSetup wiki explains when having both variables are useful, but the usecases there don't sound convincing enough to me that we have to have 2 different variables.

If there are actually usecases where separate variables are needed, I/we'd appreciate if you share the story in the linked ticket.

edit flag offensive delete link more

Question Tools



Asked: 2016-11-18 17:15:58 -0500

Seen: 3,184 times

Last updated: Dec 08 '17