Продолжем! Donkey Control (см. выше) в
своей директории создаёт файл donkey.ini
и вот в нём то и кроется вся настройка, разумеется продвинутые могут этот
файл создать сами (ниже будет идти пояснение). Программа nserver2 от
Lugdunum запускается в командной строке, игнорируйте первую ошибку "ERROR:
unknown type...", нажимаем "?" и запомиеаем команды, вот и всё,
замечательно, что более 20% LowID на вашем сервере не будет! Дальше
редактируем этот преславутый файл
donkey.ini
корректно, по всем правилам без пробелов и в каждой строке, мона в простом
блакноте :) . Пояснения на аглийском (думаю это не праблема)! Ну и не
только для WIN для линуха тоже. Рзумеется мона ничего не редактировать!
ЭТО ТЮНИНГ для сервера, из слабенькой машины выдать по максимуму!!!
donkey.ini
documentation :
You can list all
the available parameters and their current values by issuing this eserver
command :
print
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
LOWIDpercent
(integer)
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
autoservlist (pathname)
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.
Example
auxportslist=80,443,25,21
blacktime
(integer)
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
blocsize (integer)
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.
bverbose (boolean)
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)
console
(boolean)
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
dcache_line (integer)
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.
defer_accept (integer)
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.
desc (string)
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[0]=(.part.met)
filter[1]=(.part.stats)
filter[2]=(#FORMAT met)
filter[3]=(#FORMAT part)
filter[4]=(#FORMAT dll)|(#FORMAT sys)
fwcommand (pathname)
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).
hardLimit (integer)
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
See
softLimit parameter description.
http_trace
(boolean) (New in eserver 16.50)
When set to true, eserver logs HTTP requests to "loghttp" file.
Default = false
hugefile (string)
(linux 2.5/2.6 only) : The
path of a file located in a hugetlbfs file system. This allows eserver to
try to allocate 4Mo Huge 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 :
CONFIG_HUGETLB_PAGE=y
CONFIG_HUGETLBFS=y
Then you can mount a hugetlbfs : (in a startup
file, like /etc/rc.d/rc.local)
mkdir /huge
mount -t hugetlbfs none
/huge
echo 100 >/proc/sys/vm/nr_hugepages
Then in donkey.ini add :
hugefile=/huge/eserver
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 4Mo big pages)
hugefile2 (string)
Since 16.45, the HugeTlb
pages may be used for the heap storage too. (linux 2.5/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 : 62.2.249.5
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)
listen_backlog
(integer)
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 : global system limit.
logFile
(boolean)
If set to true, the server
appends its message to the "log" file, located in the current directory.
Default value : false
login_timeout (integer)
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
maxClients (integer)
The maximum number of clients for
this server. Default value : 1024
max_clients_per_ip (integer)
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.
max_frame_size
(integer)
If a client send a frame
with more than max_frame_size, the server disconnects it. Default value :
250000
max_slimit_nb_cell (integer)
This limits the maximum
number of IP that slimit module can manage. Default value : 393216
max_string_size (integer)
This is the max size of a string.
Some clients sends very long filenames. The server truncates too long
strings. Default value = 140
maxSearchCount
(integer)
This is the max number of
answers given to a Search request (from a connected client) Default value
= 200
maxSearchCountz (integer)
This is the max number of answers
given to a Search request (from a connected zlib aware client) Default
value = 300
maxUDPSearchCount (integer)
This is the max number of answers
given to a Search request (from a not connected client) Default value = 20
maxVersion
(integer)
A client software has a
version number. Clients having a version greater than maxVersion are not
allowed to login. Default value = 2000
maxnozlib (integer)
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
maxservers
(integer)
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
maxstrangers
(integer)
Used with the
nickcommunity parameter. No more than 'maxstrangers'
users not belonging to the community are allowed to login. Default value =
1000000
minEVersion
(integer)
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
minVersion (integer)
A client software has a version
number. Clients having a version lower than minVersion are not allowed to
login. Default value = 59
minkeylength
(integer)
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.
mmap_hint
(integer)
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
msgrandomport
(boolean)
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
name
(string)
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
nbuserport
(integer)
The port of the nbuser
listener. See above. Default value = 5656
ncpus (integer)
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.
nickcommunity
(string)
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)
nickname (string)
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
noepoll
(boolean)
(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.
noudpslowsearches (boolean)
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
ping_delay
(integer)
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)
port
(integer)
This is the TCP port that
this server listens on. Default value = 4661
See also
auxportslist
public (boolean)
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.
quickack (boolean)
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.
search_trace (boolean)
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
seedPort
(integer)
The port of the seed
server. Default value = 4661
slimit_tableSize (integer)
The size of the hash table used in slimit module. Each slot uses 4 bytes of memory. Default value : 10007
softLimit
(integer)
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.
tableSize
(integer)
The size of the hash table
used to store file descriptions. You should not set it, since eserver
dynamically increase it as needed.
tcpthreads (integer)
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.
tcp_rbuffersize (integer)
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)
tcp_xbuffersize (integer)
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.
threads (integer)
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.
trackbademule
(integer)
A bitmask of flags. See
minEVersion parameter. Default value = 30
trackemule
(integer)
If set to 1, eserver
tracks the emule version. Check also minEVersion parameter. Default value
= 1
type
(string)
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.
udp_rbuffersize (integer)
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)
udp_xbuffersize (integer)
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)
udpsearchers
(integer)
The number of threads
dedicated to UDP searches. Default value : 1 on Uniprocessor machine, 2 on SMP machine.
verbose (boolean)
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.
welcome[#] (string)
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
zlib_complevel (integer)
level of compression done by this
server. An integer between 0 (no compression) and 9 (max compression) .
Default value = 9
zlib_enable
(boolean)
Allows server to negociate
zlib compression with incoming clients. Default : true
Format of fakes.txt
file
This 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.
See also
warnfakes parameter.
Linux Kernel tuning :
For big servers, dont forget to
increase /proc/sys/fs/file-max. (default value 8192).
You can add (or
modify if already present) this line to /etc/sysctl.conf :
fs.file-max=16384
You can also do :
echo 16384 > /proc/sys/fs/file-max (but value is lost
after a reboot)
On linux 2.2 machines, dont forget to change
/proc/sys/net/ipv4/route/max_size, because a too low value can explain
some problems.
echo 32768 >
/proc/sys/net/ipv4/route/max_size
You may also change the linux 2.2 VM settings :
echo "1024
2048 4096" > /proc/sys/vm/freepages
Linux 2.2 has a limit on the poll() system call : Because it uses the kmalloc(nbhandles*8) kernel service, it has a limit of 16384 file handles.
So a eserver running on a linux 2.2 machine can not have more than 16300
users.
Last advice : we suggest to launch the program with a
script script.sh: It uses ulimit -n 8192 to change the maximum
number of files a process can open. If you plan a 10000 users server,
change this to 16384 !
For users wanting to run eserver as an
ordinary user (not root), you may change /etc/security/limits.conf and add
this lines :
*
soft nofile 32768
* hard nofile 32768
Notes about other OS:
Tru64 Unix 5.1 : limit of 65536
file descriptor per process : A server can not handle more than 64k users.
HPUX 11 : maxfiles (see sysdef command) limit is 60000 : No more
than 60.000 users.
FreeBSD : check the limits with sysctl command.
# sysctl kern.maxfiles
kern.maxfiles: 5000
# sysctl
kern.maxfiles=65000
kern.maxfiles: 5000 -> 65000
# sysctl
kern.maxfilesperproc
kern.maxfilesperproc: 4200
# sysctl
kern.maxfilesperproc=65000
kern.maxfilesperproc: 4200 -> 65000
^victorie^