table of Contents
Port Range
View available port range
cat /proc/sys/net/ipv4/ip_local_port_range
32768 60999
Modify the port range available
# 临时修改
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
# 永久修改:在/etc/sysctl.conf中添加如下信息
net.ipv4.ip_local_port_range = 1024 65535
# 然后生效一下
sysctl -p
TIME_WAIT processing
Pressure measurement process, TCP connection active close side will be a lot of TIME_WAIT state, resulting in problems such as inadequate port
may be configured to
refer to
# 同样,在/etc/sysctl.conf中添加如下信息,最后使用sysctl -p生效一下
# 表示开启SYN cookies。当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SYN攻击,默认为0,表示关闭
net.ipv4.tcp_syncookies = 1
# 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;
net.ipv4.tcp_tw_reuse = 1
# 表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭
net.ipv4.tcp_tw_recycle = 1
# 修改系統默认的 TIMEOUT 时间
net.ipv4.tcp_fin_timeout = 30
ulimit configuration
Displays all current resource limits
ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 63445
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 63445
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
The above parameters can be modified directly, but only take effect in the current Session Session and its derivatives, is not recommended
for permanent modifications in /etc/security/limits.conf, the format:
<Domain> <of the type> <Item> <value>
(Description of reference notes section in limits.conf)
after modification to log in again to take effect
* soft core unlimited
* hard core unlimited
Boot from the start
Add the startup command to the /etc/rc.d/rc.local
* soft nproc unlimited
* hard nproc unlimited
* soft nofile 1024000
* hard nofile 1024000
## 当前用户最大登录数
## max number of logins for this user
* soft maxlogins 100
* hard maxlogins 100
## 系统最大登录用户数
## max number of logins on the system
* soft maxsyslogins 100
* hard maxsyslogins 100
Can not allocate memory handling problem
Check the maximum number of processes sysctl kernel.pid_max
view the number of processesps -eLf | wc -l
Confirm the number of processes is full
Temporary modifications:
echo 1000000 > /proc/sys/kernel/pid_max
Permanent:
echo "kernel.pid_max=1000000 " >> /etc/sysctl.conf
sysctl -p