Lugdunum eServer - Druckversion
+- Sharing-Devils (http://forum.sharing-devils.to)
+-- Forum: ED2K eMule (http://forum.sharing-devils.to/forumdisplay.php?fid=21)
+--- Forum: ED2K-Server-News (http://forum.sharing-devils.to/forumdisplay.php?fid=22)
+--- Thema: Lugdunum eServer (/showthread.php?tid=33)
Lugdunum eServer - Hooligan - 16.12.2016
Building an efficient edonkey server on linux
I prefer debian.
Download eserver 17.15 and unrar
The eserver needs a configuration file, called donkey.ini, that should be located in the current directory.
The bare minimum donkey.ini file should contains :
name=my server name
desc=the desc of my server
thisIP=126.96.36.199 # The IP of my server
port=4232 # the TCP port (default is 4661, but it is wise to choose another value)
To run the eserver, I highly suggest to use the screen command, because the eserver has a text console, where commands may be entered.
The server cannot run as a service (daemon).
To let it restarts automatically in case of a failure, I also suggest to use a shell script like this one :
# script.sh file
ulimit -n 1000000
When the script.sh file is ready, just do a "chmod +x script.sh" once to make it executable.
Then to start the eserver :
screen -d -m ./script.sh
To take control of it, type :
donkey.ini documentation :
All these params can be changed in the donkey.ini file, and many of them can be changed dynamically, in the eserver console.
Note : boolean values can be false, true, 1, or 0.
LOWIDenable (integer) (should be boolean in next version)
If 1, LOWID users can login. Default value : 1
Maximum percentage of LOWID users. Warning : having too many LOWID logged in a server is a bad idea, since nobody can get sources. I suggest not having more than 33% of LOWID users. Default value : 20
If set, the server can write a server.met file , with only working known servers, every 225 seconds (approx). Default value : none
auxportslist (list of ports values)
New in 16.45
The server can listen to auxiliary tcp ports. This is to help some users to avoid providers filters that block standard wellknown ports (4661,4242). Default value : none
Only updated clients may use aux ports, because we ask them not to spread aux ports values to other clients, because we dont want to receive additionnal UDP trafic.
This list may be modified dynamically.
bindUDPIP (IP address)
When a host has more than one IP, you can force the IP used by the UDP messages. This is usefull if the primary IP address of the machine is not the IP address of the server (thisIP).
The number of seconds of blacktime : If a client IP is blacklisted (because of sending too many requests to the server), it stays in this blacklist for at least this time. Default value : 3600
The number of bytes of the Unit of memory allocation. Dont change this value, as it is the size of a HugeTLB page (4 Mbytes). Default : 4194304.
If true, the eserver logs (to the console and/or logfile) the blacklisted IP and 'double connections'. Default value : false
connIP (IP address)
When a server has more than one IP, you can use a second IP to bind the outgoing sockets, that the server use to check the LOWID/HighID capability of new clients. Using a different IP can defeat some bad clients that give false informations (Hash Stealers)
When the eserver prints a message, it is sent to the console if the console flag is 'true', and/or to the log file is logFile flag is 'true'. Default value : true
This controls the alignment of memory blocks that eserver users to store file descriptions. Trying to use the L1 cache size of the CPU helps the performance. The L1 cache size of PII & PIII is 32 bytes. For Athlons and P4, this is 64 bytes. Default value : system dependant.
The linux kernel has a TCP_DEFER_ACCEPT feature, that delay the accept() of a new TCP stream. The listening application is notified of a new connection only after some data were received on it. The defer_accept parameter is the max delay between the connection establishment and the first data. Default value : 10 seconds.
This is the description of the server. This string is sent to the clients. Default value : eserver
filter (filter expression)
Setup a filter that is applied to files published by clients. Please refer to the dserver documentation for details.
Example of filters :
filter=(#FORMAT dll)|(#FORMAT sys)
Introduced in 16.41, this parameter gives the name of a file. This file is updated when the eserver detects that a client loops on the login process.
When an IP is added to the 'bad list', a line like this one is added :
Wed Oct 8 16:07:06 2003 DENY 172.16.0.156
When the server thinks the client can be accepted again :
Wed Oct 8 16:07:06 2003 ACCEPT 172.16.0.156
You can use this file with a daemon that reads new records from this file, and issue some iptables/ipfw/whatever commands.
Example for iptables on linux :
At init time, (firewall setup) initialize the SYN chain and insert it in the INPUT chain, for SYN TCP packet only
iptables -N SYN
iptables -I INPUT -p tcp --dport 4661 --syn -j SYN
When the eserver or the daemon is restarted, flush the rules in SYN chain:
iptables -F SYN
Then, when a 'DENY' is emitted by eserver, add a rule in the chain :
iptables -I SYN -s the_IP -j DROP
When a 'ACCEPT' is emitted by eserver remove the rule :
iptables -D SYN -s theIP -j DROP
You may want to play with clever iptables module, like RECENT, that are faster when the number of IP is high (hashtable instead of list).
If a client tries to publish more than hardLimit files, the server disconnects him (before receiving the whole list). That is to save bandwidth, because some lazy people share all their files. Default value : 4000
http_trace (boolean) (New in eserver 16.50)
When set to true, eserver logs HTTP requests to "loghttp" file. Default = false
(linux 2.6 only) : The path of a file located in a hugetlbfs file system. This allows eserver to try to allocate 4MB or 2MB Huge Pages instead of standard 4KB pages, to reduce hardware TLB misses. The normal page size on ia32 is 4Kbytes, which is way too small for a programm that has to use a huge amount of memory.
Dont bother with such advanced features for small servers.
Example of use :
Check your linux kernel config, you should have :
Then you can mount a hugetlbfs : (in a startup file, like /etc/rc.d/rc.local)
mount -t hugetlbfs none /huge
echo 100 >/proc/sys/vm/nr_hugepages
Then in donkey.ini add :
Note : On HPUX, Solaris, Windows2003, eserver tries to allocate big pages automatically.
On windows2003, the SE_LOCK_MEMORY priviledge should be granted to the user before starting eserver. If not, the server falls back to allocate normal memory (not 4MB big pages)
Since 16.45, the HugeTlb pages may be used for the heap storage too. (linux 2.6 only) : The path of a file located in a hugetlbfs file system.
jigleIP (IP address)
The IP address of jigle, to avoid blacklisting www.jigle.com. Default value : 188.8.131.52
listenIP (IP address)
The server can listen TCP connections to a specific address, instead of all IP of the host. Default value : Any address (0.0.0.0)
The listen backlog. The eserver has a very high value, suitable for any servers, but you can change it. Default value : 1024
Note : On linux, you may want to check /proc/sys/net/ipv4/tcp_max_syn_backlog and /proc/sys/net/core/somaxconn : global system limits.
If set to true, the server appends its message to the "log" file, located in the current directory. Default value : false
The value in seconds the server waits for the backdoor test to succeed. The backdoor test is a connection made by the server to the 4662 port of the client to check if it is a HighID or LOWID. Default value : 20
The maximum number of clients for this server. Default value : 1024
Limits the number of clients sharing one IP. Default value : 12
This is to forbid some worms/virus/robots opening too many connections and fill the server.
If a client send a frame with more than max_frame_size, the server disconnects it. Default value : 250000
This limits the maximum number of IP that slimit module can manage. Default value : 393216
This is the max size of a string. Some clients sends very long filenames. The server truncates too long strings. Default value = 140
This is the max number of answers given to a Search request (from a connected client) Default value = 200
This is the max number of answers given to a Search request (from a connected zlib aware client) Default value = 300
This is the max number of answers given to a Search request (from a not connected client) Default value = 20
A client software has a version number. Clients having a version greater than maxVersion are not allowed to login. Default value = 2000
New in version 16.44. When the current number of users exceeds the maxnozlib value, only zlib aware clients are alowed to login. Default value = 250000
Limits the maximal number of servers that this server can add in its list. To protect against some Denial Of Service attacks. Default value = 4096
Used with the nickcommunity parameter. No more than 'maxstrangers' users not belonging to the community are allowed to login. Default value = 1000000
Used with the trackemule feature. Gives the minimum Emule version that this server allows. Emule version is a hexadecimal number between 00 and FF. Default value = 0x26
A client software has a version number. Clients having a version lower than minVersion are not allowed to login. Default value = 59
Default value 3. This is the minimum length of a keyword. The server builds indexes on the keywords contained in the filenames, to be able to perform fast searches.
As indexes use a lot of ram, 16.44 server can ignore short words.
A hint for the eserver to place its 4Mo pages in virtual memory space. Default value = 0 (no hint)
On ia32 linux, one can use mmap_hint=0x80000000
razorback uses 0x74000000
Some providers (ISP) are filtering 4662 port. To help users, it may be a good thing to ask them to change the 4662 value for something else.
If msgrandomport is true, the server automatically sends a warning message to users that uses the default port.
The MsgRandomport default value is : WARNING : Please try to use a random port instead of 4662, because a lot of ISP have filters on 4662 port. Any number between 80 and 65530 should be OK. Thanks
The name of your server, as sent to clients. Default = eserver 16.44
nbuserIP (IP address)
The server has a special TCP listener on a port that allows nbuser to gather information. By default, the port is binded on 127.0.0.1 (localhost) so that only a local nbuser can connect to eserver. You may want to allow extern access. Default value = 127.0.0.1
The port of the nbuser listener. See above. Default value = 5656
This value is filled by eserver at startup, and gives the number of cpus of the host. Not really used by the programm. See udpsearchers. Default value = number of cpus of the host.
The tag that should be present in the nickname of users to be able to log in the server. Used with maxstrangers.
Note : You MUST enter a string in lowercase. (The clients can use upper/lower case). Default value : no value (public server)
When performing a backdoor test to the 4662 port of client, the eserver impersonnate a user. This param is the nickname of the faked user. Default value = eserver
(linux only) If set to true, eserver doesnt try to use epoll feature. I strongly advise not doing that, but your linux version may have a bug on this function. Default value = false
For linux-2.4.21 or linux-2.4.22, you can try the patch from Davide Libenzi to add epoll feature.
opIP (IP address)
If the server operator wants to use a ed2k client and connect to his own server, he may have a problem because of a private IP. The opIP parameter asks the server to replace the client'IP by the listenIP/thisIP of the server. That way, when other client want to contact the operator, their incoming connections can be NATed to the operator.
You can deny to handle complex searches sent by remote users (clients of other servers). Complex searches are searches that must scan the whole file list, instead of using a keyword index. Default value = false
The server periodically sends a frame called a 'ping', containing the number of users and files he has, to each of its client. This is to verify each TCP socket is alive (Users may have switch off their computer). ping_delay is the maximal delay between such pings. Default value = 300 (was 400 before 16.49)
This is the TCP port that this server listens on. Default value = 4661
See also auxportslist
If set to true, the server advertizes himself as a public server to other servers. This parameter had a role in the past, but is useless today because clients can automatically add servers to their list, when a client connects to them. Default value = false.
If set to true, the server uses the setsockopt(TCP_QUICKACK) to ask the linux kernel to delay the TCP ACK packets, instead of enter in the quickack mode. This should reduce the bandwitdh. Default value = true.
If set to true, the server dumps to the logsearches file the searches requests handled. Default value = false
seedIP (IP address)
The IP address of another server. This is used by the eserver if no "serverList.met" file is present (or if it's empty), to gather a server list. Default value : none
The port of the seed server. Default value = 4661
The size of the hash table used in slimit module. Each slot uses 4 bytes of memory. Default value : 10007
If a client tries to publish more than softLimit files, the server sends him a WARNING message and ignores files in excess. Default value : 1000
See hardLimit parameter description.
The size of the hash table used to store file descriptions. You should not set it, since eserver dynamically increase it as needed.
The number of worker threads to handle tcp requests (connected clients). See ncpus. May be dynamically changed in eserver console. Default value = number of cpus of the host.
The TCP/IP stack of your machine allocates for each socket a maximum size to store incoming messages. You may want to change this default size.
Default value = 0 (system default)
(on linux check /proc/sys/net/ipv4/tcp_rmem)
The TCP/IP stack of your machine allocates for each socket a maximum size to store outgoing messages. You may want to change this default size.
Default value = 0 (system default)
(on linux check /proc/sys/net/ipv4/tcp_wmem)
thisIP (IP address)
This is the IP of this Server. Note : eserver cannot find it automatically. You MUST set it correctly if your server is public.
Obsolete parameter. The number of threads in eserver is fixed:
One thread receives UDP request.
One or two threads handle UDP searches. (See udpsearchers)
One thread accepts new incoming connections.
One thread handles the login phase of clients.
One thread handles the console dialog. (This is the 'main' thread)
One thread handles all the TCP traffic (requests from connected clients)
One thread handles the 'nbuser' requests.
One thread handles incoming connections to auxports.
A bitmask of flags. See minEVersion parameter. Default value = 30
If set to 1, eserver tracks the emule version. Check also minEVersion parameter. Default value = 1
Two values are possible :
key (default) : The server builds indexes based on keywords found on file names. Searches are fast.
substring : The server doesnt uses indexes. Searches are slower.
The UDP/IP stack of your machine allocates for each socket a maximum size to store incoming messages. You may want to change this default size. Default value = 0 (system default)
The UDP/IP stack of your machine allocates for each socket a maximum size to store outgoing messages. You may want to change this default size. Default value = 0 (system default)
The number of threads dedicated to UDP searches. Default value : 1 on Uniprocessor machine, 2 on SMP machine.
If set to true, the server logs some messages (clients login/lougout for example). Default value = false
warnfakes (integer) (New in 16.50)
Each time a client publishes a file that is present in fakes.txt, the server sends a warning message giving the name of offending file to the user. This parameter controls the max number of such messages. Default 0.
This is a series of messages that each client that logs on to the server will be sent.
New in 16.50 : If ip-to-country.csv file is used, the server checks if a file welcome.xx (where xx = country code of the incoming client) exists. If yes, the content of file is sent instead of the welcome from donkey.ini
level of compression done by this server. An integer between 0 (no compression) and 9 (max compression) . Default value = 9
Allows server to negociate zlib compression with incoming clients. Default : true
Format of fakes.txt fileThis file is a text file, containing one fake description per line. Each line should start with a 32 hexadecimal digits (16 bytes) md4 hash of the file, followed by some comments and a line feed.