Linux内核参数(非常详细)零基础入门到精通,收藏这一篇就够了

606 篇文章 35 订阅
183 篇文章 2 订阅

内核参数主要保存在两个位置:**‌/proc/sys和/etc/sysctl.conf。**‌

  • /proc/sys 是一个虚拟文件系统,‌提供了访问内核参数的方法。‌该目录下的 net 中存放了当前系统中已开启的所有网络内核参数,‌可以在系统运行时进行修改,‌**但重启实例后就会失效,‌一般用于临时性验证修改的效果。**‌

  • /etc/sysctl.conf 是一个配置文件,‌通过修改这个文件可以修改内核参数的默认值,‌**实例重启后不会失效。‌这个文件用于设置内核参数的永久配置。**‌

通过修改 /proc/sys 目录下的文件,‌可以在系统运行时临时修改内核参数,‌而通过修改 /etc/sysctl.conf 文件,‌则可以永久地更改内核参数的默认设置。‌这两种方法都提供了灵活的方式来调整内核参数,‌以满足不同的系统需求

sysctl命令常用参数

sysctl命令能时动态地修改内核参数;
sysctl命令常用参数:

RAID性能参数调优

dev.raid.speed_limit_min = 1000` `#RAID最小读取速率``dev.raid.speed_limit_max = 200000` `#RAID最大读取速率,如果RAID性能较高,可以修改此上限来提升IO性能``dev.scsi.logging_level = 0` `#是否开启scsi磁盘的日志功能,一般情况不建议开启

网络协议栈调整:单位是字节

net.core.optmem_max = 20480` `#每个套接字所允许的最大缓冲区的大小``net.core.rmem_default = 212992` `#网络协议栈默认接收内存``net.core.rmem_max = 212992` `#网络协议栈最大接收内存``net.core.wmem_default = 212992` `#网络协议栈默认发送内存``net.core.wmem_max = 212992` `#网络协议栈最大发送内存``net.ipv4.tcp_moderate_rcvbuf = 1` `#是否开启TCP缓冲内存自动调整功能``net.ipv4.tcp_mem = 45918 61225 91836` `#TCP协议栈缓冲区的最小值、压力值、最大值;高于最大值,TCP拒绝分配socket``net.ipv4.tcp_rmem = 4096 87380 6291456` `#TCP套接字接收缓冲区的最小值、压力值、最大值;高于最大值,TCP拒绝分配socket``net.ipv4.tcp_wmem = 4096 16384 4194304` `#TCP套接字发送缓冲区的最小值、压力值、最大值;高于最大值,TCP拒绝分配socket

TCP并发性能优化

net.core.somaxconn = 1280` `#定义了系统中每一个端口最大的监听队列长度,这是个全局的参数``net.ipv4.tcp_max_syn_backlog = 1280` `#SYN队列的长度,增大其值可以增大服务器接收并发的能力``net.ipv4.tcp_max_tw_buckets = 8192` `#针对TIME-WAIT数量配置其上限``net.ipv4.tcp_syn_retries = 6` `#server主动连接client时发送syn的重试次数``net.ipv4.tcp_synack_retries = 5` `#server应答client的synack的重试次数``net.ipv4.tcp_fin_timeout = 30` `#server端主动发起断开连接后保持在FIN-WAIT-2状态的时间``net.ipv4.tcp_max_orphans = 8192` `#允许保留的僵尸套接字的最大值``net.core.netdev_max_backlog = 2000` `#网卡设备将请求放入队列的长度``net.core.netdev_tstamp_prequeue = 1` `#网络设备预置队列序号``net.ipv4.tcp_tw_recycle = 0` `#是否需要快速回收TIME-WAIT套接字,不建议快速回收,但可以reuse,否则NAT环境会有问题``net.ipv4.tcp_tw_reuse = 1` `#是否允许将处于TIME-WAIT状态的socket(TIME-WAIT的端口)用于新的TCP连接``net.ipv4.tcp_window_scaling = 1` `#要支持超过64KB的TCP窗口,必须启用该值,TCP连接双方都启用时才生效``net.ipv4.tcp_syncookies = 1` `#是否打开SYN Cookie功能,该功能可以防止部分SYN×××``net.ipv4.tcp_timestamps = 1` `#是否启用TCP时间戳(会在TCP包头增加12个字节),增加了报文大小,但实现了更好的TCP性能

对于用不上IPV6的建议直接禁用

net.ipv6.conf.default.disable_ipv6 = 1` `#默认是否在lo接口上禁用IPv6 (XenServer虚机禁用无效)``net.ipv6.conf.all.disable_ipv6 = 1` `#是否在所有接口上禁用IPv6 (XenServer虚机禁用无效)``net.ipv6.conf.lo.disable_ipv6 = 1` `#是否在lo接口上禁用IPv6 (XenServer虚机禁用无效)

系统端口设定

net.ipv4.ip_local_port_range = 10000 65535` `#服务器端可用端口范围(建议值 1024 65535)``net.ipv4.ip_local_reserved_ports =` `#系统预留端口列表:可以防止并发时占用服务端口` `TCP丢包重传机制控制,TCP拥塞控制算法对TCP传输速率的影响比较大``net.ipv4.tcp_available_congestion_control = cubic reno` `#内核中可用的TCP拥塞控制算法``net.ipv4.tcp_congestion_control = cubic` `#当前正在使用的TCP拥塞控制算法``net.ipv4.tcp_allowed_congestion_control = cubic reno` `#IPV4 TCP允许的拥塞控制算法

TCP keepalive时长控制

net.ipv4.tcp_keepalive_intvl = 30` `#探测消息未获得响应时,重发该消息的间隔时间(秒)``net.ipv4.tcp_keepalive_probes = 3` `#在认定TCP连接失效之前,最多发送多少个keepalive探测消息``net.ipv4.tcp_keepalive_time = 1800` `#TCP发送keepalive探测消息的间隔时间(秒),用于确认TCP连接是否有效

memory

vm.overcommit_memory = 0` `#控制是否允许超额申请内存``vm.overcommit_ratio = 50` `#只有当vm.overcommit_memory=2时此值才会生效``vm.page-cluster = 3` `#控制内核一次从SWAP中连续读取2的多少次幂内存页``vm.panic_on_oom = 0` `#控制内核在OOM时是否panic(恐慌)``vm.stat_interval = 1` `#VM统计信息更新的时间间隔,默认值1s``vm.swappiness = 0` `#控制物理内存剩余%多少时使用SWAP(建议值0,但0并非禁用SWAP,只是充分利用物理内存)``vm.min_free_kbytes = 45056` `#系统内核保留内存的最低值``vm.user_reserve_kbytes = 60942` `#始终会预留给用户空间的内存,此处预留60M``vm.admin_reserve_kbytes = 8192` `#始终会预留给管理员的内存,此处预留8M

OOM控制

vm.oom_dump_tasks = 1` `#OOM信息打印``vm.oom_kill_allocating_task = 0` `#控制是否杀死触发OOM的进程(建议值0 OOM发生时内核自动kill内存占用最多的进程)

安全防护模块

net.ipv4.conf.default.log_martians = 0` `#默认是否开启并记录欺骗,源路由和重定向数据包(如果是路由器建议值为1)``net.ipv4.conf.all.log_martians = 0` `#是否开启并记录欺骗,源路由和重定向数据包:记录带有不允许的地址的数据报到内核日志中(如果是路由器建议值为1)``net.ipv4.conf.default.accept_redirects = 1` `#默认是否接收重写过的数据包``net.ipv4.conf.all.accept_redirects = 1` `#是否接收重写过的数据包:用作路由器时默认值为0``net.ipv4.conf.default.accept_source_route = 0` `#默认是否接收无源路由的数据包``net.ipv4.conf.all.accept_source_route = 0` `#是否接收无源路由的数据包``net.ipv4.conf.default.secure_redirects = 1` `#默认是否支持安全重定向数据包``net.ipv4.conf.all.secure_redirects = 1` `#是否支持安全重定向数据包``net.ipv4.conf.default.rp_filter = 1` `#默认是否开启反向路径过滤``net.ipv4.conf.all.rp_filter = 1` `#是否开启反向路径过滤``net.ipv4.tcp_invalid_ratelimit = 500` `#无效数据包发送速率时间限制(单位:毫秒)``net.ipv4.tcp_limit_output_bytes = 262144` `#单个套接字限制最大输出字节数

保障TCP通信质量

net.ipv4.tcp_sack = 1` `#是否启用有选择的应答(Selective Acknowledgment),使TCP只重新发送交互过程中``丢失的包,不用发送后续所有的包,而且提供相应机制使接收方能告诉发送方哪些数据丢失,哪些数据重发了,哪些数据已经提前收到了。如此大大提高了客户端与服务器端数据交互的效率``net.ipv4.tcp_fack = 1` `#启用转发应答(Forward Acknowledgment 建议值1),可以进行有选择应答(SACK)从而减少拥塞情况的发生``net.ipv4.tcp_slow_start_after_idle = 1` `#拥塞窗口在经过一段时间空闲后是否需要重新初始化``net.ipv4.tcp_stdurg = 0``net.ipv4.tcp_retries1 = 3` `#放弃回应一个TCP连接请求前进行重试的次数``net.ipv4.tcp_retries2 = 15` `#放弃一个已经建立的TCP连接前进行重试的次数``net.ipv4.tcp_rfc1337 = 0``net.ipv4.tcp_mtu_probing = 0` `#是否开启tcp层路径mtu发现``net.ipv4.tcp_no_metrics_save = 0` `#是否将LAST_ACK状态保存各种连接信息到路由缓存中:方便下次连接时快速恢复现场

IO密集性服务器优化参数

vm.dirty_expire_centisecs = 3000` `#声明Linux内核写缓冲区里面的数据多"旧"了之后,pdflush/flush/kdmflush进程就开始考虑写到磁盘中去``vm.dirty_background_ratio = 10` `#当系统脏页的比例或者所占内存数量超过 dirty_background_ratio(百分数)阈值时,启动相关内核线程(pdflush/flush/kdmflush)开始将脏页写入磁盘``vm.dirty_ratio = 30` `#当系统pagecache的脏页达到系统内存 dirty_ratio(百分数)阈值时,系统就会阻塞新的写请求,直到脏页被回写到磁盘``vm.drop_caches = 0``#释放cache,该参数每修改一次,触发一次释放操作``vm.dirty_writeback_centisecs = 500` `#内核线程(pdflush/flush/kdmflush)多久唤醒一次来检查是否需要将cache中的数据写入磁盘,单位1/100秒` `LVS负载均衡需要修改选项arp_ignore=1,arp_announce=2,两项的默认开关不用修改,需要修改all和lo``net.ipv4.conf.default.arp_ignore = 0``net.ipv4.conf.all.arp_ignore = 0` `#定义对目标地址为本地IP的ARP询问不同的应答模式``#0:回应任何网络接口上对任何本地IP地址的arp查询请求``#1:只回答目标IP地址是来访网络接口本地地址的ARP查询请求``#2:只回答目标IP地址是来访网络接口本地地址的ARP查询请求,且来访IP必须在该网络接口的子网段内` `#3:不回应该网络界面的arp请求,而只对设置的唯一和连接地址做出回应``#8:不回应所有(本地地址)的arp查询``net.ipv4.conf.lo.arp_ignore = 0``net.ipv4.conf.default.arp_announce = 0``net.ipv4.conf.all.arp_announce = 0 #对网络接口上,本地IP地址的发出的,ARP回应,作出相应级别的限制: 确定不同程度的限制,宣布对来自本地源IP地址发出Arp请求的接口``#0: 在任意网络接口(eth0,eth1,lo)上的任何本地地址``#1:尽量避免不在该网络接口子网段的本地地址做出arp回应. 当发起ARP请求的源IP地址是被设置应该经由路由达到此网络接口的时候很有用.此时会检查来访IP是否为所有接口上的子网段内ip之一.如果改来访IP不属于各个网络接口上的子网段内,那么将采用级别2的方式来进行处理.` `#2:对查询目标使用最适当的本地地址.在此模式下将忽略这个IP数据包的源地址并尝试选择与能与该地址通信的本地地址.首要是选择所有的网络接口的子网中外出访问子网中包含该目标IP地址的本地地址. 如果没有合适的地址被发现,将选择当前的发送网络接口或其他的有可能接受到该ARP回应的网络接口来进行发送.``net.ipv4.conf.lo.arp_announce = 0``net.ipv4.ip_no_pmtu_disc = 0 #是否关闭路径MTU探测功能``net.ipv4.ip_forward_use_pmtu = 0 #是否支持巨型帧转发(使用LVS做负载均衡器时建议此值为1)``net.ipv4.conf.default.arp_accept = 0``net.ipv4.conf.all.arp_accept = 0` `#默认对不在ARP表中的IP地址发出的APR包的处理方式:0不在ARP表中创建对应IP地址的表项;1在ARP表中创建对应IP地址的表项``net.ipv4.conf.default.arp_filter = 0``net.ipv4.conf.all.arp_filter = 0` `# 0:内核设置每个网络接口各自应答其地址上的arp询问。这项看似会错误的设置却经常能非常有效,因为它增加了成功通讯的机会。在Linux主机上,每个IP地址是网络接口独立的,而非一个复合的接口。只有在一些特殊的设置的时候,比如负载均衡的时候会带来麻烦``#1:允许多个网络介质位于同一子网段内,每个网络界面依据是否内核指派路由该数据包经过此接口来确认是否回答ARP查询(这个实现是由来源地址确定路由的时候决定的),换句话说,允许控制使用某一块网卡(通常是第一块)回应arp询问
net.ipv4.conf.default.arp_notify = 0``net.ipv4.conf.all.arp_notify = 0` `#是否开启arp通知链操作:0不做任何操作,1当设备或硬件地址改变时自动产生一个arp请求``net.ipv4.conf.default.bootp_relay = 0``net.ipv4.conf.all.bootp_relay = 0` `#是否接收源地址为0.a.b.c,目的地址不是本机的数据包,是为了支持bootp服务``net.ipv4.conf.default.disable_policy = 0``net.ipv4.conf.all.disable_policy = 0` `#是否禁止internet协议安全性验证``net.ipv4.conf.default.disable_xfrm = 0``net.ipv4.conf.all.disable_xfrm = 0` `#是否禁止internet协议安全性加密``net.ipv4.conf.default.force_igmp_version = 0``net.ipv4.conf.all.force_igmp_version = 0

路由器选项控制

net.ipv4.conf.default.forwarding = 0``net.ipv4.ip_forward = 0` `#是否启用IP转发``net.ipv4.conf.all.forwarding = 0` `#是否启用转发功能``net.ipv4.conf.default.mc_forwarding = 0``net.ipv4.conf.all.mc_forwarding = 0``#是否进行多播路由(只有内核编译有CONFIG_MROUTE并且有路由服务程序在运行该参数才有效)``net.ipv4.conf.default.medium_id = 0``net.ipv4.conf.all.medium_id = 0` `#用来区分不同媒介.两个网络设备可以使用不同的值,使他们只有其中之一接收到广播包.通常,这个参数被用来配合proxy_arp实现roxy_arp的特性即是允许arp报文在两个不同的网络介质中转发.``#0:表示各个网络介质接受他们自己介质上的媒介``#-1:表示该媒介未知``net.ipv4.conf.default.promote_secondaries = 1``net.ipv4.conf.all.promote_secondaries = 1` `#主备IP地址切换控制机制:0当接口的主IP地址被移除时,删除所有次IP地址;1当接口的主IP地址被移除时,将次IP地址提升为主IP地址``net.ipv4.conf.default.proxy_arp = 0``net.ipv4.conf.all.proxy_arp = 0` `#是否启用arp代理功能``net.ipv4.conf.default.proxy_arp_pvlan = 0``net.ipv4.conf.all.proxy_arp_pvlan = 0` `#回应代理ARP的数据包从接收到此代理ARP请求的网络接口出去``net.ipv4.conf.default.route_localnet = 0``net.ipv4.conf.all.route_localnet = 0` `#是否允许外部访问localhost``net.ipv4.conf.default.shared_media = 1``net.ipv4.conf.all.shared_media = 1` `#发送或接收RFC1620 共享媒体重定向 会覆盖ip_secure_redirects的值

