My immediate goal is to ping from a device on my LAN to a Ubuntu 22.04 on WSL2.
Context
I am learning to use ROS2. It allows communication between instances on different machines through FastDDS. Once it is setup it should be fairly convenient. Since I don't know how to set it up in my environment I asked FastDDS: demo_nodes_cpp between WSL2 and Raspberry Pi. To summarize: FastDDS did not work by default, so I started researching how to make it work. The conversation linked above lead to me circumventing the default way of discovering other ROS2 instances and instead configuring a discovery server. This works, but now I want to find a solution without using a WireGuard VPN. I believe this to be possible with the correct settings. I hope that this might also be a way to find out how to route multicast packages.
Status Quo
I have a RasPi running Ubuntu 22.04 connected via WiFi on the subnet 192.168.178.0/24 with IP address 192.168.178.21.
My Windows 10 PC has the IP 192.168.178.51.
The WSL2 exposes its adapter with the address 172.27.112.1 on subnet 172.27.112.0/20. The Ubuntu 22.04 running on WSL2 has the address 172.127.124.243.
At 192.168.178.1 runs my fritz.box router.
I have configured it to route 172.27.112.0/20 through gateway 192.168.178.51.
Pinging from 192.168.178.21 to 172.27.112.1 works:
[192.168.178.21]$ ping 172.27.112.1
PING 172.27.112.1 (172.27.112.1) 56(84) bytes of data.
From 192.168.178.1 icmp_seq=1 Redirect Host(New nexthop: 192.168.178.51)
64 bytes from 172.27.112.1: icmp_seq=1 ttl=127 time=5.46 ms
...
However, pinging from 192.168.178.21 to 172.27.124.243 does not work:
[192.168.178.21]$ ping 172.27.124.243
PING 172.27.124.243 (172.27.124.243) 56(84) bytes of data.
From 192.168.178.1 icmp_seq=1 Redirect Host(New nexthop: 192.168.178.51)
^C
--- 172.27.124.243 ping statistics ---
5 packets transmitted, 0 received, +1 errors, 100% packet loss, time 4063ms
This confuses me, since traceroute from 192.168.178.21 to 172.27.124.243 works:
[192.168.178.21]$ traceroute 172.27.124.243
traceroute to 172.27.124.243 (172.27.124.243), 30 hops max, 60 byte packets
1 DESKTOP-XXXXXXX.fritz.box (192.168.178.51) 1.925 ms * *
2 172.27.124.243 (172.27.124.243) 3.348 ms 2.353 ms 3.321 ms
Even more so since I can ping from 192.168.178.51 to 172.27.124.243:
[192.168.178.51]$ ping 172.27.124.243
Pinging 172.27.124.243 with 32 bytes of data:
Reply from 172.27.124.243: bytes=32 time<1ms TTL=64
...
Also, the ping in the other direction from 172.27.124.243 to 192.168.178.21 works:
[172.27.124.243]$ ping 192.168.178.21
PING 192.168.178.21 (192.168.178.21) 56(84) bytes of data.
64 bytes from 192.168.178.21: icmp_seq=1 ttl=63 time=98.6 ms
64 bytes from 192.168.178.21: icmp_seq=2 ttl=63 time=2.19 ms
I have read that traceroute does not ECHO responses on superuser but but this still leaves me clueless.
Edit: Firewall on 172.27.124.243:
[172.27.124.243]$ sudo iptables -L
[sudo] password for user:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT icmp -- anywhere anywhere icmp echo-request
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
On Windows, I have configured the firewall to allow all incoming ICMPv4 packages.
Although this should not impact ping on other machines.
I have also set Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter to 1.
Questions
Why does traceroute 'work' but ping not?
How can I fix this?
What do I need to change in my configuration to make discovery (FastDDS) work with multicast on my network?