如何架设一台eD2k服务器,Lugdunum的使用与设置

发布于:
分类: 服务器技术

Before starting a public server, there are a few important points to consider:

Bandwidth Requirements – The amount of TCP traffic generated can be largely controlled by the number of clients you allow to connect at once. The amount of UDP traffic however can be extremely large, and is less easily managed.

Lasting Traffic – Should you decide to take your server down at some point, the traffic will not stop immediately. It will slowly decrease over time. As such, creating a public server is a long term commitment

System Requirements – The hardware requirements vary greatly depending on how many users are connected.

Legislation – According to the laws that existing in some countries, it can be legally contestable to put online eServer without filtering the indexation of copyrighted or illicit files. A eServer works just like Google does but it seem that you can be exposed to legal attacks by running it.

The last version of the eserver is 17.15 and the linux binaries are available through the edonkey network. it’s a closed source but free software.

 

How to download it :

Use a client software to download the server binary. You can use the following link to get a 32bits linux version running under 2.6 kernel. (Search the donkey to find the 64bits version)

MD4 hash and URI of x86 version : 4AB8DD96842359D91125B85D7EBDB953

How to install it :

Exctract the gzipped binary in a directory of your choice, then

$ gzip -d lugdunum-eserver-17.15-i686-linux.nptl.gz
$ chmod 755 lugdunum-eserver-17.15-i686-linux.nptl
$ ln -s lugdunum-eserver-17.15-i686-linux.nptl eserver

$ wget -O ipfilter.srv ipfilter.srv
$ wget -N ip-to-country.csv.zip
$ unzip ip-to-country.csv.zip

 

Clients IP Filter :

Please keep in mind that if you use ipfilter.dat, you should take care of frequent updates of this file.
$ wget -N ipfilter.zip
$ unzip ipfilter.zip

The eserver needs a configuration file, called donkey.ini, that should be located in the current directory. This configuration file is compatible with the original dserver, take a look at the MetaMachine page

The bare minimum donkey.ini file should contains :
[server]
name=my server name
desc=the desc of my server
thisIP=81.12.34.56 # 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, you can 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, use a shell script like this one :
# script.sh file
ulimit -n 1000000
while :
do
./eserver
sleep 1
done

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 :
screen -r

When the server starts up it looks for a donkey.ini file in its directory. If it doesn’t find this file then it carries on with the default settings. The donkey.ini file is just a text file that sets various configuration options of the eDonkey2000 server.

基础设置

下载与你的系统和CPU对应的Lugdunum,然后解压到任意文件夹中,再去下载ip-to-country.csv与ipfilter.dat,把他们放在Lugdunum存放的位置,这时就可以编写Lugdunum的配置文件——donkey.ini。

这是核心部分:eD2k服务器的每一个变量都被写在这个文件里。eserver开始运行时会读这个文件。
警告:服务器软件没法接受语法错误(书写时的错误),服务器不能明白某个命令它就不会工作,或者它会忽略写得不对的命令(以及后面的任何东西);大小写也是非常重要的;所有单独条目均不能有注释。

[server]
这个命令启动控制进程。它必须被写在方括号里。在最后的那个方括号后面没有空格,这一点非常重要。否则的话这将使服务器无法理解 ——也许它没法工作了。接下来的条目只是例子而已!

name=LUCK
服务器的名字,就象你在客户端看见的那个。你可以用任何你想用的的文字数字组合。

desc=社区 http://www.ied2k.com/
服务器描述信息,跟“name=”格式是一样的。可以用任何文字。

thisIP=61.152.93.254
请注意大小写!(IP“61.152.93.254 ”只是个例子而已)。这将告诉服务器你自己的,公开的公网IP。程序开始时,服务器会把它工作的IP发送到其他的服务器。请注意程序开始时所显示的IP,它是你当前真正的,公开的IP,用户会通过你提供的这个IP连接到你的服务器。

port=4242
在这里你要指定可以跟服务器建立联系的端口。一般情况下这个端口是TCP:4661,如果你想用4661,那么这个条目可以空着。如果由于某些技术原因该端口不可用的话,你可以用其他的端口。当然如果是这样的话你就得给出这个条目了——如果可能的话,尽量不使用4661,因为某些无良ISP封锁了4661与4662。端口缺省是TCP:4661

seedIP=212.63.206.35
注意大小写!(IP地址“212.63.206.35”只是个例子而已)
这一项,就象名字示意的那样,是指服务器从哪里连接到网络其他部分,它代表一个正在运行的ED2K服务器,��样你的服务器才能够找到它 ——它是你的服务器首先建立连上的那个服务器。 首先,你的服务器发送自身的IP地址和端口号——然后他就会获得种子服务器所知道的所有的IP地址。

seedPort=4242
注意大小写!(端口“4242”只是个例子而已)
如果“种子服务器(Seed-Server)”的端口号不同于缺省的TCP:4661,就必须有这个条目。许多服务器使用4661端口“seedPort”的缺省设置是4661。

