{"id":537,"date":"2012-07-10T10:13:15","date_gmt":"2012-07-10T02:13:15","guid":{"rendered":"http:\/\/rmohan.com\/?p=537"},"modified":"2012-07-10T10:13:15","modified_gmt":"2012-07-10T02:13:15","slug":"increase-port-range-available-for-applications","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=537","title":{"rendered":"Increase port range available for applications"},"content":{"rendered":"<p><strong>Increase port range available for applications<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>By default an average Linux distribution allows applications to use the following TCP port range for outgoing connections: 32,786-65,536. That\u2019s why your system can handle up to 28,232 TCP sessions at time. Notice, this is more than enough if your Linux system is installed on the laptop or desktop and you just use it for occasional visits to facebook.com, gmail.com and linuxscrew.com (yeah!). But if you run proxy\/webcache like squid or some other services which open a lot of outgoing TCP connections you will likely hit ceiling of 28,232 soon.<\/p>\n<p>First of all, let\u2019s see current port range available for TCP sessions:<\/p>\n<p><code>cat \/proc\/sys\/net\/ipv4\/ip_local_port_range<\/code><\/p>\n<p>Most likely the output will show something like this one \u201c32786 65536?. In order to expand this range you can either echo modified range into above file in \/proc filesystem (temporary solution) or add corresponding line into \/etc\/sysctl.conf (constant solution).<\/p>\n<p>To temporarily expand port range from 28,232 to 40,000 do the following:<\/p>\n<p><code>sudo -s<br \/>\necho \"25000 65000\" &gt; \/proc\/sys\/net\/ipv4\/ip_local_port_range<\/code><\/p>\n<p>To make sure new port range will be applied after reboot add the following line to \/etc\/sysctl.conf:<\/p>\n<p><code>net.ipv4.ip_local_port_range=\"25000 65000\"<\/code><\/p>\n<p>or just execute this:<\/p>\n<p><code>sudo sysctl -n net.ipv4.ip_local_port_range=\"25000 65000\"<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Increase port range available for applications<\/p>\n<p>&nbsp;<\/p>\n<p>By default an average Linux distribution allows applications to use the following TCP port range for outgoing connections: 32,786-65,536. That\u2019s why your system can handle up to 28,232 TCP sessions at time. Notice, this is more than enough if your Linux system is installed on the laptop or [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/537"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=537"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/537\/revisions"}],"predecessor-version":[{"id":539,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/537\/revisions\/539"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}