`
langzhe
  • 浏览: 290478 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

求: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方法之一:修改操作系统设置

 

 

分享到:
评论
2 楼 langzhe 2010-11-17  
chuqingq 写道
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout   是修改FIN_WAIT状态超时的时长,应该对同时在线用户数没有影响;
28320大约就是61000-32768,可能是端口被用尽了导致无法创建新用户;我的默认配置是
linux2:~ # cat /proc/sys/net/ipv4/ip_local_port_range
1024 65000 


谢谢了,问题已解决,确实是ip_local_port_rang的问题 的配置默认是 32768 61000
1 楼 chuqingq 2010-11-17  
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout   是修改FIN_WAIT状态超时的时长,应该对同时在线用户数没有影响;
28320大约就是61000-32768,可能是端口被用尽了导致无法创建新用户;我的默认配置是
linux2:~ # cat /proc/sys/net/ipv4/ip_local_port_range
1024 65000 

相关推荐

    vxworks Error Codes

    - EADDRINUSE (0x30):地址已被使用。 - EADDRNOTAVAIL (0x31):地址不可用。 - ENETUNREACH (0x34):网络不可达。 - ECONNABORTED (0x35):连接被主动终止。 - ECONNRESET (0x36):连接被对端重置。 - ETIMEDOUT ...

    解决linux系统中运行node进程却无法杀死进程的问题

    Error: listen EADDRINUSE at errnoException (net.js:901:11) at Server._listen2 (net.js:1039:14) at listen (net.js:1061:10) at Server.listen (net.js:1127:5) at EventEmitter.listen (/root/webServer/node_...

    Linux下Socket编程的端口问题 ( Bind(): Address already in use ) PDF版

    当尝试绑定一个已经被其他进程使用的端口时,`bind()`函数会返回一个错误码“EADDRINUSE”,即地址已经被使用。这种情况常常出现在以下几种情况: 1. **进程未完全终止**:虽然通过`Ctrl + C`强制结束了进程,但该...

    Linux 套接字编程中的 5 个隐患

    **解决方法:** 始终检查函数的返回值,确保它们符合预期。对于可能出现多种返回值的情况,还需要根据不同的返回值采取适当的措施。例如,在`send()`函数中,不仅需要检查是否返回-1(表示发送失败),还要检查...

    Linux_套接字编程中的_5_个隐患.pdf

    ### Linux套接字编程中的五个隐患 #### 隐患1:忽略返回状态 在Linux套接字编程中,忽略函数的返回状态是最常见的...通过以上方法,可以有效地避免在套接字编程过程中遇到的一些常见隐患,提高程序的稳定性和可靠性。

    Webserver:节点网络服务器

    解决这个问题的方法包括检查并修改配置文件,确保使用未被占用的端口,或者在启动服务器前先终止正在使用该端口的进程。 另一个常见错误是“ENOENT”,这通常意味着“没有找到文件或目录”。在Webserver中,这可能...

    Node.js检测端口(port)是否被占用的简单示例

    如果所有尝试的端口都被占用,程序将无休止地递归下去,这并不是一个理想的解决方案。在实际应用中,你可能需要设置一个最大尝试次数,或在找不到空闲端口时抛出错误。 总结来说,这个简单的Node.js示例展示了如何...

Global site tag (gtag.js) - Google Analytics