logFile=true/false
注意大小写!
你可以把日志写到硬盘里,而不是把它们显示出来——这也就是说把显示输出关闭掉——这样的话服务器不会在屏幕上显示任何输出! “true”表示“激活该功能”,“false”表示“关闭该功能”。如果你不想显示输出而想用日志文件的话的话——写true,否则写false——请不要写both(两者都要),否则你的服务器会发癫的,或者将引起你的电脑爆炸!! “logFile”的缺省设置是“false”——关闭……

verbose=true/false
如果你想看所有的系统显示的注意信息,你应该把“verbose”激活(把它设成“true”)——一般来讲如果所有的东西你都看看的话是很烦人的,因为“普通的”信息显示得太快了。不要感到惊讶:即使是“verbose=false”,服务器仍然会打出“ERROR: unknown type MetaTag::MakeTag() 72”或者类似的信息 ——别管它,服务器会工作的。为什么会显示这个信息呢?我不知道!总之别理它就行了…… “Verbose”缺省是设成false——关闭……

public=true/false
这个条目决定了你的服务器是否把自己的IP发送到其他服务器去。把这个条目设置为“true”对网络来讲是非常重要的,因为一般你要运行的都是公开服务器,只有设置为“public=true”你的服务器才能够登陆到网络上去!
注意:“public”缺省是设成“false”的,把它更改为true.

threads=10 (integer)
这个条目定义能够同时处理的任务的数目,目前Lugdunum中此值为10且不可更改。

tableSize=3089 (integer)
注意大小写!
这里的table就是包含了文件名和客户的数据库。这一定是一个素数。其技术背景(快速搜索次序)就不深入探讨了。这个值的大小看起来并没有什么太大区别。在默认的ini文件里这个值是“3089”——这实际就是一个素数。设为其他素数也没有任何影响。如果不去设定,服务器会自动生成一个素数取代。

maxClients=100000
注意大小写!
这里是多少客户可以同时连接到服务器的数目。如果“maxClient(最大客户数目)”——达到了峰值时,客户端在尝试连接到该服务器的的时候会出现“Can´t connect to…(无法连接到……)”这样的信息。
你必须试试才能知道你的服务器的最佳值,Lugdunum支持运行中更改可容纳客户端数目,更改后也无需重新启动程序。

type=key/substring (key 或者 substring)
注意大小写!
“type”缺省被设置成“key”,也就是快速模式;“substring”是老式方法,速度慢。

console=true/false
这个值决定服务器是否工作在控制台(命令行提示符)状态下。当服务器自动开始运行并且你不想使用“屏幕”命令的时候,这样做还是有用的。
如果“console=true”的话,你就必须在控制台下运行服务器,如果“console=false”则不必非要如此,但这时就不能用键盘给出任何命令了,并且不能显示任何东西。嗯,其实这两样都不是必需的,但是我喜欢时不时察看一下它在干什么并加以控制,以及看看它知道多少可用的服务器(敲“vs”)。 “console”缺省是设置成“true”

minVersion=57
注意大小写!
这定义低于v.57的版本不能连接到服务器。当有客户端软件的更新版本出现时,改改这个值是有用的,但请注意当时的形势,比如说,由于一个安全方面的bug,新版本v.61没法支持ed2k-links,因此没有很多用户升级到它,还有linux的版本可能比windows版本老很多……
如果没有设置“minVersion”值的话,所有版本的客户端都会被服务器接受。

