Re: more than 65535 outbound connections

2007-03-09 Thread Matti Aarnio
On Fri, Mar 09, 2007 at 04:13:00PM +0530, Niklaus wrote:
> yes now lets take 2 dest machines , source ip is fixed , source port (2^16 
> - 1)
> destip is fixed (a.a.a.a and b.b.b.b) ,dest port(2^16 -1) each ,
> 
> for a connection we have one port used , say connection 1 is
> 
> source ip,port 1 , a.a.a.a port 1
> source ip,port 2 , a.a.a.a port 2
> .
> .
> .
> source ip,port 65535 , a.a.a.a port 65535

You do have some sort of fixation of having same port numbers at both ends.
In some rare applications that is done (e.g. with NTP server-server connections
using UDP), but it is very rare and never done with TCP.

Now if you have 65535 server ports at a.a.a.a, you can have very nearly
4000 million TCP streams in between them.

> so total of 65535 connections (assume traffic is still going on, a
> movie on a slow line dialup or 1kbps )
> 
> now if i try to open another connection (assume lots of file
> descriptors are present) to a.a.a.a what happens
> 
> to b.b.b.b what happens
> 
> i think both will not get established as the OS doesn't have any free
> source ports or am i wrong

  you are wrong.
 
> >David Lang

/Matti Aarnio
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Matti Aarnio
On Fri, Mar 09, 2007 at 01:49:34PM +0530, Niklaus wrote:
> Hi,
> 
> I could be wrong in the below description or might have misunderstood
> many of the concepts , please correct appropriately.
> 
> 65535 ports can allowed . So on a  machine namely C you can have max
> 65535 outbound connections

IP connections are quads (four-tuples), machine A and B IP addresses,
plus 16 bit port numbers at both ends.

You can have about  64 k * 3 G = 192 T  connections out from a machine
to any single port number out there to all existing IP addresses.

If  A.ip, B.ip, and B.port  stay the same, A can setup up to some
10 - 50 thousand parallel connections.  (Depending on allowed dynamic
source IP port number space at machine A.)

If either B.ip or B.port changes, A can reuse a port that is actively
connected to something. Resulting four-tuple is different -> connection
is different.

Does Linux reuse port numbers in this way ?
It most likely does, but I didn't verify.

> What i was thinking was to send to another machines A and B from the
> same port [X] and then when we get data from it to [X] we can the send
> it to the correct application using stateful mapping or storing some
> information . The machines A and B are unaware of this mapping from
> the C  machine.

You want to make a "L4 switch" -- a "load balancer" ?
That thing is a NAT-box, and is really not making buffered TCP flows,
but rather mapping IP/TCP header rewriters to divert the flows to new
destinations.

> Can we increase it by anymeans in the kernel. Does we have patches for the 
> above
> 
> i read on the web that terry lambert has got 1.6 million simultaneous
> connection ? how is the way it is done.
> 
> http://kerneltrap.org/node/277

With 50 thousand connections per single ( A.ip / B.ip / B.port ) set,
one needs only 32  B.ports or A.ip:s or B.ip:s to do that 1.6 million
parallel TCP streams.

Such does eat up lots and lots system kernel memory...

> Regs
> Nik

/Matti Aarnio

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Niklaus

On 3/9/07, David Lang <[EMAIL PROTECTED]> wrote:

On Fri, 9 Mar 2007, Florian Weimer wrote:

>> i read on the web that terry lambert has got 1.6 million simultaneous
>> connection ? how is the way it is done.
>
> Multiple IP addresses, I guess.

what must be unique is the four-parts of a connection
source IP, source port, destination IP, destination port

as long as the set is unique any element can be re-used (a big webserver has one
IP and port on the server side, but many IPs and ports on the client side)

when you make a connection you have the option of not specifying the source IP
and port (letting the OS/library pick ones for you). some libraries will not
re-use the same source port for multiple connections, others will (with the
appropriate options)

if you want to have your program assign the source IPs and port itself you can
do so (you may have to also give the library/os a flag that tells it you know
what you're doing, and it's ok to let you re-use ports)



yes now lets take 2 dest machines , source ip is fixed , source port (2^16 - 1)
destip is fixed (a.a.a.a and b.b.b.b) ,dest port(2^16 -1) each ,

for a connection we have one port used , say connection 1 is

