All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eliezer Croitoru <eliezer@ngtech.co.il>
To: "Jörn Krebs" <jk@smartbyte.de>
Cc: netfilter <netfilter@vger.kernel.org>
Subject: Re: VoIP conntrack issue
Date: Tue, 13 Nov 2012 22:09:39 +0200	[thread overview]
Message-ID: <50A2A903.3050702@ngtech.co.il> (raw)
In-Reply-To: <CABY2qi86ntiYHDzaSeyEwy8vVSy8z8gc+uc8B8EANvya7m6f8w@mail.gmail.com>

Hi Jörn,

You must first understand that you description is kind of vague on what 
the actual network setup is and you are just referring to specific 
things in the whole picture which what leads every reader to another 
conclusion.

I will try to write you the question that I still dont know the answer for:
what is the network path of the packets?(routing)
Where is this NAT happening?
I will give you an example that can clear up what We need to try to help 
you stay focused:
http://wiki.squid-cache.org/ConfigExamples/UbuntuTproxy4Wccp2#Toplogy

The above diagram shows and describes path and network diagram in a way 
that seems to me good.

192.168.1.38 sends packet to?
what external IP this router use? 114.XX.234.123 ?
if the IP of the asterisk server is:  122.XX.115.203 then what nat? to 
what direction? on what machine?
If it's a xen host that hosts the asterisk server I would say it's one 
of the bad choices ever(from my experience) to host VOIP server.
The whole question you are asking looks very weird from the conntrack 
output.

 From netfilter\technial point of view fire-walling is not NAT in any 
way while they both use some common modules.
(I dont know how much you know so I am now on the "syn-ack" part of the 
question from you to make sure we get the connection right and on the 
same src,dst logic)

If you do host any SIP service behind a firewall and\or nat you should 
be explicit on what is allowed to the direction of the SIP server.

I still dont understand how you managed to capture all this conntrack 
(topology+machines) data on the same machine.

If you do have problem with this specific part:
 > # The connection is assured, because Asterisk is basically listening
 > to everything on that port and changes the port it send the data back
 > # But my VoIP Provider is not that intelligent. :-((( See the following
 > [NEW] 192.168.1.38:44608 -> 62.52.147.185:35642  | 62.52.147.185:35642
 > ->114.XX.234.123:1030 [UNREPLIED]
 > [NEW] 62.52.147.185:35642 -> 114.XX.234.123:44608 |
 > 114.XX.234.123:44608 -> 62.52.147.185:35642 [UNREPLIED]
 > [NEW] 62.52.147.185:44609 -> 114.XX.234.123:44609 |
 > 114.XX.234.123:44609 -> 62.52.147.185:35643 [UNREPLIED]
 > [NEW] 192.168.1.38:57890 -> 62.52.147.185:35643 | 62.52.147.185:35643
 > -> 114.XX.234.123:57890 [UNREPLIED]

You should configure the RTP and SIP settings right.
how exactly the VOIP phone "192.168.1.38" contacts the PSTN provider 
"62.52.147.185" and why?(make it clear so I and others can understand 
the situation)
If you do have Asterisk server then this server should contact the 
SIP\PSTN provider and not the SIP phone.

The stun should be and should only be related to the external 
connections from the phone to a server in the internet.
Any other stuff should be static as possible to assure that the service 
will WORK.

You have mentioned:
/sbin/iptables -t nat -A POSTROUTING -j MASQUERADE -s 192.168.0.0/16
before which is not any mechanism of symmetric nat but more of 
snat(source nat).

NAT can never assure you symmetric port to port mapping and especially 
when you are natting more then 1000 hosts.
There is a great possibility that in such a wide NAT size you will have 
problems.
two clients can use somehow the same port in the same time.

My recommendation is that IF you can use even simple routing 
tunnel(IPIP\GRE) to avoid nat just use it.
it's simple to setup and supported on any linux distribution I know of.

(all the above is based on that I didnt understood the network 
infrastructure and is a speculation only until I will know more)

You can always contact me on my personal email to send me data you dont 
want to publish on the public lists.


Best Regards,
Eliezer

On 11/13/2012 1:42 PM, Jörn Krebs wrote:
> Hi Eliezer,
>
> I think your comment is a bit offensive, yes I understand how NAT
> works, and yes I know what STUN does,
> but in this case it is the NAT firewall who does some unneeded Port mapping!
>
> Setup:
> External IP: 114.XX.234.123
> Local Network : 192.168.1.0/24 -> Internal VoIP Phone: 192.168.1.38
> STUN Server: 216.93.246.14
> Asterisk Server: 122.XX.115.203
> VoIP-PSTN Provider: 62.52.147.185
>
> And what I do is:
> Call a number on my Asterisk Server, who then reroutes the call / the
> RTP stream directly to my VoIP Phone.
> (I tried directmedia and directrtpsetup, both do not work, because
> netfilter/conntrack does a port mapping.)
>
> I though you might be able to read this out of my first email, but to
> be honest, it was very hard to read,
> that's why I shortened the conntrack -E log and made it a bit more
> readable, and attach it here:
> ---------------------------------------------------------------------------------------------------------------------------------------
> # Here is the STUN-Part
> [NEW] 192.168.1.38:44608 -> 216.93.246.14:3478 | 216.93.246.14:3478 ->
> 114.XX.234.123:44608
> [NEW] 192.168.1.38:57890 -> 216.93.246.14:3478 | 216.93.246.14:3478 ->
> 114.XX.234.123:57890
> [UPDATE] 192.168.1.38:44608 -> 216.93.246.14:3478 | 216.93.246.14:3478
> -> 114.XX.234.123:44608 [ASSURED]
> [UPDATE] 192.168.1.38:57890 -> 216.93.246.14:3478 | 216.93.246.14:3478
> -> 114.XX.234.123:57890 [ASSURED]
> # STUN ended - Two connections assureds, ports: 44608 and 57890
>
> # Now we try to connect to the VoIP Server source port 44608 and 57890
> ( this might be some ICE related thing, I cannot explain, why my
> client does it, but that's actually not the problem.
> [NEW] 122.XX.115.203:10020 -> 114.XX.234.123 44608 |
> 114.XX.234.123:44608 -> 122.XX.115.203:10020 [UNREPLIED]
> [NEW] 192.168.1.38:57890 -> 122.XX.115.203:10021 |
> 122.XX.115.203:10021 -> 114.XX.234.123:57890 [UNREPLIED]
> # !!!!!!! Look here !!!!!!! That's where it starts! Why do we have a
> port mapping here???
> [NEW] 192.168.1.38:44608 -> 122.XX.115.203:10020 |
> 122.XX.115.203:10020 -> 114.XX.234.123:1030 [UNREPLIED]
> # And from that point on it goes down the drain!
> # Se the port mapping to port 1030!!!???!!!! Why?!
> [UPDATE] 192.168.1.38:44608 -> 122.XX.115.203:10020 |
> 122.XX.115.203:10020 -> 114.XX.234.123:1030
> [UPDATE] 192.168.1.38:44608 -> 122.XX.115.203:10020 |
> 122.XX.115.203:10020 -> 114.XX.234.123:1030 [ASSURED]
> # The connection is assured, because Asterisk is basically listening
> to everything on that port and changes the port it send the data back
> # But my VoIP Provider is not that intelligent. :-((( See the following
> [NEW] 192.168.1.38:44608 -> 62.52.147.185:35642  | 62.52.147.185:35642
> ->114.XX.234.123:1030 [UNREPLIED]
> [NEW] 62.52.147.185:35642 -> 114.XX.234.123:44608 |
> 114.XX.234.123:44608 -> 62.52.147.185:35642 [UNREPLIED]
> [NEW] 62.52.147.185:44609 -> 114.XX.234.123:44609 |
> 114.XX.234.123:44609 -> 62.52.147.185:35643 [UNREPLIED]
> [NEW] 192.168.1.38:57890 -> 62.52.147.185:35643 | 62.52.147.185:35643
> -> 114.XX.234.123:57890 [UNREPLIED]
> -------------------------------------------------------------------------------------------------------------------------------------
> As you can see, half way through ( Underneath my !!!!!!!! comment)
> conntrack/netfilter, linux does a port mapping, and does not use the
> internal port 44608, but mapps the port to port 1030, for whatever
> reason.
> I am pretty sure this port-mapping is unneeded, and it messes up my
> VoIP calls, as the providers are thinking my external port is 44608
> (that's the port the device uses), but linux maps it to port 1030.
> Can anyone technically explain to me why conntrack/netfilter does
> this? Why can't netfilter just do a second mapping (first mapping was
> the one from the STUN connection, line 3)?
>
> This is not a symmetrical NAT!
>
> And please I do my best to explain this, if you need more info or you
> don't understand my explanation, I am willing to give more detailed
> info, or explain it in a different way, but don't be offensive,
> please.
>
> Thanks.


-- 
Eliezer Croitoru
https://www1.ngtech.co.il
IT consulting for Nonprofit organizations
eliezer <at> ngtech.co.il

  parent reply	other threads:[~2012-11-13 20:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-13  2:49 VoIP conntrack issue Jörn Krebs
2012-11-13  3:02 ` Neal Murphy
2012-11-13  3:20   ` Jörn Krebs
2012-11-13  9:32     ` Eliezer Croitoru
2012-11-13 11:42       ` Jörn Krebs
2012-11-13 15:13         ` /dev/rob0
2012-11-13 20:09         ` Eliezer Croitoru [this message]
     [not found]           ` <CABY2qi8w6eDME-OUYM_5Y8Pk63TxBudoHkC54EdzHtuEwQGjZQ@mail.gmail.com>
2012-11-13 22:51             ` Fwd: " Jörn Krebs
2012-11-14  1:09               ` Eliezer Croitoru
     [not found]             ` <CABY2qi_SsfZWzD5=ycNoSVGCCP5YqWro23rJe9THTrLpeEXmww@mail.gmail.com>
     [not found]               ` <50A2EF09.5030002@ngtech.co.il>
2012-11-14  1:31                 ` Jörn Krebs
2012-11-14  1:43                   ` Eliezer Croitoru
2012-11-14  1:47     ` Jan Engelhardt
2012-11-14  2:35       ` Jörn Krebs
2012-11-14 11:23         ` Jan Engelhardt
2012-11-14 15:38           ` Eliezer Croitoru
2012-11-14 15:54             ` Jan Engelhardt
2012-11-14 16:01               ` Eliezer Croitoru
2012-11-14 21:33                 ` Jörn Krebs
  -- strict thread matches above, loose matches on Subject: below --
2012-11-14 22:41 Jörn Krebs
2012-11-14 23:38 ` Jan Engelhardt
2012-11-15  0:15   ` Jörn Krebs
2012-11-15  0:40     ` Payam Chychi
2012-11-15  5:04     ` Jan Engelhardt
2012-11-15  5:28       ` Eliezer Croitoru
2012-11-15  7:43       ` Jörn Krebs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A2A903.3050702@ngtech.co.il \
    --to=eliezer@ngtech.co.il \
    --cc=jk@smartbyte.de \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.