maxVersion=9999
注意大小写!
这定义了服务器可接受的最大版本号。测试版的客户端程序往往有一个很高的值(比如1060)——因此这个值应该留为空白,否则的话你得常常更新这个值并且很容易忘记——正在测试新客户端的用户就被请出去了……:-( 设为9999就保险了。
如果“maxVersion”没有被设置的话,任何高于“minVersion”的版本均会被接受。

welcome[0]=Welcome to TheDonkeyNetwork

welcome[1]=share your Files and your upload Bandwith

这是欢迎信息,在登陆到服务器时被显示出来。设定时你要注意,[]里面的数字是变化的,每行的不一样。欢迎信息不应该太长,否则的话它们将需要许多带宽——每个字母1字节!当出现1000客户时,平均每分钟会有5-50个连接……

[server]
name=LUCK
desc=http://www.ied2k.com/
thisIP=61.152.93.254
port=4242
seedIP=212.63.206.35
seedPort=4242
verbose=false
public=true
threads=10
type=key
tableSize=3089
maxClients=100000
minVersion=57
maxVersion=9999
logFile=false
welcome[0]=欢迎登录LUCK
welcome[1]=***************************
welcome[2]=建立华语世界最大的P2P资料库

其它扩展选项设置

LOWIDenable (integer)
如果为 1, LOWID 用户可以登录。缺省值为 1

LOWIDpercent (integer)
最大的 LOWID 用户比率。建议不要超过33%,缺省值为20

autoservlist (pathname)
如果设置了,服务器会每225秒将已知的其他服务器列表写入server。缺省值为none

auxportslist (list of ports values)
辅助监听端口列表,16.45版的新特性
例子:auxportslist=80,443,25,21

blacktime (integer)
黑名单时限。即将客户端ip列入黑名单保留的时限.缺省值为3600

bverbose (boolean)
如果为真,eserver会记录下黑名单ip。缺省值为false

connIP (IP address)
当服务器有多ip时,指定辅助监听的ip。和ftpd的virtual host不同,这里还有防止Hash Stealers的功能

filter[ ] (filter expression)
滤镜,防止共享某些不合法或不完整文件,有需要的话我会另外一个帖子介绍一下详细用法
例子:

filter[0]=(.part.met)
filter[1]=(.part.stats)
filter[2]=(#FORMAT met)
filter[3]=(#FORMAT part)
filter[4]=(#FORMAT dll)|(#FORMAT sys)

hardLimit (integer)
共享文件数目硬性限制,为避免某些用户共享过度的文件数浪费带宽而设置,拥有超过此数目共享文件的用户将被踢出服务器,默认值为4000

login_timeout (integer)
登陆时限,在时限内检验客户端获取 HighID 或 LowID。默认值为20

max_clients_per_ip (integer)
限制同一IP连出的客户端数量,默认值为12。
可以防止某些蠕虫/病毒/机器人发起太多连接以填满服务器的资源,但是容易使国内一些宽带的用户进入黑名单。

maxSearchCount (integer)
从以连接客户中搜索返回结果最大数,默认值为200

maxUDPSearchCount (integer)
从非连接客户中搜索返回结果最大数,默认值为20

maxservers (integer)
服务器被加入服务器list的最大值,避免拒绝服务攻击。缺省值为4096

maxstrangers (integer)
最大陌生用户的数目,缺省为1000000

minEVersion (integer)
可登入服务器的Emule的最小版本,缺省值为0x26
注:EMULE的版本数字为16进制,范围从00到FF

minkeylength (integer)
搜索时关键字的最小长度,缺省为3

nbuserIP (IP address)
如果使用了nbuser来监听,在这里设置监听机器的ip,缺省为127.0.0.1

nbuserport (integer)
nbuser监听的端口,默认为5656

ncpus (integer)
设定主机可用的CPU的数目。

nickcommunity (string)
非陌生客户认证的标志,也就是登录服务器需要的TAG,比如POPGO服务器需要的EDTOON,缺省值为空

noudpslowsearches (boolean)
拒绝复杂搜索,即拒绝关键字搜索,缺省值为false

ping_delay (integer)
ping延迟时间,服务器会在一定的间隔获取用户总数和每一个用户共享的文件,这个过程叫做ping。缺省值为400

softLimit (integer)
共享文件数目软性限制,为避免某些用户共享过度的文件数浪费带宽而设置,用户超过此数目的共享文件将被服务器忽略,默认值为1000

tcpthreads (integer)
用于接受客户端请求的TCP请求的线程数目,默认值为当前主机的可用CPU数目

trackbademule (integer)
拒绝虚假版本EMULE的登入,要与minEVersion配合使用,默认值为30

trackemule (integer)
此项如果被激活(设为1),服务器程序将跟踪EMULE的版本,默认值为1

udpsearchers (integer)
为UDP搜索动作准备的线程数目,在单CPU机器上请设为1,多CPU机器上请设为2

warnfakes (integer)
恶意文件提示,当用户持有或正在下载fakes.txt中已知的虚假或恶意文件时,服务器发给该用户的警告信息的数目,默认值为0(不发送)
附:fakes.txt的格式
纯文本格式,每行只写入一个虚假或恶意文件,以该文件的32位MD4 HASH值开头,后面是对于该文件情况的描述。

服务器命令

vc
查看当前服务器中用户登录情况

vs
查看种子服务器的运行情况

vo
查看当前服务器的一些选项的值,比如IP,端口,软硬限制等

name=valve
更改选项的值,比如键入 maxClients=30000 就是将最大客户端数目设为30000

print name
显示该选项的当前值,比如建入 print maxClients,服务器就会显示 maxClients=30000

g | stats
显示服务器当前的用户情况,搜索状况,端口信息,连接情况。

wel
显示服务器的欢迎信息

filters
设置服务器中的文件名过滤

slab
显示当前的内存使用情况

debug
显示服务器的调试信息

reload
重新载入配置文件

m message
向客户端广播信息,message指代广播内容。
在Linux下的一些特别提醒

对于大型服务器,修改/etc/sysctl.conf中的fs.file-max将其值改为 16384
官网推荐使用脚本启动服务器,脚本内容如下:

# script.sh file
ulimit -n 100000
while :
do
./eserver
sleep 1
done

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注