|
Today, when the deployment of a webserver on a server,
I suggested bind port fails,
I habitually use netstat read, not occupied ah!
After the share issue out, to force colleagues searched ip_local_port_range this thing
This corresponds to what is / proc / sys / net / ipv4 / ip_local_port_range file
I found it after the content is open:
1024 65000
Then I checked, these two figures is the provision of a range of ports
And this document sets out the so-called "temporary port," the port range availability
For example, a program through socket request a service outside of the machine,
That requirement is within the socket communication is a double ip plus a port,
When we request only the specified ip and port to be requested, and does not specify the machine,
Then according to the Linux strategy that is automatically assigned a temporary port
And this ephemeral port range is desirable that ip_local_port_range
ip_local_port_range there is a hidden attribute is the port within the ephemeral range can not be bind
This is what I began to encounter the cause of the problem
When I want to edit this file to modify the scope of discovery can not be saved when modified
Then search for a moment, she said to be permanent changes, you can:
vim /etc/sysctl.conf
Modify the net.ipv4.ip_local_port_range
After saving execute sysctl -p allowed to take effect |
|
|
|