source ip,port 1 , a.a.a.a port 1
source ip,port 2 , a.a.a.a port 2
.
.
.
source ip,port 65535 , a.a.a.a port 65535

so total of 65535 connections (assume traffic is still going on, a
movie on a slow line dialup or 1kbps )

now if i try to open another connection (assume lots of file
descriptors are present) to a.a.a.a what happens

to b.b.b.b what happens

i think both will not get established as the OS doesn't have any free
source ports or am i wrong


David Lang


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread David Lang

On Fri, 9 Mar 2007, Florian Weimer wrote:


i read on the web that terry lambert has got 1.6 million simultaneous
connection ? how is the way it is done.


Multiple IP addresses, I guess.


what must be unique is the four-parts of a connection
source IP, source port, destination IP, destination port

as long as the set is unique any element can be re-used (a big webserver has one 
IP and port on the server side, but many IPs and ports on the client side)


when you make a connection you have the option of not specifying the source IP 
and port (letting the OS/library pick ones for you). some libraries will not 
re-use the same source port for multiple connections, others will (with the 
appropriate options)


if you want to have your program assign the source IPs and port itself you can 
do so (you may have to also give the library/os a flag that tells it you know 
what you're doing, and it's ok to let you re-use ports)


David Lang
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Florian Weimer
> i read on the web that terry lambert has got 1.6 million simultaneous
> connection ? how is the way it is done.

Multiple IP addresses, I guess.

-- 
Florian Weimer<[EMAIL PROTECTED]>
BFK edv-consulting GmbH   http://www.bfk.de/
Kriegsstraße 100  tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


more than 65535 outbound connections

2007-03-09 Thread Niklaus

Hi,


I could be wrong in the below description or might have misunderstood
many of the concepts , please correct appropriately.

65535 ports can allowed . So on a  machine namely C you can have max
65535 outbound connections


What i was thinking was to send to another machines A and B from the
same port [X] and then when we get data from it to [X] we can the send
it to the correct application using stateful mapping or storing some
information . The machines A and B are unaware of this mapping from
the C  machine.

Can we increase it by anymeans in the kernel. Does we have patches for the above

i read on the web that terry lambert has got 1.6 million simultaneous
connection ? how is the way it is done.

http://kerneltrap.org/node/277

Regs
Nik
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


more than 65535 outbound connections

2007-03-09 Thread Niklaus

Hi,


I could be wrong in the below description or might have misunderstood
many of the concepts , please correct appropriately.

65535 ports can allowed . So on a  machine namely C you can have max
65535 outbound connections


What i was thinking was to send to another machines A and B from the
same port [X] and then when we get data from it to [X] we can the send
it to the correct application using stateful mapping or storing some
information . The machines A and B are unaware of this mapping from
the C  machine.

Can we increase it by anymeans in the kernel. Does we have patches for the above

i read on the web that terry lambert has got 1.6 million simultaneous
connection ? how is the way it is done.

http://kerneltrap.org/node/277

Regs
Nik
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Florian Weimer
 i read on the web that terry lambert has got 1.6 million simultaneous
 connection ? how is the way it is done.

Multiple IP addresses, I guess.

-- 
Florian Weimer[EMAIL PROTECTED]
BFK edv-consulting GmbH   http://www.bfk.de/
Kriegsstraße 100  tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread David Lang

On Fri, 9 Mar 2007, Florian Weimer wrote:


i read on the web that terry lambert has got 1.6 million simultaneous
connection ? how is the way it is done.


Multiple IP addresses, I guess.


what must be unique is the four-parts of a connection
source IP, source port, destination IP, destination port

as long as the set is unique any element can be re-used (a big webserver has one 
IP and port on the server side, but many IPs and ports on the client side)


when you make a connection you have the option of not specifying the source IP 
and port (letting the OS/library pick ones for you). some libraries will not 
re-use the same source port for multiple connections, others will (with the 
appropriate options)


if you want to have your program assign the source IPs and port itself you can 
do so (you may have to also give the library/os a flag that tells it you know 
what you're doing, and it's ok to let you re-use ports)


David Lang
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Niklaus

On 3/9/07, David Lang [EMAIL PROTECTED] wrote:

On Fri, 9 Mar 2007, Florian Weimer wrote:

 i read on the web that terry lambert has got 1.6 million simultaneous
 connection ? how is the way it is done.

 Multiple IP addresses, I guess.

what must be unique is the four-parts of a connection
source IP, source port, destination IP, destination port

