I applied this solution for selecting specific networks interfaces for ros2 to use, but when specified, it still seems to end up using other interfaces.
Setup
I have two devices. Network settings device A are as follows:
bart@bart-P5820T:~$ ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 131.180.28.166 netmask 255.255.252.0 broadcast 131.180.31.255
inet6 fe80::f881:a604:f3b0:b324 prefixlen 64 scopeid 0x20<link>
ether 74:86:e2:1a:21:1b txqueuelen 1000 (Ethernet)
RX packets 31179297 bytes 14758626983 (14.7 GB)
RX errors 0 dropped 2027 overruns 0 frame 0
TX packets 3011538 bytes 872962723 (872.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0x92200000-92220000
enp5s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 28:87:ba:d9:5b:1e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 5246377 bytes 2907198674 (2.9 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5246377 bytes 2907198674 (2.9 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlx3460f9925488: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.8 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::4444:efb:d9b5:637f prefixlen 64 scopeid 0x20<link>
ether 34:60:f9:92:54:88 txqueuelen 1000 (Ethernet)
RX packets 152104 bytes 64119040 (64.1 MB)
RX errors 0 dropped 133830 overruns 0 frame 0
TX packets 171853 bytes 94039339 (94.0 MB)
TX errors 0 dropped 3 overruns 0 carrier 0 collisions 0
I made ros2networkinterfaces.xml according to this suggestion and specified the (wlan) interface that I intend to use for ros communication. Contents of this file on device A:
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<transport_descriptors>
<transport_descriptor>
<transport_id>CustomUDPTransport</transport_id>
<type>UDPv4</type>
<interfaceWhiteList>
<address>wlx3460f9925488</address>
</interfaceWhiteList>
</transport_descriptor>
</transport_descriptors>
<participant profile_name="CustomUDPTransportParticipant">
<rtps>
<userTransports>
<transport_id>CustomUDPTransport</transport_id>
</userTransports>
</rtps>
</participant>
</profiles>
I made .bashrc export the fastrtps default profile parameter. Fresh terminals yield:
bart@bart-P5820T:~$ echo $FASTRTPS_DEFAULT_PROFILES_FILE
/home/bart/ros2networkwhitelist.xml
On all devices, RMW implementation is set to fastrtps
echo $RMW_IMPLEMENTATION
rmw_fastrtps_cpp
Device A and B are both ubuntu with ros2 foxy and they can ping eachother.
All devices have their firewall disabled:
sudo ufw status
[sudo] password for user:
Status: inactive
The problem:
Using "ros2 multicast receive" and "ros2 multicast send" on both devices show that they can see eachother, albeit through the unwanted interface (eno1 ethernet instead of specified wlx3460f9925488 wireless). Behaviour is similar when sending either directions.
ros2 multicast receive
Waiting for UDP multicast datagram...
Received from 131.180.28.166:46296: 'Hello World!'
I would expect ros to now only use the specified interface (through 192.168.xx.xx) to look for other ros nodes/entities, but its not. Any tips, or suggested steps to further investigate this are welcome.