aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: numbers of connections !! (for network specialists)  (Read 2735 times)

ulysse

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 4
numbers of connections !! (for network specialists)
« on: December 08, 2004, 03:23:30 PM »

Hello,
I have a problem with aMule on my mandrake 10.0 linux box.

I have limited the total number of connexion in the amule config (up to 300). Despite of that, the total number of established connections explode :
cat /proc/net/ip_conntrack  |wc -l
7168
Within 2 days, the conntrack is full, completely full, and no more connection is possible (whatever is the port)

So I looked at the conntrack, and I saw that some IP had about ten connexions, and even one hundred down to my machine:
cat /proc/net/ip_conntrack | grep -e '^.* ESTABLISHED src=[0-9.]\+ .*$' | wc -l
6676

I do not understand why. Here is my config:
receipt: 32 ko/s
transmit: 8 ko/s
slots allocation : 20 ko/s (strange parameter for me, is it up to 20 ko/s by connxion or by distant IP?)
Max of sources: 617
limits of connection : 300
Core Tweaks::maxi new connections by 5s: 20. Must I reduce it?
Core Tweaks::size of the upload queue: 500 clients (reduced to mini)

When I look at the conntrack, I can produce the following table
X machines have up to Y connections established onto my machine.

      X        Y
     35       8
     18       9
     29      10
     20      11
      7      12
      7      13
      3      14
      9      15
      4      16
      2      17
      5      18
      3      20
      2      21
      3      23
      1      24
      1      25
      1      26
      1      27
      2      31
      1      34
      1      35
      1      38
      1      40
      1      45
      1      49
      2      51
      1      52
      1      54
      1      61
      1     104

It means that one IP has 104 connections with my linux box, and 6 IP have
more than 50 connections established with me.

I would like to know how this is possible.
« Last Edit: December 08, 2004, 03:53:31 PM by ulysse »
Logged

hannibal218bc

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Re: numbers of connections !! (for network specialists)
« Reply #1 on: December 08, 2004, 04:26:09 PM »

Hellas,


did you check that those connections really are from/to amule? On my box, I currently have 396 lines in conntrack, but not all of them are amule-related.


A rough estimate can be calculated as follows (assuming 4662 is your amule tcp port number):

cat /proc/net/ip_conntrack | grep "sport=4662" | wc -l
# Connections from amule port, here: 141

cat /proc/net/ip_conntrack | grep "dport=4662" | wc -l
# Connections to amule port, here: 139

cat /proc/net/ip_conntrack | grep "dport=4662" | grep "sport=4662" | wc -l  
# Connections with both ports set to 4662, here: 140

Now add the first two numbers, and substract the third - 140 Connections.


You could also try netstat -anp | grep amule | grep tcp | wc -l , which gives here a count of 56 . The remaining 84 seem to be in state "TIME_WAIT", which means that they are half-closed. The kernel needs to track them until they cleanly shut down (or expire), but apparently amule does not count them as active connections, since they are already closing.


Best regards,
-hannes


[edit: moved comments on separate lines]
« Last Edit: December 08, 2004, 04:27:07 PM by hannibal218bc »
Logged

ulysse

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 4
Re: numbers of connections !! (for network specialists)
« Reply #2 on: December 08, 2004, 04:51:50 PM »

Well,

I do not see why the third number substracted from the sum of the first and second ones are pertinent, but here it is :

assuming 4000 is my amule port :

$ cat /proc/net/ip_conntrack | grep sport=4000 |wc -l
6501
$ cat /proc/net/ip_conntrack | grep dport=4000 |wc -l
6506
$ cat /proc/net/ip_conntrack | grep dport=4000 |grep sport=4000 |wc -l
6494


But :
$ netstat -anp | grep amule | grep tcp | wc -l
56
and :
$ cat /proc/net/ip_conntrack | grep dport=4000 |grep ESTABLISHED |wc -l
6382

What's wrong ?
Logged

hannibal218bc

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
Re: numbers of connections !! (for network specialists)
« Reply #3 on: December 08, 2004, 05:32:47 PM »

Hey,


first to the counts: you count those with dport = amule and those with sport=amule , so if a connection matched both rules you counted it twice. Therefore we count connections which apparently matched both rules, and substract them from the subtotal to get the exact count.

A possible explanation would be that the grep expressions also match connections from/to port 40001, 40002, ...., 40009 , but I guess these ports are rather uncommon for services. You could put quotes around the grep expressions (as I did) and add a space before the closing quote, to prevent matching those ports.

If that doesn't help, I for now got no more ideas :-/


Greetings,
-hannes
Logged