ROS2 Foxy Zerotier VPN problems update

I’m having some issue with my robot ecosystem and the remote connection.
The ecosystem is composed by:

A rover where is running ROS 2 foxy connected to a router

The router where is enabled a connection to a Zerotier VPN net

A ROS 2 foxy remote host connected to the same VPN net of the router

Based on these info, the rover is not directly connected to the VPN, the router will bridge remote connection from host connected to the same VPN net of the router.

In this VPN net the router and the remote host have, for ex, an ip class like this 10.10.10.x, instead the rover in the router net has an ip class like this 192.168.1.X

For ROS 1 the thing was easy having the ROS_MASTER on the rover.

The thing on ROS 2 is not working, even if i set the ROS_DOMAIN_ID to the same number on both, rover and remote host, i can’t list nodes, echo topics created on the rover and other stuff to manage it.
Of course I can ping and ssh connect to the rover from the remote host without problems

To ssh i use

ssh rover@192.168.1.X

If from the host i run a simple publisher

ros2 run my_py_package publisher_class_py_node

and on the rover if i run

tcpdump -i ztzlgp434l -n udp

where ztzlgp434l is the rover net interface for the zerotier, i can clearly see the packet arriving and it stops when i kill the node on the host

I also tried to export

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp export

FASTRTPS_DEFAULT_PROFILES_FILE=$HOME/custom_profile.xml

with a custom profile like this

<?xml version="1.0" encoding="UTF-8" ?> udpv4_transport UDPv4
    <participant profile_name="vpn_profile" is_default_profile="true">
        <rtps>
            <userTransports>
                <transport_id>udpv4_transport</transport_id>
            </userTransports>
            <useBuiltinTransports>false</useBuiltinTransports>
            <defaultUnicastLocatorList>
                <!-- Specify the VPN IP of the local machine -->
                <locator>
                    <kind>UDPv4</kind>
                    <address>ROBOT_IP</address> <!-- For the robot machine -->
                    <port>7400</port> <!-- Default discovery port -->
                </locator>
            </defaultUnicastLocatorList>
            <builtin>
                <initialPeersList>
                    <!-- Specify the VPN IP of the other machine -->
                    <locator>
                        <kind>UDPv4</kind>
                        <address>HOST_IP</address> <!-- For the host machine -->
                        <port>7400</port> <!-- Default discovery port -->
                    </locator>
                </initialPeersList>
                <metatrafficUnicastLocatorList>
                    <!-- Specify the VPN IP of the local machine -->
                    <locator>
                        <kind>UDPv4</kind>
                        <address>ROBOT_IP</address> <!-- For the robot machine -->
                        <port>7400</port> <!-- Default discovery port -->
                    </locator>
                </metatrafficUnicastLocatorList>
            </builtin>
        </rtps>
    </participant>
</profiles>

but it gives me parse errors.

What I’m sure about is that the rover receives the packet through UDP, but there’s something wrong to recognize them.

Do you have any advise/suggestion to make it work?

I’m not doing anything special on the rover, I just launch a couple of ROS 2 packages for PCL and lidar managing, nothing more

Thanks for your question. However we ask that you please ask questions on Robotics Stack Exchange following our support guidelines.

ROS Discourse is for news and general interest discussions. Robotics Stack Exchange provides a Q&A site which can be filtered by tags to make sure the relevant people can find and/or answer the question, and not overload everyone with hundreds of posts.

Thank you for the advice, I already did it. Sorry for my post here, hoping that someone can help me

Yeah that’s pretty common for fastdds’s simple discovery, I’ve never really managed to get it working reliably beyond localhost. If your platform has enough oomph to use cyclone, then that’s probably the best bet, otherwise you can try emulating a ROS 1 setup using a fastdds discovery server, which conceptually acts like a roscore. It also reduces multicast traffic since there’s no need for nodes to discover each other anymore which is a big plus for this sort of tunneling with limited bandwidth.