路由机制控制

net.ipv4.ip_no_pmtu_disc = 0` `#是否关闭路径MTU探测功能``net.ipv4.ip_forward_use_pmtu = 0` `#是否支持巨型帧转发(使用LVS做负载均衡器时建议此值为1)``net.ipv4.conf.default.send_redirects = 1` `#默认是否发送重定向数据包``net.ipv4.conf.all.send_redirects = 1` `#是否发送重定向数据包``net.ipv4.ip_default_ttl = 64` `#定义数据报的生存周期:最多经过多少路由器后数据将被丢弃``net.ipv4.conf.default.src_valid_mark = 0` `#默认是否为源地址有效的数据包打标记``net.ipv4.conf.all.src_valid_mark = 0` `#是否为所有接口上源地址有效的数据包打标记``net.ipv4.conf.default.tag = 0``net.ipv4.conf.all.tag = 0``net.ipv4.conf.default.accept_local = 0` `#默认是否允许接收从本机IP地址上发送给本机的数据包``net.ipv4.conf.all.accept_local = 0` `#是否允许所有接口接收从本机IP地址上发送给本机的数据包

内存大页面使用策略

vm.nr_hugepages = 0 

#控制内存是否可以使用大页面

net.ipv4.conf.{网络接口}.medium_id  通常,这个参数用来区分不同媒介.两个网络设备可以使用不同的值,使他们只有其中之一接收到广播包.通常,这个参数被用来配合proxy_arp实现roxy_arp的特性即是允许arp报文在两个不同的网络介质中转发.``0:表示各个网络介质接受他们自己介质上的媒介``-1:表示该媒介未知。``net.ipv4.conf.{网络接口}.promote_secondaries  0:当接口的主IP地址被移除时,删除所有次IP地址``1:当接口的主IP地址被移除时,将次IP地址提升为主IP地址``net.ipv4.conf.{网络接口}.proxy_arp  打开arp代理功能。``0:禁止``1:允许``net.ipv4.conf.{网络接口}.proxy_arp_pvlan  回应代理ARP的数据包从接收到此代理ARP请求的网络接口出去。``net.ipv4.conf.{网络接口}.route_localnet`   `net.ipv4.conf.{网络接口}.rp_filter  1:通过反向路径回溯进行源地址验证(在RFC1812中定义)。对于单穴主机和stub网络路由器推荐使用该选项。``0:不通过反向路径回溯进行源地址验证。``net.ipv4.conf.{网络接口}.secure_redirects  仅仅接收发给默认网关列表中网关的ICMP重定向消息``0:禁止``1:允许``net.ipv4.conf.{网络接口}.send_redirects  允许发送重定向消息。(路由使用)``0:禁止``1:允许``net.ipv4.conf.{网络接口}.shared_media  发送或接收RFC1620 共享媒体重定向。会覆盖ip_secure_redirects的值。``0:禁止``1:允许``net.ipv4.conf.{网络接口}.src_valid_mark`   `net.ipv4.conf.{网络接口}.tag`   `net.ipv4.conf.default.accept_local  设置是否允许接收从本机IP地址上发送给本机的数据包``0:不允许``1:允许``net.ipv4.conf.default.accept_redirects  收发接收ICMP重定向消息。对于主机来说默认为True,对于用作路由器时默认值为False``0:禁止``1:允许``net.ipv4.conf.default.accept_source_route  接收带有SRR选项的数据报。主机设为0,路由设为1``net.ipv4.conf.default.arp_accept  默认对不在ARP表中的IP地址发出的APR包的处理方式``0:不在ARP表中创建对应IP地址的表项``1:在ARP表中创建对应IP地址的表项``net.ipv4.conf.default.arp_announce  对网络接口上,本地IP地址的发出的,ARP回应,作出相应级别的限制: 确定不同程度的限制,宣布对来自本地源IP地址发出Arp请求的接口``0:在任意网络接口(eth0,eth1,lo)上的任何本地地址``1:尽量避免不在该网络接口子网段的本地地址做出arp回应. 当发起ARP请求的源IP地址是被设置应该经由路由达到此网络接口的时候很有用.此时会检查来访IP是否为所有接口上的子网段内ip之一.如果改来访IP不属于各个网络接口上的子网段内,那么将采用级别2的方式来进行处理.` `2:对查询目标使用最适当的本地地址.在此模式下将忽略这个IP数据包的源地址并尝试选择与能与该地址通信的本地地址.首要是选择所有的网络接口的子网中外出访问子网中包含该目标IP地址的本地地址. 如果没有合适的地址被发现,将选择当前的发送网络接口或其他的有可能接受到该ARP回应的网络接口来进行发送.``net.ipv4.conf.default.arp_filter  0:内核设置每个网络接口各自应答其地址上的arp询问。这项看似会错误的设置却经常能非常有效,因为它增加了成功通讯的机会。在Linux主机上,每个IP地址是网络接口独立的,而非一个复合的接口。只有在一些特殊的设置的时候,比如负载均衡的时候会带来麻烦。``1:允许多个网络介质位于同一子网段内,每个网络界面依据是否内核指派路由该数据包经过此接口来确认是否回答ARP查询(这个实现是由来源地址确定路由的时候决定的),换句话说,允许控制使用某一块网卡(通常是第一块)回应arp询问。``net.ipv4.conf.default.arp_ignore  定义对目标地址为本地IP的ARP询问不同的应答模式``0:回应任何网络接口上对任何本地IP地址的arp查询请求``1:只回答目标IP地址是来访网络接口本地地址的ARP查询请求``2:只回答目标IP地址是来访网络接口本地地址的ARP查询请求,且来访IP必须在该网络接口的子网段内` `3:不回应该网络界面的arp请求,而只对设置的唯一和连接地址做出回应``8:不回应所有(本地地址)的arp查询``net.ipv4.conf.default.arp_notify  arp通知链操作``0:不做任何操作``1:当设备或硬件地址改变时自动产生一个arp请求``net.ipv4.conf.default.bootp_relay  接收源地址为0.a.b.c,目的地址不是本机的数据包,是为了支持bootp服务``0:关闭``1:开启``net.ipv4.conf.default.disable_policy  禁止internet协议安全性验证``0:禁止禁止``1:开启禁止``net.ipv4.conf.default.disable_xfrm  禁止internet协议安全性加密``0:禁止禁止``1:开启禁止``net.ipv4.conf.default.force_igmp_version`   `net.ipv4.conf.default.forwarding  在该接口打开转发功能``0:禁止``1:允许``net.ipv4.conf.default.log_martians  记录带有不允许的地址的数据报到内核日志中。``0:禁止``1:允许``net.ipv4.conf.default.mc_forwarding  是否进行多播路由。只有内核编译有CONFIG_MROUTE并且有路由服务程序在运行该参数才有效。``0:禁止``1:允许``net.ipv4.conf.default.medium_id  通常,这个参数用来区分不同媒介.两个网络设备可以使用不同的值,使他们只有其中之一接收到广播包.通常,这个参数被用来配合proxy_arp实现roxy_arp的特性即是允许arp报文在两个不同的网络介质中转发.``0:表示各个网络介质接受他们自己介质上的媒介``-1:表示该媒介未知。``net.ipv4.conf.default.promote_secondaries  0:当接口的主IP地址被移除时,删除所有次IP地址``1:当接口的主IP地址被移除时,将次IP地址提升为主IP地址``net.ipv4.conf.default.proxy_arp  打开arp代理功能。``0:禁止``1:允许``net.ipv4.conf.default.proxy_arp_pvlan  回应代理ARP的数据包从接收到此代理ARP请求的网络接口出去。``net.ipv4.conf.default.route_localnet`   `net.ipv4.conf.default.rp_filter  1:通过反向路径回溯进行源地址验证(在RFC1812中定义)。对于单穴主机和stub网络路由器推荐使用该选项。``0:不通过反向路径回溯进行源地址验证。``net.ipv4.conf.default.secure_redirects  仅仅接收发给默认网关列表中网关的ICMP重定向消息``0:禁止``1:允许``net.ipv4.conf.default.send_redirects  允许发送重定向消息。(路由使用)``0:禁止``1:允许``net.ipv4.conf.default.shared_media  发送或接收RFC1620 共享媒体重定向。会覆盖ip_secure_redirects的值。``0:禁止``1:允许``net.ipv4.conf.default.src_valid_mark`   `net.ipv4.conf.default.tag`   `net.ipv4.icmp_echo_ignore_all  忽略所有接收到的icmp echo请求的包(会导致机器无法ping通)``0:不忽略``1:忽略``net.ipv4.icmp_echo_ignore_broadcasts  忽略所有接收到的icmp echo请求的广播``0:不忽略``1:忽略``net.ipv4.icmp_errors_use_inbound_ifaddr  当前为 ICMP 错误消息选择源地址的方式,是使用存在的接口地址``1:表示内核通过这个选项允许使用接收到造成这一错误的报文的接口的地址``net.ipv4.icmp_ignore_bogus_error_responses  某些路由器违背RFC1122标准,其对广播帧发送伪造的响应来应答。这种违背行为通常会被以警告的方式记录在系统日志中。``0:记录到系统日志中``1:忽略``net.ipv4.icmp_ratelimit  限制发向特定目标的匹配icmp_ratemask的ICMP数据报的最大速率。配合icmp_ratemask使用。``0:没有任何限制``>0:表示指定时间内中允许发送的个数。(以jiffies为单位)``net.ipv4.icmp_ratemask  在这里匹配的ICMP被icmp_ratelimit参数限制速率.``匹配的标志位: IHGFEDCBA9876543210``默认的掩码值: 0000001100000011000 (6168)``0 Echo Reply``3 Destination Unreachable *``4 Source Quench *``5 Redirect``8 Echo Request``B Time Exceeded *``C Parameter Problem *``D Timestamp Request``E Timestamp Reply``F Info Request``G Info Reply``H Address Mask Request``I Address Mask Reply``* 号的被默认限速``net.ipv4.igmp_max_memberships  限制加入一个多播组的最大成员数.``net.ipv4.igmp_max_msf  限制多播源地址过滤数量.``net.ipv4.igmp_qrv`   `net.ipv4.inet_peer_maxttl  条目的最大存活期。在此期限到达之后,如果缓冲池没有耗尽压力的话(例如:缓冲池中的条目数目非常少),不使用的条目将会超时。该值以 jiffies为单位测量。``net.ipv4.inet_peer_minttl  条目的最低存活期。在重组端必须要有足够的碎片(fragment)存活期。这个最低存活期必须保证缓冲池容积是否少于 inet_peer_threshold。该值以 jiffies为单位测量。``net.ipv4.inet_peer_threshold  INET对端存储器某个合适值,当超过该阀值条目将被丢弃。该阀值同样决定生存时间以及废物收集通过的时间间隔。条目越多,存活期越低,GC 间隔越短。``net.ipv4.ip_default_ttl  该文件表示一个数据报的生存周期(Time To Live),即最多经过多少路由器。``net.ipv4.ip_dynaddr  拨号上网大部分都是使用动态IP地址,我们不知道远程拨号服务器的IP地址是多少,也不可能知道它会给电脑分配什么IP地址``0:使用静态IP``1:使用动态IP地址``net.ipv4.ip_early_demux`   `net.ipv4.ip_forward  是否打开ipv4的IP转发。``0:禁止``1:打开``net.ipv4.ip_forward_use_pmtu`   `net.ipv4.ipfrag_high_thresh  表示用于重组IP分段的内存分配最高值,一旦达到最高内存分配值,其它分段将被丢弃,直到达到最低内存分配值。``net.ipv4.ipfrag_low_thresh  表示用于重组IP分段的内存分配最低值``net.ipv4.ipfrag_max_dist  相同的源地址ip碎片数据报的最大数量. 这个变量表示在ip碎片被添加到队列前要作额外的检查.如果超过定义的数量的ip碎片从一个相同源地址到达,那么假定这个队列的ip碎片有丢失,已经存在的ip碎片队列会被丢弃,如果为0关闭检查``net.ipv4.ipfrag_secret_interval  hash表中ip碎片队列的重建延迟.(单位 秒)``net.ipv4.ipfrag_time  表示一个IP分段在内存中保留多少秒``net.ipv4.ip_local_port_range  本地发起连接时使用的端口范围,tcp初始化时会修改此值``net.ipv4.ip_local_reserved_ports`   `net.ipv4.ip_nonlocal_bind  允许进程绑定到非本地地址``0:禁止``1:允许``net.ipv4.ip_no_pmtu_disc  该文件表示在全局范围内关闭路径MTU探测功能。``net.ipv4.neigh.{网络接口}.anycast_delay  对相邻请求信息的回复的最大延迟时间(单位 秒)``net.ipv4.neigh.{网络接口}.app_solicit  在使用多播探测前,通过netlink发送到用户空间arp守护程序的最大探测数``net.ipv4.neigh.{网络接口}.base_reachable_time  一旦发现相邻记录,至少在一段介于 base_reachable_time/2和3*base_reachable_time/2之间的随机时间内,该记录是有效的.``如果收到上层协议的肯定反馈, 那么记录的有效期将延长.(单位 秒)``net.ipv4.neigh.{网络接口}.base_reachable_time_ms  一旦发现相邻记录,至少在一段介于 base_reachable_time/2和3*base_reachable_time/2之间的随机时间内,该记录是有效的.``如果收到上层协议的肯定反馈, 那么记录的有效期将延长.(单位 毫秒)``net.ipv4.neigh.{网络接口}.delay_first_probe_time  发现某个相邻层记录无效后,发出第一个探测要等待的时间。(单位 秒)``net.ipv4.neigh.{网络接口}.gc_stale_time  决定检查一次相邻层记录的有效性的周期. 当相邻层记录失效时,将在给它发送数据前,再解析一次.(单位 秒)``net.ipv4.neigh.{网络接口}.locktime  防止相邻记录被过度频繁刷新,引起抖动,只有距邻居上次刷新时间超过这时才允许被再次刷新.(单位 秒)``net.ipv4.neigh.{网络接口}.mcast_solicit  在把记录标记为不可达之前, 用多播/广播方式解析地址的最大次数.``net.ipv4.neigh.{网络接口}.proxy_delay  当接收到有一个arp请求时,在回应前可以延迟的时间,这个请求是要得到一个已知代理arp项的地址.(单位 百毫秒)``net.ipv4.neigh.{网络接口}.proxy_qlen  能放入代理 ARP 地址队列的数据包最大数目.``net.ipv4.neigh.{网络接口}.retrans_time  重发一个arp请求前的等待的秒数``net.ipv4.neigh.{网络接口}.retrans_time_ms  重发一个arp请求前的等待的毫秒数``net.ipv4.neigh.{网络接口}.ucast_solicit  arp请求最多发送次数``net.ipv4.neigh.{网络接口}.unres_qlen  最大挂起arp请求的数量,这些请求都正在被解析中.``net.ipv4.neigh.{网络接口}.unres_qlen_bytes  最大处理arp包的字节数``net.ipv4.neigh.default.anycast_delay  对相邻请求信息的回复的最大延迟时间(单位 秒)``net.ipv4.neigh.default.app_solicit  在使用多播探测前,通过netlink发送到用户空间arp守护程序的最大探测数``net.ipv4.neigh.default.base_reachable_time  一旦发现相邻记录,至少在一段介于 base_reachable_time/2和3*base_reachable_time/2之间的随机时间内,该记录是有效的.``如果收到上层协议的肯定反馈, 那么记录的有效期将延长.(单位 秒)``net.ipv4.neigh.default.base_reachable_time_ms  一旦发现相邻记录,至少在一段介于 base_reachable_time/2和3*base_reachable_time/2之间的随机时间内,该记录是有效的.``如果收到上层协议的肯定反馈, 那么记录的有效期将延长.(单位 毫秒)``net.ipv4.neigh.default.delay_first_probe_time  发现某个相邻层记录无效后,发出第一个探测要等待的时间。(单位 秒)``net.ipv4.neigh.default.gc_interval  垃圾收集器收集相邻层记录和无用记录的运行周期(单位 秒)``net.ipv4.neigh.default.gc_stale_time  决定检查一次相邻层记录的有效性的周期. 当相邻层记录失效时,将在给它发送数据前,再解析一次.(单位 秒)``net.ipv4.neigh.default.gc_thresh1  存在于ARP高速缓存中的最少个数,如果少于这个数,垃圾收集器将不会运行``net.ipv4.neigh.default.gc_thresh2  保存在 ARP 高速缓存中的最多的记录软限制. 垃圾收集器在开始收集前,允许记录数超过这个数字,在创建新表项时如果发现5秒没有刷新过,那么进行强制回收``net.ipv4.neigh.default.gc_thresh3  保存在 ARP 高速缓存中的最多记录的硬限制, 一旦高速缓存中的数目高于此, 垃圾收集器将马上运行``net.ipv4.neigh.default.locktime  防止相邻记录被过度频繁刷新,引起抖动,只有距邻居上次刷新时间超过这时才允许被再次刷新.(单位 秒)``net.ipv4.neigh.default.mcast_solicit  在把记录标记为不可达之前, 用多播/广播方式解析地址的最大次数.``net.ipv4.neigh.default.proxy_delay  当接收到有一个arp请求时,在回应前可以延迟的时间,这个请求是要得到一个已知代理arp项的地址.(单位 百毫秒)``net.ipv4.neigh.default.proxy_qlen  能放入代理 ARP 地址队列的数据包最大数目.``net.ipv4.neigh.default.retrans_time  重发一个arp请求前的等待的秒数``net.ipv4.neigh.default.retrans_time_ms  重发一个arp请求前的等待的毫秒数``net.ipv4.neigh.default.ucast_solicit  arp请求最多发送次数``net.ipv4.neigh.default.unres_qlen  最大挂起arp请求的数量,这些请求都正在被解析中.``net.ipv4.neigh.default.unres_qlen_bytes  最大处理arp包的字节数``net.ipv4.ping_group_range`   `net.ipv4.route.error_burst  这个参数和error_cast一起用于限制有多少个icmp不可达消息被发送.当数据包不能到达下一跳时会发送icmp不可达数据包.``当一些主机忽略我们的icmp重定向消息时也会打印一些错误信息到dmesg.这个选项也控制打印的次数.(单位 秒)``net.ipv4.route.error_cost  这个参数和error_burst一起用于限制有多少个icmp不可达消息被发送.当数据包不能到达下一跳时会发送icmp不可达数据包.``当一些主机忽略我们的icmp重定向消息时也会打印一些错误信息到dmesg.这个选项也控制打印的次数.``error_cost值越大,那么icmp不可达和写错误信息的频率就越低.(单位 秒)``net.ipv4.route.flush  写这个文件就会刷新路由高速缓冲.``net.ipv4.route.gc_elasticity  用来控制路由缓存垃圾回收机制的频率和行为.当路由表一个hash项的长度超过此值时,会进行缓存缩减,当路由缓存项长度超过``ip_rt_gc_elasticity << rt_hash_log(表示路由高速缓存hash table的容量以2为对数所得的值) 时会进行强烈的回收.``net.ipv4.route.gc_interval  此参数定义了路由表垃圾回收的间隔(秒)``net.ipv4.route.gc_min_interval  已不再使用,并被gc_min_interval_ms取代``net.ipv4.route.gc_min_interval_ms  此参数定义了路由表垃圾回收的最小间隔(ms)``net.ipv4.route.gc_thresh  路由hash table的大小,当cache中的路由条数超过此值时,开始垃圾回收.``net.ipv4.route.gc_timeout  设置一个路由表项的过期时长(秒).``net.ipv4.route.max_size  路由高速缓存的最大项数,超过会进行清除旧项操作.``net.ipv4.route.min_adv_mss  该文件表示最小的MSS(Maximum Segment Size)大小,取决于第一跳的路由器MTU。(以字节为单位)``net.ipv4.route.min_pmtu  该文件表示最小路径MTU的大小。``net.ipv4.route.mtu_expires  该文件表示PMTU信息缓存多长时间(秒)。``net.ipv4.route.redirect_load  决定是否要向特定主机发送更多的ICMP重定向的时间因子.一旦达到load时间或number个数就不再发送.``net.ipv4.route.redirect_number  决定是否要向特定主机发送更多的ICMP重定向的数量因子.一旦达到load时间或number个数就不再发送.``net.ipv4.route.redirect_silence  重定向的超时.经过这么长时间后,重定向会重发,而不管是否已经因为超过load或者number限制而停止.``net.ipv4.tcp_abort_on_overflow  守护进程太忙而不能接受新的连接,就向对方发送reset消息``0:关闭``1:开启``net.ipv4.tcp_adv_win_scale  计算缓冲开销bytes/2^tcp_adv_win_scale(如果tcp_adv_win_scale > 0)或者bytes-bytes/2^(-tcp_adv_win_scale)(如果tcp_adv_win_scale <= 0)。``net.ipv4.tcp_allowed_congestion_control  列出了tcp目前允许使用的拥塞控制算法,只能在下面可用的算法中选择.``net.ipv4.tcp_app_win  保留max(window/2^tcp_app_win, mss)数量的窗口用于应用缓冲。当为0时表示不需要缓冲。``net.ipv4.tcp_available_congestion_control  列出了tcp目前可以使用的拥塞控制算法.``net.ipv4.tcp_base_mss  tcp探察路径上mtu的最低边界限制, mss+TCP头部+TCP选项+IP头+IP选项.``net.ipv4.tcp_challenge_ack_limit`   `net.ipv4.tcp_congestion_control  当前正在使用的拥塞控制算法.``net.ipv4.tcp_dsack  表示是否允许TCP发送“两个完全相同”的SACK。``0:禁止``1:启用``net.ipv4.tcp_early_retrans`   `net.ipv4.tcp_ecn  表示是否打开TCP的直接拥塞通告功能。``0:禁止``1:启用``net.ipv4.tcp_fack  表示是否打开FACK拥塞避免和快速重传功能。``0:禁止``1:打开``net.ipv4.tcp_fastopen`   `net.ipv4.tcp_fastopen_key`   `net.ipv4.tcp_fin_timeout  本端断开的socket连接,TCP保持在FIN-WAIT-2状态的时间。对方可能会断开连接或一直不结束连接或不可预料的进程死亡。默认值为 60 秒。过去在2.2版本的内核中是 180 秒。您可以设置该值,但需要注意,如果您的机器为负载很重的web服务器,您可能要冒内存被大量无效数据报填满的风险,FIN-WAIT-2 sockets 的危险性低于 FIN-WAIT-1,因为它们最多只吃 1.5K 的内存,但是它们存在时间更长。``net.ipv4.tcp_frto`   `net.ipv4.tcp_keepalive_intvl  表示发送TCP探测的频率,乘以tcp_keepalive_probes表示断开没有相应的TCP连接的时间。``net.ipv4.tcp_keepalive_probes  该文件表示丢弃TCP连接前,进行最大TCP保持连接侦测的次数。保持连接仅在SO_KEEPALIVE套接字选项被打开时才被发送。``net.ipv4.tcp_keepalive_time  表示从最后一个包结束后多少秒内没有活动,才发送keepalive包保持连接,默认7200s,理想可设为1800s,即如果非正常断开,1800s后可通过keepalive知道。``net.ipv4.tcp_limit_output_bytes`   `net.ipv4.tcp_low_latency  允许 TCP/IP 栈适应在高吞吐量情况下低延时的情况;这个选项一般情形是的禁用。(但在构建Beowulf 集群的时候,打开它很有帮助)``0:关闭``1:开启``net.ipv4.tcp_max_orphans  系统所能处理不属于任何进程的TCP sockets最大数量。假如超过这个数量,那么不属于任何进程的连接会被立即reset,并同时显示警告信息。之所以要设定这个限制,纯粹为了抵御那些简单的 DoS 攻击,千万不要依赖这个或是人为的降低这个限制。``net.ipv4.tcp_max_ssthresh`   `net.ipv4.tcp_max_syn_backlog  对于那些依然还未获得客户端确认的连接请求,需要保存在队列中最大数目。默认值是1024,可提高到2048。``net.ipv4.tcp_max_tw_buckets  系统在同时所处理的最大timewait sockets 数目。如果超过此数的话,time-wait socket 会被立即砍除并且显示警告信息。``net.ipv4.tcp_mem  该文件保存了三个值,分别是``low:当TCP使用了低于该值的内存页面数时,TCP不会考虑释放内存。``presure:当TCP使用了超过该值的内存页面数量时,TCP试图稳定其内存使用,进入pressure模式,当内存消耗低于low值时则退出pressure状态。``high:允许所有tcp sockets用于排队缓冲数据报的页面量。``net.ipv4.tcp_min_tso_segs`   `net.ipv4.tcp_moderate_rcvbuf  接收数据时是否调整接收缓存``0:不调整``1:调整``net.ipv4.tcp_mtu_probing  是否开启tcp层路径mtu发现,自动调整tcp窗口等信``0:关闭``1:开启``net.ipv4.tcp_no_metrics_save  如果开启,tcp会在连接关闭时也就是LAST_ACK状态保存各种连接信息到路由缓存中,新建立的连接可以使用这些条件来初始化.。通常这会增加总体的系统性能,但是有些时候也会引起性能下降.``0:关闭``1:开启``net.ipv4.tcp_orphan_retries  针对孤立的socket(也就是已经从进程上下文中删除了,可是还有一些清理工作没有完成).在丢弃TCP连接之前重试的最大的次数``net.ipv4.tcp_reordering  TCP流中重排序的数据报最大数量。``net.ipv4.tcp_retrans_collapse  对于某些有bug的打印机提供针对其bug的兼容性。``0:不启用``1:启用``net.ipv4.tcp_retries1  该文件表示放弃回应一个TCP连接请求前进行重传的次数。``net.ipv4.tcp_retries2  该文件表示放弃在已经建立通讯状态下的一个TCP数据包前进行重传的次数。``net.ipv4.tcp_rfc1337  这个开关可以启动对于在RFC1337中描述的"tcp 的time-wait暗杀危机"问题的修复。启用后,内核将丢弃那些发往time-wait状态TCP套接字的RST 包.``0:关闭``1:开启``net.ipv4.tcp_rmem  此文件中保存有三个值,分别是``Min:为TCP socket预留用于接收缓冲的内存最小值。每个tcp socket都可以在建立后使用它。即使在内存出现紧张情况下tcp socket都至少会有这么多数量的内存用于接收缓冲``Default:为TCP socket预留用于接收缓冲的内存数量,默认情况下该值会影响其它协议使用的net.core.rmem_default 值,一般要低于net.core.rmem_default的值。该值决定了在tcp_adv_win_scale、tcp_app_win和tcp_app_win=0默认值情况下,TCP窗口大小为65535。``Max:用于TCP socket接收缓冲的内存最大值。该值不会影响net.core.rmem_max,"静态"选择参数SO_SNDBUF则不受该值影响。``net.ipv4.tcp_sack  表示是否启用有选择的应答(Selective Acknowledgment),这可以通过有选择地应答乱序接收到的报文来提高性能(这样可以让发送者只发送丢失的报文段);(对于广域网通信来说)这个选项应该启用,但是这会增加对 CPU 的占用。``0:不启用``1:启用``net.ipv4.tcp_slow_start_after_idle  如果设置满足RFC2861定义的行为,在从新开始计算拥塞窗口前延迟一些时间,这延迟的时间长度由当前rto决定.``0:关闭``1:开启``net.ipv4.tcp_stdurg  使用 TCP urg pointer 字段中的主机请求解释功能。大部份的主机都使用老旧的BSD解释,因此如果您在 Linux 打开它,或会导致不能和它们正确沟通。``0:关闭``1:打开``net.ipv4.tcp_synack_retries  对于远端的连接请求SYN,内核会发送SYN + ACK数据报,以确认收到上一个 SYN连接请求包。``这是所谓的三次握手.这里决定内核在放弃连接之前所送出的 SYN+ACK 数目.``net.ipv4.tcp_syncookies  表示是否打开TCP同步标签(syncookie),内核必须打开了 CONFIG_SYN_COOKIES项进行编译。同步标签(syncookie)可以防止一个套接字在有过多试图连接到达时引起过载。``0:关闭``1:打开``net.ipv4.tcp_syn_retries  表示本机向外发起TCP SYN连接超时重传的次数,不应该高于255;该值仅仅针对外出的连接,对于进来的连接由tcp_retries1控制。``net.ipv4.tcp_thin_dupack`   `net.ipv4.tcp_thin_linear_timeouts`   `net.ipv4.tcp_timestamps  表示是否启用以一种比超时重发更精确的方法(请参阅 RFC 1323)来启用对 RTT 的计算;为了实现更好的性能应该启用这个选项。``0:不启用``1:启用``net.ipv4.tcp_tso_win_divisor  控制根据拥塞窗口的百分比,是否来发送相应的延迟tso frame``0:关闭``>0:值越大表示tso frame延迟发送可能越小.``net.ipv4.tcp_tw_recycle  打开快速 TIME-WAIT sockets 回收。除非得到技术专家的建议或要求,请不要随意修改这个值。``net.ipv4.tcp_tw_reuse  表示是否允许重新应用处于TIME-WAIT状态的socket用于新的TCP连接。``0:关闭``1:打开``net.ipv4.tcp_window_scaling  表示设置tcp/ip会话的滑动窗口大小是否可变。``0:不可变``1:可变``net.ipv4.tcp_wmem  此文件中保存有三个值,分别是``Min:为TCP socket预留用于发送缓冲的内存最小值。每个tcp socket都可以在建立后使用它。``Default:为TCP socket预留用于发送缓冲的内存数量,默认情况下该值会影响其它协议使用的net.core.wmem_default 值,一般要低于net.core.wmem_default的值。``Max:用于TCP socket发送缓冲的内存最大值。该值不会影响net.core.wmem_max,"静态"选择参数SO_SNDBUF则不受该值影响。``net.ipv4.tcp_workaround_signed_windows  0:假定远程连接端正常发送了窗口收缩选项,即使对端没有发送.``1:假定远程连接端有错误,没有发送相关的窗口缩放选项``net.ipv4.udp_mem  该文件保存了三个值,分别是``low:当UDP使用了低于该值的内存页面数时,UDP不会考虑释放内存。``presure:当UDP使用了超过该值的内存页面数量时,UDP试图稳定其内存使用,进入pressure模式,当内存消耗低于low值时则退出pressure状态。``high:允许所有UDP sockets用于排队缓冲数据报的页面量。``net.ipv4.udp_rmem_min`   `net.ipv4.udp_wmem_min`   `net.ipv4.xfrm4_gc_thresh`   `net.ipv6.bindv6only  默认监听ipv6端口(不管监听与否,都与是否关闭ipv4监听无关)``0:不监听``1:监听``net.ipv6.conf.all.accept_dad  0:取消DAD功能``1:启用DAD功能,但link-local地址冲突时,不关闭ipv6功能``2:启用DAD功能,但link-local地址冲突时,关闭ipv6功能``net.ipv6.conf.all.accept_ra  接受IPv6路由通告.并且根据得到的信息自动设定.``0:不接受路由通告``1:当forwarding禁止时接受路由通告``2:任何情况下都接受路由通告``net.ipv6.conf.all.accept_ra_defrtr  是否接受ipv6路由器发出的默认路由设置``0:不接受``1:接受``net.ipv6.conf.all.accept_ra_pinfo  当accept_ra开启时此选项会自动开启,关闭时则会关闭``net.ipv6.conf.all.accept_ra_rt_info_max_plen  在路由通告中路由信息前缀的最大长度。当``net.ipv6.conf.all.accept_ra_rtr_pref`   `net.ipv6.conf.all.accept_redirects  是否接受ICMPv6重定向包``0:拒绝接受ICMPv6,当forwarding=1时,此值会自动设置为0``1:启动接受ICMPv6,当forwarding=0时,此值会自动设置为1``net.ipv6.conf.all.accept_source_route  接收带有SRR选项的数据报。主机设为0,路由设为1``net.ipv6.conf.all.autoconf  设定本地连结地址使用L2硬件地址. 它依据界面的L2-MAC address自动产生一个地址如:"fe80::201:23ff:fe45:6789"``net.ipv6.conf.all.dad_transmits  接口增加ipv6地址时,发送几次DAD包``net.ipv6.conf.all.disable_ipv6  是否禁用ipv6``0:不禁用``1:禁用``net.ipv6.conf.all.force_mld_version`   `net.ipv6.conf.all.force_tllao`   `net.ipv6.conf.all.forwarding  所有网络接口开启ipv6转发``0:关闭``1:开启``net.ipv6.conf.all.hop_limit  缺省hop限制``net.ipv6.conf.all.max_addresses  所有网络接口自动配置IP地址的数量最大值``0:不限制``>0:最大值``net.ipv6.conf.all.max_desync_factor  DESYNC_FACTOR的最大值,DESYNC_FACTOR是一个随机数,用于防止客户机在同一时间生成新的地址``net.ipv6.conf.all.mc_forwarding  是否使用多路广播进行路由选择,需要内核编译时开启了CONFIG_MROUTE选项并且开启了多路广播路由选择的后台daemon``0:关闭``1:开启``net.ipv6.conf.all.mldv1_unsolicited_report_interval  每次发送MLDv1的主动报告的时间间隔(ms)``net.ipv6.conf.all.mldv2_unsolicited_report_interval  每次发送MLDv2的主动报告的时间间隔(ms)``net.ipv6.conf.all.mtu  ipv6的最大传输单元``net.ipv6.conf.all.ndisc_notify  如何向邻居设备通知地址和设备的改变``0:不通知``1:主动向邻居发送广播报告硬件地址或者设备发生了改变``net.ipv6.conf.all.optimistic_dad  是否启用optimistic DAD(乐观地进行重复地址检查)``0:关闭``1:开启``net.ipv6.conf.all.proxy_ndp  此功能类似于ipv4的nat,可将内网的包转发到外网,外网不能主动发给内网。``0:关闭``1:开启``net.ipv6.conf.all.regen_max_retry  尝试生成临时地址的次数``net.ipv6.conf.all.router_probe_interval  路由器探测间隔(秒)``net.ipv6.conf.all.router_solicitation_delay  在发送路由请求之前的等待时间(秒).``net.ipv6.conf.all.router_solicitation_interval  在每个路由请求之间的等待时间(秒).``net.ipv6.conf.all.router_solicitations  假定没有路由的情况下发送的请求个数``net.ipv6.conf.all.temp_prefered_lft`   `net.ipv6.conf.all.temp_valid_lft`   `net.ipv6.conf.all.use_tempaddr`   `net.ipv6.conf.{网络接口}.accept_dad`   `net.ipv6.conf.{网络接口}.accept_ra`   `net.ipv6.conf.{网络接口}.accept_ra_defrtr`   `net.ipv6.conf.{网络接口}.accept_ra_pinfo`   `net.ipv6.conf.{网络接口}.accept_ra_rt_info_max_plen`   `net.ipv6.conf.{网络接口}.accept_ra_rtr_pref`   `net.ipv6.conf.{网络接口}.accept_redirects`   `net.ipv6.conf.{网络接口}.accept_source_route  接收带有SRR选项的数据报。主机设为0,路由设为1``net.ipv6.conf.{网络接口}.autoconf`   `net.ipv6.conf.{网络接口}.dad_transmits`   `net.ipv6.conf.{网络接口}.disable_ipv6`   `net.ipv6.conf.{网络接口}.force_mld_version`   `net.ipv6.conf.{网络接口}.force_tllao`   `net.ipv6.conf.{网络接口}.forwarding`   `net.ipv6.conf.{网络接口}.hop_limit`   `net.ipv6.conf.{网络接口}.max_addresses`   `net.ipv6.conf.{网络接口}.max_desync_factor`   `net.ipv6.conf.{网络接口}.mc_forwarding`   `net.ipv6.conf.{网络接口}.mldv1_unsolicited_report_interval`   `net.ipv6.conf.{网络接口}.mldv2_unsolicited_report_interval`   `net.ipv6.conf.{网络接口}.mtu`   `net.ipv6.conf.{网络接口}.ndisc_notify`   `net.ipv6.conf.{网络接口}.optimistic_dad`   `net.ipv6.conf.{网络接口}.proxy_ndp`   `net.ipv6.conf.{网络接口}.regen_max_retry`   `net.ipv6.conf.{网络接口}.router_probe_interval`   `net.ipv6.conf.{网络接口}.router_solicitation_delay`   `net.ipv6.conf.{网络接口}.router_solicitation_interval`   `net.ipv6.conf.{网络接口}.router_solicitations`   `net.ipv6.conf.{网络接口}.temp_prefered_lft`   `net.ipv6.conf.{网络接口}.temp_valid_lft`   `net.ipv6.conf.{网络接口}.use_tempaddr`   `net.ipv6.conf.default.accept_dad`   `net.ipv6.conf.default.accept_ra`   `net.ipv6.conf.default.accept_ra_defrtr`   `net.ipv6.conf.default.accept_ra_pinfo`   `net.ipv6.conf.default.accept_ra_rt_info_max_plen`   `net.ipv6.conf.default.accept_ra_rtr_pref`   `net.ipv6.conf.default.accept_redirects`   `net.ipv6.conf.default.accept_source_route  接收带有SRR选项的数据报。主机设为0,路由设为1``net.ipv6.conf.default.autoconf`   `net.ipv6.conf.default.dad_transmits`   `net.ipv6.conf.default.disable_ipv6`   `net.ipv6.conf.default.force_mld_version`   `net.ipv6.conf.default.force_tllao`   `net.ipv6.conf.default.forwarding`   `net.ipv6.conf.default.hop_limit`   `net.ipv6.conf.default.max_addresses`   `net.ipv6.conf.default.max_desync_factor`   `net.ipv6.conf.default.mc_forwarding`   `net.ipv6.conf.default.mldv1_unsolicited_report_interval`   `net.ipv6.conf.default.mldv2_unsolicited_report_interval`   `net.ipv6.conf.default.mtu`   `net.ipv6.conf.default.ndisc_notify`   `net.ipv6.conf.default.optimistic_dad`   `net.ipv6.conf.default.proxy_ndp`   `net.ipv6.conf.default.regen_max_retry`   `net.ipv6.conf.default.router_probe_interval`   `net.ipv6.conf.default.router_solicitation_delay`   `net.ipv6.conf.default.router_solicitation_interval`   `net.ipv6.conf.default.router_solicitations`   `net.ipv6.conf.default.temp_prefered_lft`   `net.ipv6.conf.default.temp_valid_lft`   `net.ipv6.conf.default.use_tempaddr`   `net.ipv6.icmp.ratelimit`   `net.ipv6.ip6frag_high_thresh`   `net.ipv6.ip6frag_low_thresh`   `net.ipv6.ip6frag_secret_interval`   `net.ipv6.ip6frag_time`   `net.ipv6.mld_max_msf`   `net.ipv6.mld_qrv`   `net.ipv6.neigh.{网络接口}.anycast_delay`   `net.ipv6.neigh.{网络接口}.app_solicit`   `net.ipv6.neigh.{网络接口}.base_reachable_time`   `net.ipv6.neigh.{网络接口}.base_reachable_time_ms`   `net.ipv6.neigh.{网络接口}.delay_first_probe_time`   `net.ipv6.neigh.{网络接口}.gc_stale_time`   `net.ipv6.neigh.{网络接口}.locktime`   `net.ipv6.neigh.{网络接口}.mcast_solicit`   `net.ipv6.neigh.{网络接口}.proxy_delay`   `net.ipv6.neigh.{网络接口}.proxy_qlen`   `net.ipv6.neigh.{网络接口}.retrans_time`   `net.ipv6.neigh.{网络接口}.retrans_time_ms`   `net.ipv6.neigh.{网络接口}.ucast_solicit`   `net.ipv6.neigh.{网络接口}.unres_qlen`   `net.ipv6.neigh.{网络接口}.unres_qlen_bytes`   `net.ipv6.route.flush`   `net.ipv6.route.gc_elasticity`   `net.ipv6.route.gc_interval`   `net.ipv6.route.gc_min_interval`   `net.ipv6.route.gc_min_interval_ms`   `net.ipv6.route.gc_thresh`   `net.ipv6.route.gc_timeout`   `net.ipv6.route.max_size`   `net.ipv6.route.min_adv_mss`   `net.ipv6.route.mtu_expires`   `net.ipv6.xfrm6_gc_thresh`   `net.netfilter.nf_conntrack_acct`   `net.netfilter.nf_conntrack_buckets  只读,描述当前系统的ip_conntrack的hash table大小.``net.netfilter.nf_conntrack_checksum  验证协议是否错误是,是否对协议进行校验和验证``0:关闭``1:开启``net.netfilter.nf_conntrack_count  内存中ip_conntrack结构的数量.``net.netfilter.nf_conntrack_events`   `net.netfilter.nf_conntrack_events_retry_timeout`   `net.netfilter.nf_conntrack_expect_max`   `net.netfilter.nf_conntrack_generic_timeout  通用或未知协议的conntrack被设置的超时时间(每次看到包都会用这值重新更新定时器),一旦时间到conntrack将被回收.(秒)``net.netfilter.nf_conntrack_helper`   `net.netfilter.nf_conntrack_icmp_timeout  icmp协议的conntrack被设置的超时时间,一旦到时conntrack将被回收.(秒)``net.netfilter.nf_conntrack_log_invalid  调试时使用,可以指定一个数字,这个数字是内核定义的协议号比如IPPROTO_TCP是6,当指定协议解析时发现一些错误包会打印相关的错误信息到dmesg中.``最小值0,最大值255,默认不打印.``net.netfilter.nf_conntrack_max  内存中最多ip_conntrack结构的数量.``net.netfilter.nf_conntrack_tcp_be_liberal  当开启只有不在tcp窗口内的rst包被标志为无效,当关闭(默认)所有不在tcp窗口中的包都被标志为无效.``0:关闭``1:开启``net.netfilter.nf_conntrack_tcp_loose  当想追踪一条已经连接的tcp会话, 在系统可以假设sync和window追逐已经开始后要求每个方向必须通过的包的数量.``如果为0,从不追踪一条已经连接的tcp会话.``net.netfilter.nf_conntrack_tcp_max_retrans  没有从目的端接收到一个ack而进行包重传的次数,一旦达到这限制nf_conntrack_tcp_timeout_max_retrans将作为ip_conntrack的超时限制.``net.netfilter.nf_conntrack_tcp_timeout_close  TCP处于close状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_close_wait  TCP处于close wait状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_established  TCP处于established状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_fin_wait  TCP处于fin wait状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_last_ack  TCP处于last ack状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_max_retrans  TCP处于max retrans状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_syn_recv  TCP处于syn recv状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_syn_sent  TCP处于syn sent状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_time_wait  TCP处于time wait状态超时时间(秒)``net.netfilter.nf_conntrack_tcp_timeout_unacknowledged  TCP处于unacknowledged状态超时时间(秒)``net.netfilter.nf_conntrack_timestamp`   `net.netfilter.nf_conntrack_udp_timeout  udp协议的conntrack被设置的超时时间(每次看到包都会用这值重新更新定时器),一旦到时conntrack将被回收.(秒)``net.netfilter.nf_conntrack_udp_timeout_stream  当看到一些特殊的udp传输时(传输在双向)设置的ip_conntrack超时时间(每次看到包都会用这值重新更新定时器).(秒)``net.netfilter.nf_log.0`   `net.netfilter.nf_log.1`   `net.netfilter.nf_log.10`   `net.netfilter.nf_log.11`   `net.netfilter.nf_log.12`   `net.netfilter.nf_log.2`   `net.netfilter.nf_log.3`   `net.netfilter.nf_log.4`   `net.netfilter.nf_log.5`   `net.netfilter.nf_log.6`   `net.netfilter.nf_log.7`   `net.netfilter.nf_log.8`   `net.netfilter.nf_log.9`   `net.nf_conntrack_max  内存中最多ip_conntrack结构的数量.``net.unix.max_dgram_qlen  允许域套接字中数据包的最大个数,在初始化unix域套接字时的默认值.``在调用listen函数时第二个参数会复盖这个值.` `1.4 文件系统参数列表` `fs.aio-max-nr  最大允许aio请求数量(会涉及到数据库的aio请求)``fs.aio-nr  当前aio请求数量``fs.binfmt_misc.qemu-alpha  binfmt_misc用于支持当前芯片架构的系统是否支持通过qemu进行chroot到其他架构的根文件系统中进行操作。``fs.binfmt_misc.qemu-arm`   `fs.binfmt_misc.qemu-armeb`   `fs.binfmt_misc.qemu-cris`   `fs.binfmt_misc.qemu-i386`   `fs.binfmt_misc.qemu-i486`   `fs.binfmt_misc.qemu-m68k`   `fs.binfmt_misc.qemu-microblaze`   `fs.binfmt_misc.qemu-microblazeel`   `fs.binfmt_misc.qemu-mips`   `fs.binfmt_misc.qemu-mips64`   `fs.binfmt_misc.qemu-mips64el`   `fs.binfmt_misc.qemu-mipsel`   `fs.binfmt_misc.qemu-s390x`   `fs.binfmt_misc.qemu-sh4`   `fs.binfmt_misc.qemu-sh4eb`   `fs.binfmt_misc.qemu-sparc`   `fs.binfmt_misc.qemu-sparc32plus`   `fs.binfmt_misc.qemu-sparc64`   `fs.binfmt_misc.register  用于注册或修改以上的binfmt_misc,输入格式是 :name:type:offset:magic:mask:interpreter:flags``例:echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:``\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register``fs.binfmt_misc.status  设置binfmt_misc开启``0:禁止``1:开启``fs.dentry-state  保存目录缓存的状态,保存有六个值,只有前三个有效``nr_dentry:当前已经分配的目录项数量``nr_unused:还没有使用的目录项数量``age_limit:当内存紧缺时,延迟多少秒后会回收目录项所占内存``fs.dir-notify-enable  设置是否启用dnotify,已被inotify取代,因为dnotify 需要您为每个打算监控是否发生改变的目录打开一个文件描述符。当同时监控多个目录时,这会消耗大量的资源,因为有可能达到每个进程的文件描述符限制。并且不允许卸载(unmount)支持的设备``0:不使用``1:使用``fs.epoll.max_user_watches  IO复用epoll监听文件句柄的数量最大值``fs.file-max  系统中所有进程能够同时打开的文件句柄数量``fs.file-nr  此文件中保存了三个值,分别是:系统中已分配的文件句柄数量    已分配但没有使用的文件句柄数量    最大的文件句柄号``fs.inode-nr  此文件保存了两个值,是:已分配inode数    空闲inode数``fs.inode-state  此文件保存了三个值,前两个分别表示 已分配inode数和空闲inode数。第三个是已超出系统最大inode值的数量,此时系统需要清除排查inode列表``fs.inotify.max_queued_events  inotify用于监控文件系统事件``该文件中的值为调用inotify_init函数时分配给inotify队列的事件数目的最大值,超出这个值得事件被丢弃,但会触发IN_Q_OVERFLOW事件``文件系统变化越频繁,这个值就应该越大` `fs.inotify.max_user_instances  设置每个用户可以运行的inotifywait或inotifywatch命令的进程数。``fs.inotify.max_user_watches  设置inotifywait或inotifywatch命令可以监视的文件数量(单进程)。``fs.lease-break-time  当进程尝试打开一个被租借锁保护的文件时,该进程会被阻塞,同时,在一定时间内拥有该文件租借锁的进程会收到一个信号。收到信号之后,拥有该文件租借锁的进程会首先更新文件,从而保证了文件内容的一致性,接着,该进程释放这个租借锁。如果拥有租借锁的进程在一定的时间间隔内没有完成工作,内核就会自动删除这个租借锁或者将该锁进行降级,从而允许被阻塞的进程继续工作。``此保存租借锁的超时时间(以秒为单位)``fs.leases-enable  是否启用文件的租借锁``1:启用``0:不启用``fs.mqueue.msg_default  POSIX的消息队列``此文件保存一个消息队列中消息数量的默认值,如果此值超过msg_max,则会被设置为msg_max``fs.mqueue.msg_max  一个消息队列的最大消息数``fs.mqueue.msgsize_default  消息队列中一个消息的默认大小(以字节为单位)``fs.mqueue.msgsize_max  消息队列中一个消息的最大大小(以字节为单位)``fs.mqueue.queues_max  系统中允许的消息队列的最大数量``fs.nfs.idmap_cache_timeout  设置idmapper缓存项的最大寿命,单位是秒``fs.nfs.nfs_callback_tcpport  设置NFSv4回复通道(callback channel)监听的TCP端口``fs.nfs.nfs_congestion_kb`   `fs.nfs.nfs_mountpoint_timeout`   `fs.nfs.nlm_grace_period  参数设置服务器重新引导后客户机回收NFSv3锁和NFSv4锁所需的秒数。因此,grace_period的值可控制NFSv3和NFSv4的锁定恢复的宽延期长度。``fs.nfs.nlm_tcpport  为NFS锁管理器指定TCP端口``fs.nfs.nlm_timeout  为NFS锁管理器指定默认超时时间,单位是秒。默认值是10秒。取值范围在[3-20]``fs.nfs.nlm_udpport  为NFS锁管理器指定UDP端口``fs.nfs.nsm_local_state`   `fs.nfs.nsm_use_hostnames`   `fs.nr_open  一个进程最多同时打开的文件句柄数量``fs.overflowgid  Linux的GID为32位,但有些文件系统只支持16位的GID,此时若进行写操作会出错;当GID超过65535时会自动被转换为一个固定值,这个固定值保存在这个文件中``fs.overflowuid  Linux的UID为32位,但有些文件系统只支持16位的UID,此时若进行写操作会出错;当UID超过65535时会自动被转换为一个固定值,这个固定值保存在这个文件中``fs.pipe-max-size  此文件限制非特权程序使用pipe时的缓存最大大小(以字节为单位,最小设置为4096)``fs.protected_hardlinks  用于限制普通用户建立硬链接``0:不限制用户建立硬链接``1:限制,如果文件不属于用户,或者用户对此用户没有读写权限,则不能建立硬链接``fs.protected_symlinks  用于限制普通用户建立软链接``0:不限制用户建立软链接``1:限制,允许用户建立软连接的情况是 软连接所在目录是全局可读写目录或者软连接的uid与跟从者的uid匹配,又或者目录所有者与软连接所有者匹配``fs.quota.allocated_dquots`   `fs.quota.cache_hits`   `fs.quota.drops`   `fs.quota.free_dquots`   `fs.quota.lookups`   `fs.quota.reads`   `fs.quota.syncs`   `fs.quota.warnings`   `fs.quota.writes`   `fs.suid_dumpable`   `fscache.object_max_active`   `fscache.operation_max_active`   `   ``Linux系统内核参数调优``相信做运维的同仁,进行运维环境初建时,必须要考虑到操作系统内核参数的优化问题,本人经历数次的运维环境重建后,决定要自行收集一份比较完善的系统内核参数优化说明文件出来,于是就有了下文,本文当前值是官方默认参数,建议参数直接添加于sysctl -a输出的结果每一行的后面,希望对运维的同仁做系统内核参数调优时有所帮助。废话不多讲,直接上干货!``说明:将调整好的参数直接写入/etc/sysctl.conf文件,然后sysctl -p,即可覆盖内核文件中的值。``2.1 默认内核参数` `#3.10.0-862.el7.x86_64``#CentOS Linux release 7.5.1804``abi.vsyscall32 = 1``crypto.fips_enabled = 0``debug.exception-trace = 1``debug.kprobes-optimization = 1``debug.panic_on_rcu_stall = 0``dev.cdrom.autoclose = 1``dev.cdrom.autoeject = 0``dev.cdrom.check_media = 0``dev.cdrom.debug = 0``dev.cdrom.info = CD-ROM information, Id: cdrom.c 3.20 2003/12/17``dev.cdrom.info =` `dev.cdrom.info = drive name: sr0``dev.cdrom.info = drive speed: 1``dev.cdrom.info = drive # of slots: 1``dev.cdrom.info = Can close tray: 1``dev.cdrom.info = Can open tray: 1``dev.cdrom.info = Can lock tray: 1``dev.cdrom.info = Can change speed: 1``dev.cdrom.info = Can select disk: 0``dev.cdrom.info = Can read multisession: 1``dev.cdrom.info = Can read MCN: 1``dev.cdrom.info = Reports media changed: 1``dev.cdrom.info = Can play audio: 1``dev.cdrom.info = Can write CD-R: 1``dev.cdrom.info = Can write CD-RW: 1``dev.cdrom.info = Can read DVD: 1``dev.cdrom.info = Can write DVD-R: 1``dev.cdrom.info = Can write DVD-RAM: 1``dev.cdrom.info = Can read MRW: 1``dev.cdrom.info = Can write MRW: 1``dev.cdrom.info = Can write RAM: 1``dev.cdrom.info =` `dev.cdrom.info =` `dev.cdrom.lock = 1``dev.hpet.max-user-freq = 64``dev.mac_hid.mouse_button2_keycode = 97``dev.mac_hid.mouse_button3_keycode = 100``dev.mac_hid.mouse_button_emulation = 0``dev.parport.default.spintime = 500``dev.parport.default.timeslice = 200``dev.raid.speed_limit_max = 200000 #RAID最大读取速率,如果RAID性能较高,可以修改此上限来提升IO性能``dev.raid.speed_limit_min = 1000 #RAID最小读取速率``dev.scsi.logging_level = 0 #是否开启scsi磁盘的日志功能,一般情况不建议开启``fs.aio-max-nr = 65536``fs.aio-nr = 0``fs.binfmt_misc.status = enabled``fs.dentry-state = 23528 10917 45 0 0 0``fs.dir-notify-enable = 1``fs.epoll.max_user_watches = 411340``fs.file-max = 197872``fs.file-nr = 1120 0 197872``fs.inode-nr = 20574 298``fs.inode-state = 20574 298 0 0 0 0 0``fs.inotify.max_queued_events = 16384``fs.inotify.max_user_instances = 128``fs.inotify.max_user_watches = 8192``fs.lease-break-time = 45``fs.leases-enable = 1``fs.may_detach_mounts = 0``fs.mount-max = 100000``fs.mqueue.msg_default = 10``fs.mqueue.msg_max = 10``fs.mqueue.msgsize_default = 8192``fs.mqueue.msgsize_max = 8192``fs.mqueue.queues_max = 256``fs.nr_open = 1048576``fs.overflowgid = 65534``fs.overflowuid = 65534``fs.pipe-max-size = 1048576``fs.pipe-user-pages-hard = 0``fs.pipe-user-pages-soft = 16384``fs.protected_hardlinks = 1``fs.protected_symlinks = 1``fs.quota.allocated_dquots = 0``fs.quota.cache_hits = 0``fs.quota.drops = 0``fs.quota.free_dquots = 0``fs.quota.lookups = 0``fs.quota.reads = 0``fs.quota.syncs = 0``fs.quota.warnings = 1``fs.quota.writes = 0``fs.suid_dumpable = 0``kernel.acct = 4 2 30``kernel.acpi_video_flags = 0``kernel.auto_msgmni = 1``kernel.bootloader_type = 114``kernel.bootloader_version = 2``kernel.cad_pid = 1``kernel.cap_last_cap = 36``kernel.compat-log = 1``kernel.core_pattern = core``kernel.core_pipe_limit = 0``kernel.core_uses_pid = 1``kernel.ctrl-alt-del = 0``kernel.dmesg_restrict = 0``kernel.domainname = (none)``kernel.ftrace_dump_on_oops = 0``kernel.ftrace_enabled = 1``kernel.hardlockup_all_cpu_backtrace = 0``kernel.hardlockup_panic = 1``kernel.hostname = example_server.com #由此可以看出,主机名是属于内核的``kernel.hotplug =` `kernel.hung_task_check_count = 4194304``kernel.hung_task_panic = 0``kernel.hung_task_timeout_secs = 120``kernel.hung_task_warnings = 10``kernel.io_delay_type = 0``kernel.kexec_load_disabled = 0``kernel.keys.gc_delay = 300``kernel.keys.maxbytes = 20000``kernel.keys.maxkeys = 200``kernel.keys.persistent_keyring_expiry = 259200``kernel.keys.root_maxbytes = 25000000``kernel.keys.root_maxkeys = 1000000``kernel.kptr_restrict = 0``kernel.max_lock_depth = 1024``kernel.modprobe = /sbin/modprobe``kernel.modules_disabled = 0``kernel.msg_next_id = -1``kernel.msgmax = 8192``kernel.msgmnb = 16384``kernel.msgmni = 3958``kernel.ngroups_max = 65536``kernel.nmi_watchdog = 1``kernel.ns_last_pid = 1651``kernel.numa_balancing = 0``kernel.numa_balancing_scan_delay_ms = 1000``kernel.numa_balancing_scan_period_max_ms = 60000``kernel.numa_balancing_scan_period_min_ms = 1000``kernel.numa_balancing_scan_size_mb = 256``kernel.numa_balancing_settle_count = 4``kernel.osrelease = 3.10.0-862.el7.x86_64``kernel.ostype = Linux``kernel.overflowgid = 65534``kernel.overflowuid = 65534``kernel.panic = 0``kernel.panic_on_io_nmi = 0``kernel.panic_on_oops = 1``kernel.panic_on_stackoverflow = 0``kernel.panic_on_unrecovered_nmi = 0``kernel.panic_on_warn = 0``kernel.perf_cpu_time_max_percent = 25``kernel.perf_event_max_sample_rate = 100000``kernel.perf_event_mlock_kb = 516``kernel.perf_event_paranoid = 2``kernel.pid_max = 131072``kernel.poweroff_cmd = /sbin/poweroff``kernel.print-fatal-signals = 0``kernel.printk = 4 4 1 7``kernel.printk_delay = 0``kernel.printk_ratelimit = 5``kernel.printk_ratelimit_burst = 10``kernel.pty.max = 4096``kernel.pty.nr = 1``kernel.pty.reserve = 1024``kernel.random.boot_id = b91ea354-c5d0-4c48-abcd-18da3dcd6741``kernel.random.entropy_avail = 978``kernel.random.poolsize = 4096``kernel.random.read_wakeup_threshold = 64``kernel.random.urandom_min_reseed_secs = 60``kernel.random.uuid = 923d2748-02d8-47b8-968d-9c2b7c420bec``kernel.random.write_wakeup_threshold = 896``kernel.randomize_va_space = 2``kernel.real-root-dev = 0``kernel.sched_autogroup_enabled = 0``kernel.sched_cfs_bandwidth_slice_us = 5000``kernel.sched_child_runs_first = 0``kernel.sched_domain.cpu0.domain0.busy_factor = 32``kernel.sched_domain.cpu0.domain0.busy_idx = 2``kernel.sched_domain.cpu0.domain0.cache_nice_tries = 1``kernel.sched_domain.cpu0.domain0.flags = 559``kernel.sched_domain.cpu0.domain0.forkexec_idx = 0``kernel.sched_domain.cpu0.domain0.idle_idx = 0``kernel.sched_domain.cpu0.domain0.imbalance_pct = 117``kernel.sched_domain.cpu0.domain0.max_interval = 4``kernel.sched_domain.cpu0.domain0.max_newidle_lb_cost = 17063``kernel.sched_domain.cpu0.domain0.min_interval = 2``kernel.sched_domain.cpu0.domain0.name = MC``kernel.sched_domain.cpu0.domain0.newidle_idx = 0``kernel.sched_domain.cpu0.domain0.wake_idx = 0``kernel.sched_domain.cpu1.domain0.busy_factor = 32``kernel.sched_domain.cpu1.domain0.busy_idx = 2``kernel.sched_domain.cpu1.domain0.cache_nice_tries = 1``kernel.sched_domain.cpu1.domain0.flags = 559``kernel.sched_domain.cpu1.domain0.forkexec_idx = 0``kernel.sched_domain.cpu1.domain0.idle_idx = 0``kernel.sched_domain.cpu1.domain0.imbalance_pct = 117``kernel.sched_domain.cpu1.domain0.max_interval = 4``kernel.sched_domain.cpu1.domain0.max_newidle_lb_cost = 1898``kernel.sched_domain.cpu1.domain0.min_interval = 2``kernel.sched_domain.cpu1.domain0.name = MC``kernel.sched_domain.cpu1.domain0.newidle_idx = 0``kernel.sched_domain.cpu1.domain0.wake_idx = 0``kernel.sched_latency_ns = 12000000``kernel.sched_migration_cost_ns = 500000``kernel.sched_min_granularity_ns = 10000000``kernel.sched_nr_migrate = 32``kernel.sched_rr_timeslice_ms = 100``kernel.sched_rt_period_us = 1000000``kernel.sched_rt_runtime_us = 950000``kernel.sched_schedstats = 0``kernel.sched_shares_window_ns = 10000000``kernel.sched_time_avg_ms = 1000``kernel.sched_tunable_scaling = 1``kernel.sched_wakeup_granularity_ns = 15000000``kernel.sem = 250 32000 32 128``kernel.sem_next_id = -1``kernel.shm_next_id = -1``kernel.shm_rmid_forced = 0``kernel.shmall = 18446744073692774399``kernel.shmmax = 18446744073692774399``kernel.shmmni = 4096``kernel.softlockup_all_cpu_backtrace = 0``kernel.softlockup_panic = 0``kernel.stack_tracer_enabled = 0``kernel.sysctl_writes_strict = 1``kernel.sysrq = 16``kernel.tainted = 0``kernel.threads-max = 15691``kernel.timer_migration = 1``kernel.traceoff_on_warning = 0``kernel.unknown_nmi_panic = 0``kernel.usermodehelper.bset = 4294967295 31``kernel.usermodehelper.inheritable = 4294967295 31``kernel.version = #1 SMP Fri Apr 20 16:44:24 UTC 2018``kernel.watchdog = 1``kernel.watchdog_cpumask = 0-127``kernel.watchdog_thresh = 10``kernel.yama.ptrace_scope = 0``net.core.bpf_jit_enable = 0``net.core.busy_poll = 0``net.core.busy_read = 0``net.core.default_qdisc = pfifo_fast``net.core.dev_weight = 64``net.core.dev_weight_rx_bias = 1``net.core.dev_weight_tx_bias = 1``net.core.message_burst = 10``net.core.message_cost = 5``net.core.netdev_budget = 300``net.core.netdev_max_backlog = 1000 #网络设备监听队列的最大长度(此值决定了全局并发能力,但不可大过65535,建议值10000)``net.core.netdev_rss_key = 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00``net.core.netdev_tstamp_prequeue = 1 #网络设备预置队列序号,意味着从指定值开始顺延序列化``net.core.optmem_max = 20480 #每个套接字所允许的最大缓冲区的大小``net.core.rmem_default = 212992 #网络协议栈默认接收内存``net.core.rmem_max = 212992 #网络协议栈最大接收内存``net.core.rps_sock_flow_entries = 0``net.core.somaxconn = 128 #定义了系统中每一个端口最大的监听队列长度,这是个全局的参数 建议值1280``net.core.warnings = 1``net.core.wmem_default = 212992 #网络协议栈默认发送内存``net.core.wmem_max = 212992 #网络协议栈最大发送内存``net.core.xfrm_acq_expires = 30``net.core.xfrm_aevent_etime = 10``net.core.xfrm_aevent_rseqth = 2``net.core.xfrm_larval_drop = 1``net.ipv4.cipso_cache_bucket_size = 10``net.ipv4.cipso_cache_enable = 1``net.ipv4.cipso_rbm_optfmt = 0``net.ipv4.cipso_rbm_strictvalid = 1``net.ipv4.conf.all.accept_local = 0 #是否允许所有接口接收从本机IP地址上发送给本机的数据包``net.ipv4.conf.all.accept_redirects = 1 #是否接收重写过的数据包(用作路由器时默认值为0)``net.ipv4.conf.all.accept_source_route = 0 #是否接收无源路由的数据包``net.ipv4.conf.all.arp_accept = 0 #默认对不在ARP表中的IP地址发出的APR包的处理方式:0不在ARP表中创建对应IP地址的表项;1在ARP表中创建对应IP地址的表项``net.ipv4.conf.all.arp_announce = 0 #对网络接口上,本地IP地址的发出的,ARP回应,作出相应级别的限制: 确定不同程度的限制,宣布对来自本地源IP地址发出Arp请求的接口``#0:在任意网络接口(eth0,eth1,lo)上的任何本地地址``#1:尽量避免不在该网络接口子网段的本地地址做出arp回应. 当发起ARP请求的源IP地址是被设置应该经由路由达到此网络接口的时候很有用.此时会检查来访IP是否为所有接口上的子网段内ip之一.如果改来访IP不属于各个网络接口上的子网段内,那么将采用级别2的方式来进行处理.` `#2:对查询目标使用最适当的本地地址.在此模式下将忽略这个IP数据包的源地址并尝试选择与能与该地址通信的本地地址.首要是选择所有的网络接口的子网中外出访问子网中包含该目标IP地址的本地地址. 如果没有合适的地址被发现,将选择当前的发送网络接口或其他的有可能接受到该ARP回应的网络接口来进行发送.``net.ipv4.conf.all.arp_filter = 0 # 0:内核设置每个网络接口各自应答其地址上的arp询问。这项看似会错误的设置却经常能非常有效,因为它增加了成功通讯的机会。在Linux主机上,每个IP地址是网络接口独立的,而非一个复合的接口。只有在一些特殊的设置的时候,比如负载均衡的时候会带来麻烦``#1:允许多个网络介质位于同一子网段内,每个网络界面依据是否内核指派路由该数据包经过此接口来确认是否回答ARP查询(这个实现是由来源地址确定路由的时候决定的),换句话说,允许控制使用某一块网卡(通常是第一块)回应arp询问``net.ipv4.conf.all.arp_ignore = 0 #定义对目标地址为本地IP的ARP询问不同的应答模式(LVS负载均衡时此值需要修改为2)``#0:回应任何网络接口上对任何本地IP地址的arp查询请求``#1:只回答目标IP地址是来访网络接口本地地址的ARP查询请求``#2:只回答目标IP地址是来访网络接口本地地址的ARP查询请求,且来访IP必须在该网络接口的子网段内``#3:不回应该网络界面的arp请求,而只对设置的唯一和连接地址做出回应``#8:不回应所有(本地地址)的arp查询``net.ipv4.conf.all.arp_notify = 0 #是否开启arp通知链操作:0不做任何操作,1当设备或硬件地址改变时自动产生一个arp请求``net.ipv4.conf.all.bootp_relay = 0 #是否接收源地址为0.a.b.c,目的地址不是本机的数据包,是为了支持bootp服务``net.ipv4.conf.all.disable_policy = 0 #是否禁止internet协议安全性验证``net.ipv4.conf.all.disable_xfrm = 0 #是否禁止internet协议安全性加密``net.ipv4.conf.all.force_igmp_version = 0``net.ipv4.conf.all.forwarding = 0``net.ipv4.conf.all.log_martians = 0 #是否开启并记录欺骗,源路由和重定向数据包:记录带有不允许的地址的数据报到内核日志中(如果是路由器建议值为1)``net.ipv4.conf.all.mc_forwarding = 0 #是否进行多播路由(只有内核编译有CONFIG_MROUTE并且有路由服务程序在运行该参数才有效)``net.ipv4.conf.all.medium_id = 0 #用来区分不同媒介.两个网络设备可以使用不同的值,使他们只有其中之一接收到广播包.通常,这个参数被用来配合proxy_arp实现roxy_arp的特性即是允许arp报文在两个不同的网络介质中转发.``#0:表示各个网络介质接受他们自己介质上的媒介``#-1:表示该媒介未知``net.ipv4.conf.all.promote_secondaries = 1 #主备IP地址切换控制机制(建议值1)0当接口的主IP地址被移除时,删除所有次IP地址;1当接口的主IP地址被移除时,将次IP地址提升为主IP地址``net.ipv4.conf.all.proxy_arp = 0 #是否启用arp代理功能``net.ipv4.conf.all.proxy_arp_pvlan = 0 #回应代理ARP的数据包从接收到此代理ARP请求的网络接口出去``net.ipv4.conf.all.route_localnet = 0 #是否允许外部访问localhost``net.ipv4.conf.all.rp_filter = 1 #是否开启反向路径过滤``net.ipv4.conf.all.secure_redirects = 1 #是否支持安全重定向数据包``net.ipv4.conf.all.send_redirects = 1 #是否发送重定向数据包``net.ipv4.conf.all.shared_media = 1 #发送或接收RFC1620 共享媒体重定向 会覆盖ip_secure_redirects的值``net.ipv4.conf.all.src_valid_mark = 0 #是否为所有接口上源地址有效的数据包打标记``net.ipv4.conf.all.tag = 0``net.ipv4.conf.default.accept_local = 0 #默认是否允许接收从本机IP地址上发送给本机的数据包``net.ipv4.conf.default.accept_redirects = 1 #默认是否接收重写过的数据包(建议值1)``net.ipv4.conf.default.accept_source_route = 0 #默认是否接收无源路由的数据包``net.ipv4.conf.default.arp_accept = 0``net.ipv4.conf.default.arp_announce = 0``net.ipv4.conf.default.arp_filter = 0``net.ipv4.conf.default.arp_ignore = 0 #LVS负载均衡需要修改此值为1``net.ipv4.conf.default.arp_notify = 0``net.ipv4.conf.default.bootp_relay = 0``net.ipv4.conf.default.disable_policy = 0``net.ipv4.conf.default.disable_xfrm = 0``net.ipv4.conf.default.force_igmp_version = 0``net.ipv4.conf.default.forwarding = 0``net.ipv4.conf.default.log_martians = 0 #默认是否开启并记录欺骗,源路由和重定向数据包(如果是路由器建议值为1)``net.ipv4.conf.default.mc_forwarding = 0``net.ipv4.conf.default.medium_id = 0``net.ipv4.conf.default.promote_secondaries = 1``net.ipv4.conf.default.proxy_arp = 0``net.ipv4.conf.default.proxy_arp_pvlan = 0``net.ipv4.conf.default.route_localnet = 0``net.ipv4.conf.default.rp_filter = 1 #默认是否开启反向路径过滤``net.ipv4.conf.default.secure_redirects = 1 #默认是否支持安全重定向数据包``net.ipv4.conf.default.send_redirects = 1 #默认是否发送重定向数据包``net.ipv4.conf.default.shared_media = 1``net.ipv4.conf.default.src_valid_mark = 0 #默认是否为源地址有效的数据包打标记``net.ipv4.conf.default.tag = 0``net.ipv4.conf.eth0.accept_local = 0``net.ipv4.conf.eth0.accept_redirects = 1``net.ipv4.conf.eth0.accept_source_route = 0``net.ipv4.conf.eth0.arp_accept = 0``net.ipv4.conf.eth0.arp_announce = 0``net.ipv4.conf.eth0.arp_filter = 0``net.ipv4.conf.eth0.arp_ignore = 0``net.ipv4.conf.eth0.arp_notify = 0``net.ipv4.conf.eth0.bootp_relay = 0``net.ipv4.conf.eth0.disable_policy = 0``net.ipv4.conf.eth0.disable_xfrm = 0``net.ipv4.conf.eth0.force_igmp_version = 0``net.ipv4.conf.eth0.forwarding = 0``net.ipv4.conf.eth0.log_martians = 0``net.ipv4.conf.eth0.mc_forwarding = 0``net.ipv4.conf.eth0.medium_id = 0``net.ipv4.conf.eth0.promote_secondaries = 1``net.ipv4.conf.eth0.proxy_arp = 0``net.ipv4.conf.eth0.proxy_arp_pvlan = 0``net.ipv4.conf.eth0.route_localnet = 0``net.ipv4.conf.eth0.rp_filter = 1``net.ipv4.conf.eth0.secure_redirects = 1``net.ipv4.conf.eth0.send_redirects = 1``net.ipv4.conf.eth0.shared_media = 1``net.ipv4.conf.eth0.src_valid_mark = 0``net.ipv4.conf.eth0.tag = 0``net.ipv4.conf.lo.accept_local = 0``net.ipv4.conf.lo.accept_redirects = 1``net.ipv4.conf.lo.accept_source_route = 1``net.ipv4.conf.lo.arp_accept = 0``net.ipv4.conf.lo.arp_announce = 0``net.ipv4.conf.lo.arp_filter = 0``net.ipv4.conf.lo.arp_ignore = 0``net.ipv4.conf.lo.arp_notify = 0``net.ipv4.conf.lo.bootp_relay = 0``net.ipv4.conf.lo.disable_policy = 1``net.ipv4.conf.lo.disable_xfrm = 1``net.ipv4.conf.lo.force_igmp_version = 0``net.ipv4.conf.lo.forwarding = 0``net.ipv4.conf.lo.log_martians = 0``net.ipv4.conf.lo.mc_forwarding = 0``net.ipv4.conf.lo.medium_id = 0``net.ipv4.conf.lo.promote_secondaries = 0``net.ipv4.conf.lo.proxy_arp = 0``net.ipv4.conf.lo.proxy_arp_pvlan = 0``net.ipv4.conf.lo.route_localnet = 0``net.ipv4.conf.lo.rp_filter = 0``net.ipv4.conf.lo.secure_redirects = 1``net.ipv4.conf.lo.send_redirects = 1``net.ipv4.conf.lo.shared_media = 1``net.ipv4.conf.lo.src_valid_mark = 0``net.ipv4.conf.lo.tag = 0``net.ipv4.fwmark_reflect = 0``net.ipv4.icmp_echo_ignore_all = 0``net.ipv4.icmp_echo_ignore_broadcasts = 1``net.ipv4.icmp_errors_use_inbound_ifaddr = 0``net.ipv4.icmp_ignore_bogus_error_responses = 1``net.ipv4.icmp_msgs_burst = 50``net.ipv4.icmp_msgs_per_sec = 1000``net.ipv4.icmp_ratelimit = 1000``net.ipv4.icmp_ratemask = 6168``net.ipv4.igmp_max_memberships = 20``net.ipv4.igmp_max_msf = 10``net.ipv4.igmp_qrv = 2``net.ipv4.inet_peer_maxttl = 600``net.ipv4.inet_peer_minttl = 120``net.ipv4.inet_peer_threshold = 65664``net.ipv4.ip_default_ttl = 64 #定义数据报的生存周期:最多经过多少路由器后数据将被丢弃``net.ipv4.ip_dynaddr = 0``net.ipv4.ip_early_demux = 1``net.ipv4.ip_forward = 0 #是否启用IP转发(如果做路由需要开启此项)``net.ipv4.ip_forward_use_pmtu = 0 #是否支持巨型帧转发(使用LVS做负载均衡器时建议此值为1)``net.ipv4.ip_local_port_range = 32768 60999 #服务器端可用端口范围(建议值 1024 65535)``net.ipv4.ip_local_reserved_ports = #系统预留端口列表:可以防止并发时占用服务端口``net.ipv4.ip_no_pmtu_disc = 0 #是否关闭路径MTU探测功能``net.ipv4.ip_nonlocal_bind = 0``net.ipv4.ipfrag_high_thresh = 4194304``net.ipv4.ipfrag_low_thresh = 3145728``net.ipv4.ipfrag_max_dist = 64``net.ipv4.ipfrag_secret_interval = 600``net.ipv4.ipfrag_time = 30``net.ipv4.neigh.default.anycast_delay = 100``net.ipv4.neigh.default.app_solicit = 0``net.ipv4.neigh.default.base_reachable_time_ms = 30000``net.ipv4.neigh.default.delay_first_probe_time = 5``net.ipv4.neigh.default.gc_interval = 30``net.ipv4.neigh.default.gc_stale_time = 60``net.ipv4.neigh.default.gc_thresh1 = 128``net.ipv4.neigh.default.gc_thresh2 = 512``net.ipv4.neigh.default.gc_thresh3 = 1024``net.ipv4.neigh.default.locktime = 100``net.ipv4.neigh.default.mcast_solicit = 3``net.ipv4.neigh.default.proxy_delay = 80``net.ipv4.neigh.default.proxy_qlen = 64``net.ipv4.neigh.default.retrans_time_ms = 1000``net.ipv4.neigh.default.ucast_solicit = 3``net.ipv4.neigh.default.unres_qlen = 31``net.ipv4.neigh.default.unres_qlen_bytes = 65536``net.ipv4.neigh.eth0.anycast_delay = 100``net.ipv4.neigh.eth0.app_solicit = 0``net.ipv4.neigh.eth0.base_reachable_time_ms = 30000``net.ipv4.neigh.eth0.delay_first_probe_time = 5``net.ipv4.neigh.eth0.gc_stale_time = 60``net.ipv4.neigh.eth0.locktime = 100``net.ipv4.neigh.eth0.mcast_solicit = 3``net.ipv4.neigh.eth0.proxy_delay = 80``net.ipv4.neigh.eth0.proxy_qlen = 64``net.ipv4.neigh.eth0.retrans_time_ms = 1000``net.ipv4.neigh.eth0.ucast_solicit = 3``net.ipv4.neigh.eth0.unres_qlen = 31``net.ipv4.neigh.eth0.unres_qlen_bytes = 65536``net.ipv4.neigh.lo.anycast_delay = 100``net.ipv4.neigh.lo.app_solicit = 0``net.ipv4.neigh.lo.base_reachable_time_ms = 30000``net.ipv4.neigh.lo.delay_first_probe_time = 5``net.ipv4.neigh.lo.gc_stale_time = 60``net.ipv4.neigh.lo.locktime = 100``net.ipv4.neigh.lo.mcast_solicit = 3``net.ipv4.neigh.lo.proxy_delay = 80``net.ipv4.neigh.lo.proxy_qlen = 64``net.ipv4.neigh.lo.retrans_time_ms = 1000``net.ipv4.neigh.lo.ucast_solicit = 3``net.ipv4.neigh.lo.unres_qlen = 31``net.ipv4.neigh.lo.unres_qlen_bytes = 65536``net.ipv4.ping_group_range = 1 0``net.ipv4.route.error_burst = 5000``net.ipv4.route.error_cost = 1000``net.ipv4.route.gc_elasticity = 8``net.ipv4.route.gc_interval = 60``net.ipv4.route.gc_min_interval = 0``net.ipv4.route.gc_min_interval_ms = 500``net.ipv4.route.gc_thresh = -1``net.ipv4.route.gc_timeout = 300``net.ipv4.route.max_size = 2147483647``net.ipv4.route.min_adv_mss = 256``net.ipv4.route.min_pmtu = 552``net.ipv4.route.mtu_expires = 600``net.ipv4.route.redirect_load = 20``net.ipv4.route.redirect_number = 9``net.ipv4.route.redirect_silence = 20480``net.ipv4.tcp_abort_on_overflow = 0``net.ipv4.tcp_adv_win_scale = 1``net.ipv4.tcp_allowed_congestion_control = cubic reno #IPV4 TCP允许的拥塞控制算法``net.ipv4.tcp_app_win = 31``net.ipv4.tcp_autocorking = 1``net.ipv4.tcp_available_congestion_control = cubic reno #内核中可用的TCP拥塞控制算法``net.ipv4.tcp_base_mss = 512``net.ipv4.tcp_challenge_ack_limit = 1000``net.ipv4.tcp_congestion_control = cubic #当前正在使用的TCP拥塞控制算法``net.ipv4.tcp_dsack = 1 #是否允许TCP发送“两个完全相同”的SACK``net.ipv4.tcp_early_retrans = 3``net.ipv4.tcp_ecn = 2``net.ipv4.tcp_fack = 1 #启用转发应答(Forward Acknowledgment 建议值1),可以进行有选择应答(SACK)从而减少拥塞情况的发生``net.ipv4.tcp_fastopen = 0``net.ipv4.tcp_fastopen_key = 00000000-00000000-00000000-00000000``net.ipv4.tcp_fin_timeout = 60 #server端主动发起断开连接后保持在FIN-WAIT-2状态的时间(建议30s)``net.ipv4.tcp_frto = 2``net.ipv4.tcp_invalid_ratelimit = 500 #无效数据包发送速率时间限制(单位:毫秒)``net.ipv4.tcp_keepalive_intvl = 75 #探测消息未获得响应时,重发该消息的间隔时间(单位:秒 建议值 30)``net.ipv4.tcp_keepalive_probes = 9 #在认定TCP连接失效之前,最多发送多少个keepalive探测消息(建议值3)``net.ipv4.tcp_keepalive_time = 7200 #TCP发送keepalive探测消息的间隔时间(秒),用于确认TCP连接是否有效(建议值1800)``net.ipv4.tcp_limit_output_bytes = 262144 #单个套接字限制最大输出字节数(建议保持默认256KB)``net.ipv4.tcp_low_latency = 0 #是否允许TCP/IP栈适应在高吞吐量情况下低延时的情况(此选项建议为0)``net.ipv4.tcp_max_orphans = 8192 #允许保留的僵尸套接字的最大值(此值设置过大会给CC×××带来便利)``net.ipv4.tcp_max_ssthresh = 0``net.ipv4.tcp_max_syn_backlog = 128 #SYN队列的长度,增大其值可以增大服务器接收并发的能力 (建议值1280)``net.ipv4.tcp_max_tw_buckets = 8192 #针对TIME-WAIT数量配置其上限(此值配置太大很容易给CC×××提供便利)``net.ipv4.tcp_mem = 45918 61225 91836 #TCP协议栈缓冲区的最小值、压力值、最大值;高于最大值,TCP拒绝分配socket``net.ipv4.tcp_min_tso_segs = 2``net.ipv4.tcp_moderate_rcvbuf = 1 #是否开启TCP缓冲内存自动调整功能``net.ipv4.tcp_mtu_probing = 0 #是否开启tcp层路径mtu发现``net.ipv4.tcp_no_metrics_save = 0 #是否将LAST_ACK状态保存各种连接信息到路由缓存中:方便下次连接时快速恢复现场``net.ipv4.tcp_notsent_lowat = -1``net.ipv4.tcp_orphan_retries = 0 #僵尸套接字的重试次数``net.ipv4.tcp_reordering = 3``net.ipv4.tcp_retrans_collapse = 1``net.ipv4.tcp_retries1 = 3 #放弃回应一个TCP连接请求前进行重试的次数``net.ipv4.tcp_retries2 = 15 #放弃一个已经建立的TCP连接前进行重试的次数``net.ipv4.tcp_rfc1337 = 0``net.ipv4.tcp_rmem = 4096 87380 6291456 #TCP套接字接收缓冲区的最小值、压力值、最大值;高于最大值,TCP拒绝分配socket``net.ipv4.tcp_sack = 1 #是否启用有选择的应答(Selective Acknowledgment 建议值1),使TCP只重新发送交互过程中丢失的包,不用发送后续所有的包,而且提供相应机制使接收方能告诉发送方哪些数据丢失,哪些数据重发了,哪些数据已经提前收到了。如此大大提高了客户端与服务器端数据交互的效率``net.ipv4.tcp_slow_start_after_idle = 1 #拥塞窗口在经过一段时间空闲后是否需要重新初始化(建议值1)``net.ipv4.tcp_stdurg = 0``net.ipv4.tcp_syn_retries = 6 #server主动连接client时发送syn的重试次数(没有特殊需求,建议保持此值)``net.ipv4.tcp_synack_retries = 5 #server应答client的synack的重试次数``net.ipv4.tcp_syncookies = 1 #是否打开SYN Cookie功能(启用此功能可以防止部分SYN×××)``net.ipv4.tcp_thin_dupack = 0``net.ipv4.tcp_thin_linear_timeouts = 0``net.ipv4.tcp_timestamps = 1 #是否启用TCP时间戳(会在TCP包头增加12个字节),增加了报文大小,但实现了更好的TCP性能``net.ipv4.tcp_tso_win_divisor = 3``net.ipv4.tcp_tw_recycle = 0 #是否快速回收TIME-WAIT套接字,不建议快速回收,但可以reuse,否则NAT环境会有问题``net.ipv4.tcp_tw_reuse = 0 #是否将处于TIME-WAIT状态的socket(TIME-WAIT的端口)重新用于TCP连接``net.ipv4.tcp_window_scaling = 1 #要支持超过64KB的TCP窗口,必须启用该值,TCP连接双方都启用时才生效``net.ipv4.tcp_wmem = 4096 16384 4194304 #TCP套接字发送缓冲区的最小值、压力值、最大值;高于最大值,TCP拒绝分配socket``net.ipv4.tcp_workaround_signed_windows = 0``net.ipv4.udp_mem = 47073 62766 94146``net.ipv4.udp_rmem_min = 4096``net.ipv4.udp_wmem_min = 4096``net.ipv4.xfrm4_gc_thresh = 32768``net.ipv6.anycast_src_echo_reply = 0``net.ipv6.bindv6only = 0``net.ipv6.conf.all.accept_dad = 0``net.ipv6.conf.all.accept_ra = 1``net.ipv6.conf.all.accept_ra_defrtr = 1``net.ipv6.conf.all.accept_ra_pinfo = 1``net.ipv6.conf.all.accept_ra_rt_info_max_plen = 0``net.ipv6.conf.all.accept_ra_rtr_pref = 1``net.ipv6.conf.all.accept_redirects = 1``net.ipv6.conf.all.accept_source_route = 0``net.ipv6.conf.all.autoconf = 1``net.ipv6.conf.all.dad_transmits = 1``net.ipv6.conf.all.disable_ipv6 = 0 #是否在所有的网络接口上禁用IPv6(XenServer虚机禁用无效)``net.ipv6.conf.all.force_mld_version = 0``net.ipv6.conf.all.force_tllao = 0``net.ipv6.conf.all.forwarding = 0``net.ipv6.conf.all.hop_limit = 64``net.ipv6.conf.all.max_addresses = 16``net.ipv6.conf.all.max_desync_factor = 600``net.ipv6.conf.all.mc_forwarding = 0``net.ipv6.conf.all.mldv1_unsolicited_report_interval = 10000``net.ipv6.conf.all.mldv2_unsolicited_report_interval = 1000``net.ipv6.conf.all.mtu = 1280``net.ipv6.conf.all.ndisc_notify = 0``net.ipv6.conf.all.optimistic_dad = 0``net.ipv6.conf.all.proxy_ndp = 0``net.ipv6.conf.all.regen_max_retry = 3``net.ipv6.conf.all.router_probe_interval = 60``net.ipv6.conf.all.router_solicitation_delay = 1``net.ipv6.conf.all.router_solicitation_interval = 4``net.ipv6.conf.all.router_solicitations = 3``net.ipv6.conf.all.temp_prefered_lft = 86400``net.ipv6.conf.all.temp_valid_lft = 604800``net.ipv6.conf.all.use_optimistic = 0``net.ipv6.conf.all.use_tempaddr = 0``net.ipv6.conf.default.accept_dad = 1``net.ipv6.conf.default.accept_ra = 1``net.ipv6.conf.default.accept_ra_defrtr = 1``net.ipv6.conf.default.accept_ra_pinfo = 1``net.ipv6.conf.default.accept_ra_rt_info_max_plen = 0``net.ipv6.conf.default.accept_ra_rtr_pref = 1``net.ipv6.conf.default.accept_redirects = 1``net.ipv6.conf.default.accept_source_route = 0``net.ipv6.conf.default.autoconf = 1``net.ipv6.conf.default.dad_transmits = 1``net.ipv6.conf.default.disable_ipv6 = 0 #默认是否禁用IPv6(用不到IPv6时建议禁用-设定此值为1 (XenServer虚机禁用无效))``net.ipv6.conf.default.force_mld_version = 0``net.ipv6.conf.default.force_tllao = 0``net.ipv6.conf.default.forwarding = 0``net.ipv6.conf.default.hop_limit = 64``net.ipv6.conf.default.max_addresses = 16``net.ipv6.conf.default.max_desync_factor = 600``net.ipv6.conf.default.mc_forwarding = 0``net.ipv6.conf.default.mldv1_unsolicited_report_interval = 10000``net.ipv6.conf.default.mldv2_unsolicited_report_interval = 1000``net.ipv6.conf.default.mtu = 1280``net.ipv6.conf.default.ndisc_notify = 0``net.ipv6.conf.default.optimistic_dad = 0``net.ipv6.conf.default.proxy_ndp = 0``net.ipv6.conf.default.regen_max_retry = 3``net.ipv6.conf.default.router_probe_interval = 60``net.ipv6.conf.default.router_solicitation_delay = 1``net.ipv6.conf.default.router_solicitation_interval = 4``net.ipv6.conf.default.router_solicitations = 3``net.ipv6.conf.default.temp_prefered_lft = 86400``net.ipv6.conf.default.temp_valid_lft = 604800``net.ipv6.conf.default.use_optimistic = 0``net.ipv6.conf.default.use_tempaddr = 0``net.ipv6.conf.eth0.accept_dad = 1``net.ipv6.conf.eth0.accept_ra = 1``net.ipv6.conf.eth0.accept_ra_defrtr = 1``net.ipv6.conf.eth0.accept_ra_pinfo = 1``net.ipv6.conf.eth0.accept_ra_rt_info_max_plen = 0``net.ipv6.conf.eth0.accept_ra_rtr_pref = 1``net.ipv6.conf.eth0.accept_redirects = 1``net.ipv6.conf.eth0.accept_source_route = 0``net.ipv6.conf.eth0.autoconf = 1``net.ipv6.conf.eth0.dad_transmits = 1``net.ipv6.conf.eth0.disable_ipv6 = 0``net.ipv6.conf.eth0.force_mld_version = 0``net.ipv6.conf.eth0.force_tllao = 0``net.ipv6.conf.eth0.forwarding = 0``net.ipv6.conf.eth0.hop_limit = 64``net.ipv6.conf.eth0.max_addresses = 16``net.ipv6.conf.eth0.max_desync_factor = 600``net.ipv6.conf.eth0.mc_forwarding = 0``net.ipv6.conf.eth0.mldv1_unsolicited_report_interval = 10000``net.ipv6.conf.eth0.mldv2_unsolicited_report_interval = 1000``net.ipv6.conf.eth0.mtu = 1500``net.ipv6.conf.eth0.ndisc_notify = 0``net.ipv6.conf.eth0.optimistic_dad = 0``net.ipv6.conf.eth0.proxy_ndp = 0``net.ipv6.conf.eth0.regen_max_retry = 3``net.ipv6.conf.eth0.router_probe_interval = 60``net.ipv6.conf.eth0.router_solicitation_delay = 1``net.ipv6.conf.eth0.router_solicitation_interval = 4``net.ipv6.conf.eth0.router_solicitations = 3``net.ipv6.conf.eth0.temp_prefered_lft = 86400``net.ipv6.conf.eth0.temp_valid_lft = 604800``net.ipv6.conf.eth0.use_optimistic = 0``net.ipv6.conf.eth0.use_tempaddr = 0``net.ipv6.conf.lo.accept_dad = -1``net.ipv6.conf.lo.accept_ra = 1``net.ipv6.conf.lo.accept_ra_defrtr = 1``net.ipv6.conf.lo.accept_ra_pinfo = 1``net.ipv6.conf.lo.accept_ra_rt_info_max_plen = 0``net.ipv6.conf.lo.accept_ra_rtr_pref = 1``net.ipv6.conf.lo.accept_redirects = 1``net.ipv6.conf.lo.accept_source_route = 0``net.ipv6.conf.lo.autoconf = 1``net.ipv6.conf.lo.dad_transmits = 1``net.ipv6.conf.lo.disable_ipv6 = 0 #是否在lo接口上禁用IPv6 (XenServer虚机禁用无效)``net.ipv6.conf.lo.force_mld_version = 0``net.ipv6.conf.lo.force_tllao = 0``net.ipv6.conf.lo.forwarding = 0``net.ipv6.conf.lo.hop_limit = 64``net.ipv6.conf.lo.max_addresses = 16``net.ipv6.conf.lo.max_desync_factor = 600``net.ipv6.conf.lo.mc_forwarding = 0``net.ipv6.conf.lo.mldv1_unsolicited_report_interval = 10000``net.ipv6.conf.lo.mldv2_unsolicited_report_interval = 1000``net.ipv6.conf.lo.mtu = 65536``net.ipv6.conf.lo.ndisc_notify = 0``net.ipv6.conf.lo.optimistic_dad = 0``net.ipv6.conf.lo.proxy_ndp = 0``net.ipv6.conf.lo.regen_max_retry = 3``net.ipv6.conf.lo.router_probe_interval = 60``net.ipv6.conf.lo.router_solicitation_delay = 1``net.ipv6.conf.lo.router_solicitation_interval = 4``net.ipv6.conf.lo.router_solicitations = 3``net.ipv6.conf.lo.temp_prefered_lft = 86400``net.ipv6.conf.lo.temp_valid_lft = 604800``net.ipv6.conf.lo.use_optimistic = 0``net.ipv6.conf.lo.use_tempaddr = -1``net.ipv6.fwmark_reflect = 0``net.ipv6.icmp.ratelimit = 1000``net.ipv6.idgen_delay = 1``net.ipv6.idgen_retries = 3``net.ipv6.ip6frag_high_thresh = 4194304``net.ipv6.ip6frag_low_thresh = 3145728``net.ipv6.ip6frag_secret_interval = 600``net.ipv6.ip6frag_time = 60``net.ipv6.ip_nonlocal_bind = 0``net.ipv6.mld_max_msf = 64``net.ipv6.mld_qrv = 2``net.ipv6.neigh.default.anycast_delay = 100``net.ipv6.neigh.default.app_solicit = 0``net.ipv6.neigh.default.base_reachable_time_ms = 30000``net.ipv6.neigh.default.delay_first_probe_time = 5``net.ipv6.neigh.default.gc_interval = 30``net.ipv6.neigh.default.gc_stale_time = 60``net.ipv6.neigh.default.gc_thresh1 = 128``net.ipv6.neigh.default.gc_thresh2 = 512``net.ipv6.neigh.default.gc_thresh3 = 1024``net.ipv6.neigh.default.locktime = 0``net.ipv6.neigh.default.mcast_solicit = 3``net.ipv6.neigh.default.proxy_delay = 80``net.ipv6.neigh.default.proxy_qlen = 64``net.ipv6.neigh.default.retrans_time_ms = 1000``net.ipv6.neigh.default.ucast_solicit = 3``net.ipv6.neigh.default.unres_qlen = 31``net.ipv6.neigh.default.unres_qlen_bytes = 65536``net.ipv6.neigh.eth0.anycast_delay = 100``net.ipv6.neigh.eth0.app_solicit = 0``net.ipv6.neigh.eth0.base_reachable_time_ms = 30000``net.ipv6.neigh.eth0.delay_first_probe_time = 5``net.ipv6.neigh.eth0.gc_stale_time = 60``net.ipv6.neigh.eth0.locktime = 0``net.ipv6.neigh.eth0.mcast_solicit = 3``net.ipv6.neigh.eth0.proxy_delay = 80``net.ipv6.neigh.eth0.proxy_qlen = 64``net.ipv6.neigh.eth0.retrans_time_ms = 1000``net.ipv6.neigh.eth0.ucast_solicit = 3``net.ipv6.neigh.eth0.unres_qlen = 31``net.ipv6.neigh.eth0.unres_qlen_bytes = 65536``net.ipv6.neigh.lo.anycast_delay = 100``net.ipv6.neigh.lo.app_solicit = 0``net.ipv6.neigh.lo.base_reachable_time_ms = 30000``net.ipv6.neigh.lo.delay_first_probe_time = 5``net.ipv6.neigh.lo.gc_stale_time = 60``net.ipv6.neigh.lo.locktime = 0``net.ipv6.neigh.lo.mcast_solicit = 3``net.ipv6.neigh.lo.proxy_delay = 80``net.ipv6.neigh.lo.proxy_qlen = 64``net.ipv6.neigh.lo.retrans_time_ms = 1000``net.ipv6.neigh.lo.ucast_solicit = 3``net.ipv6.neigh.lo.unres_qlen = 31``net.ipv6.neigh.lo.unres_qlen_bytes = 65536``net.ipv6.route.gc_elasticity = 9``net.ipv6.route.gc_interval = 30``net.ipv6.route.gc_min_interval = 0``net.ipv6.route.gc_min_interval_ms = 500``net.ipv6.route.gc_thresh = 1024``net.ipv6.route.gc_timeout = 60``net.ipv6.route.max_size = 16384``net.ipv6.route.min_adv_mss = 1220``net.ipv6.route.mtu_expires = 600``net.ipv6.xfrm6_gc_thresh = 32768``net.netfilter.nf_conntrack_acct = 0``net.netfilter.nf_conntrack_buckets = 16384``net.netfilter.nf_conntrack_checksum = 1``net.netfilter.nf_conntrack_count = 1``net.netfilter.nf_conntrack_dccp_loose = 1``net.netfilter.nf_conntrack_dccp_timeout_closereq = 64``net.netfilter.nf_conntrack_dccp_timeout_closing = 64``net.netfilter.nf_conntrack_dccp_timeout_open = 43200``net.netfilter.nf_conntrack_dccp_timeout_partopen = 480``net.netfilter.nf_conntrack_dccp_timeout_request = 240``net.netfilter.nf_conntrack_dccp_timeout_respond = 480``net.netfilter.nf_conntrack_dccp_timeout_timewait = 240``net.netfilter.nf_conntrack_events = 1``net.netfilter.nf_conntrack_events_retry_timeout = 15``net.netfilter.nf_conntrack_expect_max = 256``net.netfilter.nf_conntrack_frag6_high_thresh = 4194304``net.netfilter.nf_conntrack_frag6_low_thresh = 3145728``net.netfilter.nf_conntrack_frag6_timeout = 60``net.netfilter.nf_conntrack_generic_timeout = 600``net.netfilter.nf_conntrack_helper = 1``net.netfilter.nf_conntrack_icmp_timeout = 30``net.netfilter.nf_conntrack_icmpv6_timeout = 30``net.netfilter.nf_conntrack_log_invalid = 0``net.netfilter.nf_conntrack_max = 65536``net.netfilter.nf_conntrack_sctp_timeout_closed = 10``net.netfilter.nf_conntrack_sctp_timeout_cookie_echoed = 3``net.netfilter.nf_conntrack_sctp_timeout_cookie_wait = 3``net.netfilter.nf_conntrack_sctp_timeout_established = 432000``net.netfilter.nf_conntrack_sctp_timeout_heartbeat_acked = 210``net.netfilter.nf_conntrack_sctp_timeout_heartbeat_sent = 30``net.netfilter.nf_conntrack_sctp_timeout_shutdown_ack_sent = 3``net.netfilter.nf_conntrack_sctp_timeout_shutdown_recd = 0``net.netfilter.nf_conntrack_sctp_timeout_shutdown_sent = 0``net.netfilter.nf_conntrack_tcp_be_liberal = 0``net.netfilter.nf_conntrack_tcp_loose = 1``net.netfilter.nf_conntrack_tcp_max_retrans = 3``net.netfilter.nf_conntrack_tcp_timeout_close = 10``net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60``net.netfilter.nf_conntrack_tcp_timeout_established = 432000``net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120``net.netfilter.nf_conntrack_tcp_timeout_last_ack = 30``net.netfilter.nf_conntrack_tcp_timeout_max_retrans = 300``net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 60``net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 120``net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120``net.netfilter.nf_conntrack_tcp_timeout_unacknowledged = 300``net.netfilter.nf_conntrack_timestamp = 0``net.netfilter.nf_conntrack_udp_timeout = 30``net.netfilter.nf_conntrack_udp_timeout_stream = 180``net.netfilter.nf_log.0 = NONE``net.netfilter.nf_log.1 = NONE``net.netfilter.nf_log.10 = NONE``net.netfilter.nf_log.11 = NONE``net.netfilter.nf_log.12 = NONE``net.netfilter.nf_log.2 = NONE``net.netfilter.nf_log.3 = NONE``net.netfilter.nf_log.4 = NONE``net.netfilter.nf_log.5 = NONE``net.netfilter.nf_log.6 = NONE``net.netfilter.nf_log.7 = NONE``net.netfilter.nf_log.8 = NONE``net.netfilter.nf_log.9 = NONE``net.netfilter.nf_log_all_netns = 0``net.nf_conntrack_max = 65536``net.unix.max_dgram_qlen = 512``user.max_ipc_namespaces = 7845``user.max_mnt_namespaces = 7845``user.max_net_namespaces = 7845``user.max_pid_namespaces = 7845``user.max_user_namespaces = 0``user.max_uts_namespaces = 7845``vm.admin_reserve_kbytes = 8192 #始终会预留给管理员的内存``vm.block_dump = 0``vm.dirty_background_bytes = 0``vm.dirty_background_ratio = 10 #当系统脏页的比例或者所占内存数量超过 dirty_background_ratio(百分数)阈值时,启动相关内核线程(pdflush/flush/kdmflush)开始将脏页写入磁盘``vm.dirty_bytes = 0``vm.dirty_expire_centisecs = 3000 #声明Linux内核写缓冲区里面的数据多"旧"了之后,pdflush/flush/kdmflush进程就开始考虑写到磁盘中去``vm.dirty_ratio = 30 #当系统pagecache的脏页达到系统内存 dirty_ratio(百分数)阈值时,系统就会阻塞新的写请求,直到脏页被回写到磁盘``vm.dirty_writeback_centisecs = 500 #内核线程(pdflush/flush/kdmflush)多久唤醒一次来检查是否需要将cache中的数据写入磁盘,单位1/100秒``vm.drop_caches = 0 #释放cache,该参数每修改一次,触发一次释放操作(手动释放caches时就需要改变此值)``vm.extfrag_threshold = 500``vm.hugepages_treat_as_movable = 0``vm.hugetlb_shm_group = 0``vm.laptop_mode = 0``vm.legacy_va_layout = 0``vm.lowmem_reserve_ratio = 256 256 32``vm.max_map_count = 65530``vm.memory_failure_early_kill = 0``vm.memory_failure_recovery = 1``vm.min_free_kbytes = 45056 #系统内核保留内存的最低值``vm.min_slab_ratio = 5``vm.min_unmapped_ratio = 1``vm.mmap_min_addr = 4096``vm.mmap_rnd_bits = 28``vm.mmap_rnd_compat_bits = 8``vm.nr_hugepages = 0 #控制内存是否可以使用大页面``vm.nr_hugepages_mempolicy = 0``vm.nr_overcommit_hugepages = 0``vm.nr_pdflush_threads = 0``vm.numa_zonelist_order = default``vm.oom_dump_tasks = 1 #OOM信息打印(建议值1 能够在发生OOM后查看当时情景)``vm.oom_kill_allocating_task = 0 #控制是否杀死触发OOM的进程(建议值0 OOM发生时内核自动kill内存占用最多的进程)``vm.overcommit_kbytes = 0``vm.overcommit_memory = 0 #控制是否允许超额申请内存``vm.overcommit_ratio = 50 #允许超额申请物理内容+此百分比的swap内存(只有当vm.overcommit_memory=2时此值才会生效)``vm.page-cluster = 3 #控制内核一次从SWAP中连续读取2的多少次幂内存页``vm.panic_on_oom = 0 #控制内核在OOM时是否panic(恐慌)``vm.percpu_pagelist_fraction = 0``vm.stat_interval = 1 #VM统计信息更新的时间间隔,默认值1s``vm.swappiness = 30 #控制物理内存剩余%多少时使用SWAP(建议值0,但0并非禁用SWAP,只是充分利用物理内存)``vm.user_reserve_kbytes = 60940 #始终会预留给用户空间的内存``vm.vfs_cache_pressure = 100``vm.zone_reclaim_mode = 0``   

