Cannot assign requested address解决办法

本文涉及的产品
性能测试 PTS,5000VUM额度
注册配置 MSE Nacos/ZooKeeper,118元/月
可观测可视化 Grafana 版,10个用户账号 1个月
简介: Cannot assign requested address解决办法

“Cannot assign requested address.”是由于linux分配的客户端连接端口用尽,无法建立socket连接所致,虽然socket正常关闭,但是端口不是立即释放,而是处于TIME_WAIT状态,默认等待60s后才释放。

可能解决方法1--调低time_wait状态端口等待时间:

  • 调低端口释放后的等待时间,默认为60s,修改为15~30s

    sysctl -w net.ipv4.tcp_fin_timeout=30

  • 修改tcp/ip协议配置, 通过配置/proc/sys/net/ipv4/tcp_tw_resue, 默认为0,修改为1,释放TIME_WAIT端口给新连接使用

    sysctl -w net.ipv4.tcp_timestamps=1

  • 修改tcp/ip协议配置,快速回收socket资源,默认为0,修改为1

    sysctl -w net.ipv4.tcp_tw_recycle=1

可能解决办法2--增加可用端口:

# sysctl -a |grep port_range
net.ipv4.ip_local_port_range = 50000    65000      -----意味着50000~65000端口可用

修改参数:

# vi /etc/sysctl.conf
net.ipv4.ip_local_port_range = 10000     65000      -----意味着10000~65000端口可用

改完后,执行命令“sysctl -p”使参数生效,不需要reboot。

相关文章
|
6月前
|
JavaScript
Property “selectedItemIndex“ was accessed during render but is not defined on instance. 报错解决
Property “selectedItemIndex“ was accessed during render but is not defined on instance. 报错解决
612 0
|
3月前
|
Java Spring
成功解决Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings
这篇文章提供了解决Spring Initializr网站初始化失败问题的方法,包括检查URL、网络和代理设置。
成功解决Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings
|
6月前
|
JavaScript 前端开发
has been blocked by CORS policy: The ‘Access-Control-Allow-Origin‘ header contains multiple values ‘
has been blocked by CORS policy: The ‘Access-Control-Allow-Origin‘ header contains multiple values ‘
139 0
|
6月前
|
缓存 网络安全 开发工具
Git服务器报错:host key for (ip地址) has changed and you have requested strict checking
Git服务器报错:host key for (ip地址) has changed and you have requested strict checking
527 0
|
缓存 关系型数据库 MySQL
【异常解决】缓存报错:Null key returned for cache operation (maybe you are using named params on classes withou
【异常解决】缓存报错:Null key returned for cache operation (maybe you are using named params on classes withou
630 0
|
6月前
|
Java Spring
Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings.
Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings.
956 0
|
API Windows
Qt-解决异常报错“QAxBase::setControl: requested control XXX could not be instantiated”
Qt-解决异常报错“QAxBase::setControl: requested control XXX could not be instantiated”
290 0
|
Java Spring
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
3472 1
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
|
Web App开发 JavaScript 安全
Please open the about:config page and disable the "security.fileuri.strict_origin_policy" option
Please open the about:config page and disable the "security.fileuri.strict_origin_policy" option
216 0
Please open the about:config page and disable the "security.fileuri.strict_origin_policy" option
|
Java Android开发
is not allowed for source level below 1.7 的解决办法
is not allowed for source level below 1.7 的解决办法
184 0