Hello everyone.
I faced today what I see as a quite similar issue… and I found a kind of workaround.
I am going to describe my scenario, the issue i faced and the workaround.
I have a multilan and multiwan installation with 2.1-RELEASE.
A lan and a wan are dedicated to VoIP (SIP) traffic. For those not familiar with SIP, it's just traffic on udp/5060 (in this case).
I had a working installation, then I made changes and I decided to reconfigure the firewall rules from scratch.
The SIP server is in the VoIPLAN with an ip address IPPBX.
For outgoing traffic i created a firewall rule on the VoIPLAN interface to send all the udp traffic originated by the IPPBX ip address through the VoIPWAN gateway/connection (VoIPWAN is the dedicated wan with a bunch of public IPs on it and a router that interconnects with the voip provider).
Then i created a Port forwarding rule to allow incoming traffic from VOIPPROVIDER ip address to be natted towards IPPBX (considering port udp/5060). Firewall rule was automatically created.
IPPBX sends periodically an udp packet to VOIPPROVIDER ip and receive an analogue udp packet in reply (sip ping), all on the udp/5060.
That was working fine.
Incoming traffic originated from VOIPPROVIDER towards VoIPWAN ip was unfortunately not forwarded.
Actually i tried to craft some udp packet from another public IP and sent them to VoIPWAN ip: that traffic was forwarded so i started to think that was something related to the originating IP.
Then i figured it out then in this case there were two NAT session conflicting: one dynamic (created by my IPPBX with the periodic sip ping) and one static (created by the port forwarding rule)… in this case, the dynamic one was the first being created. Previously that was the second one: infact, in the first setup of the system, the sip ping was not active but i activated when the firewall was already configured.
So I took these steps in sequence:
stopped the sip ping
cleared all nat entries, in states page, related to IPPBX ip and udp/5060
edited and resaved PF rule and reloaded rules
reactivated the sip ping
Now all seems working… I will confirm tomorrow when i will be in office ;)
If someone wants to investigate this issue, i looked at the states' entries in the not-working and in the working situation and they were slightly different.
Not working:
VOIPPROVIDER:5060 <- IPPBX:5060
IPPBX:5060 -> VoIPWAN: <randomport>-> VOIPPROVIDER:5060</randomport>
Working:
VOIPPROVIDER:5060 -> IPPBX:5060
IPPBX:5060 <- VoIPWAN:5060 <- VOIPPROVIDER:5060
I suppose the "single arrow" mapping is the dynamic one. Maybe since it was already present, it forced the static NAT to use a random port and that made mismatch the portforwarding rule? (this is probably like throwing dice ;D ).
Bye,
SB