LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-18-2017, 03:29 AM   #1
hilou
Member
 
Registered: May 2013
Posts: 93

Rep: Reputation: Disabled
linux failed to assign local port


Hi Guys,

I really need your help. I met a strange issue from nginx error log as below:
Code:
2017/10/18 15:19:48 [crit] 41689#0: *23414459 connect() to 127.0.0.1:1234 failed (99: Cannot assign requested address) while connecting to upstream, client: 10.0.0.1, server: example.com, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:1234/", host: "www.example.com"
So from the error log, nginx is reporting it can not assign a local port when try to connect to upstream 127.0.0.1:1234.

Here is the kernel parameter associated with the local port:
Code:
net.ipv4.ip_local_port_range=2048 65000
net.ipv4.ip_local_reserved_ports=1024-10000
the config means I could use 55000 local ports.

I find that this problem emerges at the time when the local ports for all ips used up, check below:
Code:
Wed Oct 18 15:19:48 CST 2017 <- same time as the nginx log above
55000  <- number of local ports used for all ips
22.10.177.5 52023 <- number of local ports used for public ip
127.0.0.1 4881 <-  number of local ports used for 127.0.0.1
So my question is why nginx thrown that error since only 4881 local ports used for 127.0.0.1?

Other tests tried when whole local ports used up (for all ip):

Code:
:~# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^]
telnet> Connection closed.

:~# telnet 10.0.0.2 1234
Trying 10.0.0.2...
Connected to 10.0.0.2.
Escape character is '^]'.
^]
telnet> Connection closed.

:~# telnet 127.0.0.1 1234
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Cannot assign requested address
telnet failed as well, means it's not an issue of nginx.

system info:
Code:
Linux kernel: 4.9.0-040900-generic
distro: Ubuntu 14.04
Please help. Thanks in advance.
 
  


Reply

Tags
nginx, tcpip



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to assign a name to ip:port on localhost? Ganix Linux - Networking 2 05-04-2015 04:08 PM
Use Linux to Assign local LAN IP to a WAN machine running Windows Find Linux - Networking 1 06-16-2013 04:26 AM
Unable to assign an array in rc.local amirgol Linux - Newbie 4 08-16-2011 09:54 AM
Assign fixed port to nlockmgr rwcooper Slackware 11 06-15-2010 06:33 AM
how to assign local ip in linux k00lit8 Linux - Newbie 7 09-17-2009 05:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration