I have a multicast routing setup with forwarding on the receiving side, as follows (all Linux):
+----------------+ +----------------+ +-------------+
| openvpn-server |tun0 tun0| openvpn-client | forward port 53 | application |
| 10.8.0.1 |============| 10.8.0.2 |-------------------| 172.16.3.3 |
+----------------+ +----------------+ +-------------+
joined 239.1.2.3
multicast group
In this set up, the openvpn-server
side sends UDP packets to the multicast group 239.1.2.3 on port 53. Specifically, the packets are DNS NOTIFY messages, but I don't think this is of relevance here. (There are several instances of openvpn-client
which is why multicast is used.)
openvpn-client
then forwards the traffic to application
. This host acknowledges the receipt of the packet by replying with another UDP packet.
The response packet is sent back to openvpn-client
where Linux translates the source IP back to the destination IP address of the initial packet as it was coming in from openvpn-server (assuming that the original destination will now be the sender of the response), i.e. 239.1.2.3. This is the problem: Due to this source IP, the packet does not get transmitted to the original sender of the first packet, and the sender thinks the packet was not transmitted. This results in several unnecessary retries and a lot of logging.
The question is if it is possible to instruct openvpn-client
to rewrite the source address of the response to 10.8.0.2
instead. More specifically, I would like it to be the address associated with interface tun0
, such that things remain in order in case a VPN reconnect leads to an IP address change.
I suspect this is possible because iptables MASQUERADE does a similar thing (but for connections originating in application
). Further, I believe that if I get this configured, the response packet would be delivered. Is this possible?
I observed that when I ping from 10.8.0.1 to 239.1.2.3, the echo packet originates from 10.8.0.2 (and not from 239.1.2.3). (Note that the ping case does not involve port forwarding.) How can I achieve the same behavior for my UDP case?