求:Error:eaddrinuse 解决方法

 

大家好请教一个问题

服务器环境:ubuntu10.4+ejabberd2.14

客户端:tsung-1.3.3            "/proc/sys/net/ipv4/ip_local_port_range" 的值已经是 32768   61000现象描述:    

 

 我在用tsung做压力测试时,发现服务器的用户在线数停留在<=28320数值上就不在上升了,查看了一下日志发现Error:eaddrinuse 提示。

我期望用户同时在线数能继续上升。

 

我在网上查了一下,查到echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout方法,设置过 但有起作用。

 

 

解决方法修改 p_local_port_range 参考下面信息,

echo "1024 61000" >/proc/sys/net/ipv4/ip_local_port_range

来自http://www.faqs.org/docs/securing/chap6sec70.html

 

 

6.7. The ip_local_port_range parameters

The /proc/sys/net/ipv4/ip_local_port_range defines the local port range that is used by TCP and UDP traffic to choose the local port. You will see in the parameters of this file two numbers: The first number is the first local port allowed for TCP and UDP traffic on the server, the second is the last local port number. For high-usage systems you may change its default parameters to 32768-61000 -first-last.

The default setup for the ip_local_port_range parameters under Red Hat Linux is: "1024 4999"

Version 6.1 only

To change the values of ip_local_port_range, type the following command on your terminal:

            [root@deep] /# echo "32768 61000" >/proc/sys/net/ipv4/ip_local_port_range
            

Add the above commands to the /etc/rc.d/rc.local script file and you'll not have to type it again the next time you reboot your system.

 

 

Version 6.2 only

Edit the /etc/sysctl.conf file and add the following line:

            # Allowed local port range
            net.ipv4.ip_local_port_range = 32768 61000
            

You must restart your network for the change to take effect. The command to manually restart the network is the following:

            [root@deep] /# /etc/rc.d/init.d/network restart
            

Setting network parameters [ OK ] Bringing up interface lo [ OK ] Bringing up interface eth0 [ OK ] Bringing up interface eth1 [ OK ]  

 

非 port_range引起可参考(

 

解决EADDRINUSE方法之一:修改操作系统设置

 

 

你可能感兴趣的:(.net,linux,UP)