Files
server-mv/sysctl.conf
T

83 lines
2.9 KiB
Plaintext

# ==============================================================
# sysctl.conf — server-mv (Oracle Cloud ARM64, 4 vCPU / 24GB RAM)
# Reescrito para remover duplicatas e organizar por categoria.
# Aplicar com: sysctl -p /etc/sysctl.d/99-server-mv.conf
#
# IMPORTANTE: este host roda o daemon "bpftune" (confirmado via
# `bpftool prog list` — tuners tcp-buffer, tcp-conn, net-buffer e
# neigh-table ativos). Esses tuners ajustam em tempo real, via eBPF,
# exatamente os mesmos knobs que costumam ir num sysctl.conf estático
# (tcp_rmem/wmem, buffers de rede, backlog de SYN, tabela de vizinhança).
# Por isso, DE PROPÓSITO, essas chaves NÃO são fixadas aqui — deixamos
# o bpftune reagir à carga real em vez de brigar com um valor fixo
# (foi essa disputa, aliás, que gerou a bagunça do sysctl.conf antigo:
# algo/alguém reescrevendo os mesmos valores repetidamente tentando
# "vencer" o bpftune). O que continua fixo abaixo é só o que o bpftune
# não gerencia: segurança, memória, filesystem, congestion control e
# timeouts diversos.
# ==============================================================
# ==============================
# 🚀 REDE — o que o bpftune NÃO gerencia
# ==============================
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_max_tw_buckets = 200000
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 60
net.ipv4.tcp_keepalive_intvl = 10
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_congestion_control = bbr
net.core.default_qdisc = fq_codel
net.ipv4.ip_local_port_range = 20000 65000
# RPS/RFS (referenciado pelo rc.local via /sys/class/net/.../rps_*)
net.core.rps_sock_flow_entries = 4096
# ==============================
# 🔒 SEGURANÇA DA PILHA TCP/IP
# ==============================
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
# Forwarding (necessário para NAT/DNAT do Docker e WireGuard)
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
# ==============================
# 💾 GERENCIAMENTO DE MEMÓRIA
# ==============================
vm.dirty_ratio = 5
vm.dirty_background_ratio = 2
vm.dirty_bytes = 134217728
vm.dirty_background_bytes = 67108864
vm.vfs_cache_pressure = 50
vm.swappiness = 5
vm.zone_reclaim_mode = 0
# ==============================
# 📂 SISTEMA DE ARQUIVOS
# ==============================
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288
fs.inotify.max_user_instances = 1024
# ==============================
# 🌎 IPv6
# ==============================
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.default.accept_ra = 0
# gc_thresh3 (tabela de vizinhança) removido: bpftune tem um
# neigh-table-tuner ativo que ajusta isso dinamicamente.
# ==============================
# 🐳 CONNTRACK (host-level; containers herdam via netns quando não sobrescrito)
# ==============================
net.netfilter.nf_conntrack_max = 262144