|
Lines 332-337
Link Here
|
| 332 |
connections. |
332 |
connections. |
| 333 |
.Pp |
333 |
.Pp |
| 334 |
The |
334 |
The |
|
|
335 |
.Em net.inet.ip.portrange.first |
| 336 |
and |
| 337 |
.Em net.inet.ip.portrange.last |
| 338 |
tunables default to 1024 and 5000, respectively. These, like many other |
| 339 |
sysctl tunables, are designed to limit the use of kernel resources |
| 340 |
(i.e. port number space) unless there is an explicit requirement for |
| 341 |
more than this reasonable default. These are the port numbers |
| 342 |
allocated to sockets which were created with a |
| 343 |
.Xr socket 2 |
| 344 |
call where |
| 345 |
the port number parameter was zero. This default range of ports (3977 |
| 346 |
in total) is likely to be insufficient for a machine running a number |
| 347 |
of client programs of whatever description. The 'first' tunable can't |
| 348 |
be set below 1024, but may be set higher. |
| 349 |
The 'last' tunable will usually be the one that requires tweaking on |
| 350 |
a machine with numerous clients (that don't make use of the IP_PORTRANGE |
| 351 |
.Xr setsockopt 2 |
| 352 |
option). Assuming you have enough file descriptors and your client |
| 353 |
code uses |
| 354 |
.Xr perror 3 , |
| 355 |
you will see a message like "Can't assign requested address" |
| 356 |
(EADDRNOTAVAIL) or "Resource temporarily unavailable" (EAGAIN) if this is set |
| 357 |
too low for your application. See /usr/src/sys/netinet/in.h for more |
| 358 |
discussion. |
| 359 |
.Pp |
| 360 |
The |
| 335 |
.Em kern.ipc.somaxconn |
361 |
.Em kern.ipc.somaxconn |
| 336 |
sysctl limits the size of the listen queue for accepting new tcp connections. |
362 |
sysctl limits the size of the listen queue for accepting new tcp connections. |
| 337 |
The default value of 128 is typically too low for robust handling of new |
363 |
The default value of 128 is typically too low for robust handling of new |