as long as the set is unique any element can be re-used (a big webserver has one
IP and port on the server side, but many IPs and ports on the client side)

when you make a connection you have the option of not specifying the source IP
and port (letting the OS/library pick ones for you). some libraries will not
re-use the same source port for multiple connections, others will (with the
appropriate options)

if you want to have your program assign the source IPs and port itself you can
do so (you may have to also give the library/os a flag that tells it you know
what you're doing, and it's ok to let you re-use ports)



yes now lets take 2 dest machines , source ip is fixed , source port (2^16 - 1)
destip is fixed (a.a.a.a and b.b.b.b) ,dest port(2^16 -1) each ,

for a connection we have one port used , say connection 1 is

source ip,port 1 , a.a.a.a port 1
source ip,port 2 , a.a.a.a port 2
.
.
.
source ip,port 65535 , a.a.a.a port 65535

so total of 65535 connections (assume traffic is still going on, a
movie on a slow line dialup or 1kbps )

now if i try to open another connection (assume lots of file
descriptors are present) to a.a.a.a what happens

to b.b.b.b what happens

i think both will not get established as the OS doesn't have any free
source ports or am i wrong


David Lang


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Matti Aarnio
On Fri, Mar 09, 2007 at 01:49:34PM +0530, Niklaus wrote:
 Hi,
 
 I could be wrong in the below description or might have misunderstood
 many of the concepts , please correct appropriately.
 
 65535 ports can allowed . So on a  machine namely C you can have max
 65535 outbound connections

IP connections are quads (four-tuples), machine A and B IP addresses,
plus 16 bit port numbers at both ends.

You can have about  64 k * 3 G = 192 T  connections out from a machine
to any single port number out there to all existing IP addresses.

If  A.ip, B.ip, and B.port  stay the same, A can setup up to some
10 - 50 thousand parallel connections.  (Depending on allowed dynamic
source IP port number space at machine A.)

If either B.ip or B.port changes, A can reuse a port that is actively
connected to something. Resulting four-tuple is different - connection
is different.

Does Linux reuse port numbers in this way ?
It most likely does, but I didn't verify.

 What i was thinking was to send to another machines A and B from the
 same port [X] and then when we get data from it to [X] we can the send
 it to the correct application using stateful mapping or storing some
 information . The machines A and B are unaware of this mapping from
 the C  machine.

You want to make a L4 switch -- a load balancer ?
That thing is a NAT-box, and is really not making buffered TCP flows,
but rather mapping IP/TCP header rewriters to divert the flows to new
destinations.

 Can we increase it by anymeans in the kernel. Does we have patches for the 
 above
 
 i read on the web that terry lambert has got 1.6 million simultaneous
 connection ? how is the way it is done.
 
 http://kerneltrap.org/node/277

With 50 thousand connections per single ( A.ip / B.ip / B.port ) set,
one needs only 32  B.ports or A.ip:s or B.ip:s to do that 1.6 million
parallel TCP streams.

Such does eat up lots and lots system kernel memory...

 Regs
 Nik

/Matti Aarnio

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: more than 65535 outbound connections

2007-03-09 Thread Matti Aarnio
On Fri, Mar 09, 2007 at 04:13:00PM +0530, Niklaus wrote:
 yes now lets take 2 dest machines , source ip is fixed , source port (2^16 
 - 1)
 destip is fixed (a.a.a.a and b.b.b.b) ,dest port(2^16 -1) each ,
 
 for a connection we have one port used , say connection 1 is
 
 source ip,port 1 , a.a.a.a port 1
 source ip,port 2 , a.a.a.a port 2
 .
 .
 .
 source ip,port 65535 , a.a.a.a port 65535

You do have some sort of fixation of having same port numbers at both ends.
In some rare applications that is done (e.g. with NTP server-server connections
using UDP), but it is very rare and never done with TCP.

Now if you have 65535 server ports at a.a.a.a, you can have very nearly
4000 million TCP streams in between them.

 so total of 65535 connections (assume traffic is still going on, a
 movie on a slow line dialup or 1kbps )
 
 now if i try to open another connection (assume lots of file
 descriptors are present) to a.a.a.a what happens
 
 to b.b.b.b what happens
 
 i think both will not get established as the OS doesn't have any free
 source ports or am i wrong

  you are wrong.
 
 David Lang

/Matti Aarnio
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/