黑客&网络安全如何学习

今天只要你给我的文章点赞,我私藏的网安学习资料一样免费共享给你们,来看看有哪些东西。

1.学习路线图

攻击和防守要学的东西也不少,具体要学的东西我都写在了上面的路线图,如果你能学完它们,你去就业和接私活完全没有问题。

2.视频教程

网上虽然也有很多的学习资源,但基本上都残缺不全的,这是我自己录的网安视频教程,上面路线图的每一个知识点,我都有配套的视频讲解。

内容涵盖了网络安全法学习、网络安全运营等保测评、渗透测试基础、漏洞详解、计算机基础知识等,都是网络安全入门必知必会的学习内容。

(都打包成一块的了,不能一一展开,总共300多集)

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

3.技术文档和电子书

技术文档也是我自己整理的,包括我参加大型网安行动、CTF和挖SRC漏洞的经验和技术要点,电子书也有200多本,由于内容的敏感性,我就不一一展示了。

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

4.工具包、面试题和源码

“工欲善其事必先利其器”我为大家总结出了最受欢迎的几十款款黑客工具。涉及范围主要集中在 信息收集、Android黑客工具、自动化工具、网络钓鱼等,感兴趣的同学不容错过。

还有我视频里讲的案例源码和对应的工具包,需要的话也可以拿走。

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

最后就是我这几年整理的网安方面的面试题,如果你是要找网安方面的工作,它们绝对能帮你大忙。

这些题目都是大家在面试深信服、奇安信、腾讯或者其它大厂面试时经常遇到的,如果大家有好的题目或者好的见解欢迎分享。

参考解析:深信服官网、奇安信官网、Freebuf、csdn等

内容特点:条理清晰,含图像化表示更加易懂。

内容概要:包括 内网、操作系统、协议、渗透测试、安服、漏洞、注入、XSS、CSRF、SSRF、文件上传、文件下载、文件包含、XXE、逻辑漏洞、工具、SQLmap、NMAP、BP、MSF…

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取

CSDN大礼包:《黑客&网络安全入门&进阶学习资源包》免费分享

  • 15
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值