I want to dynamically create DNAT rules for
RTP streams (port-mapping for a SIP proxy).
If my proxy adds his rule before the first packet
of the RTP stream hits the port, all is well. But,
if the stream begins arriving before my rule is in
place, it never matches. I cannot always be
sure that the info for setting up the rule
arrives sufficiently ahead of the stream.
I suspect if there is a simple resolution to my
problem. Does anyone else see this behavior,
and will share with me the solution?
I am using kernel 18.104.22.168, and iptables 1.3.3.
My rules are similar to this:
iptables -I PREROUTING -t nat -p UDP \
-d<public_ip> --dport <public_port> \
-j DNAT --to-destination <private_ip
iptables -I FORWARD -p UDP \
-d <private_ip> --dport <private_port>