Sysctl 配置优化:解决 VPN 连接影响远程桌面问题
Sysctl 配置优化:解决 VPN 连接影响远程桌面问题
以下 Sysctl 配置可能会导致 VPN 连接后无法访问远程桌面:
-
'net.ipv4.ip_forward = 1':该配置启用了 IP 转发,可能会导致网络流量被重定向到 VPN 网络,导致无法连接到远程桌面。您可以尝试将该配置注释掉或设置为 0,然后重新加载 sysctl 配置。
-
'net.ipv4.conf.all.forwarding = 1' 和 'net.ipv4.conf.default.forwarding = 1':这两个配置也启用了 IP 转发,可能会导致类似的问题。您可以尝试将这两个配置注释掉或设置为 0。
-
'net.ipv4.tcp_syncookies = 1':该配置启用了 TCP SYN Cookies,用于防止 SYN Flood 攻击。但在某些情况下,可能会导致连接问题。您可以尝试将该配置设置为 0。
请注意,在修改 Sysctl 配置之前,请确保您知道自己在做什么,并且备份原始配置文件以防止出现问题。
以下是一个示例 Sysctl 配置文件:
#!!! Do not change these settings unless you know what you are doing !!!
net.ipv4.ip_forward = 1
#net.ipv4.conf.all.forwarding = 1
#net.ipv4.conf.default.forwarding = 1
################################
#net.ipv6.conf.all.forwarding = 1
#net.ipv6.conf.default.forwarding = 1
#net.ipv6.conf.lo.forwarding = 1
################################
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
################################
net.ipv6.conf.all.accept_ra = 2
net.ipv6.conf.default.accept_ra = 2
################################
net.core.netdev_max_backlog = 1048576
net.core.netdev_budget = 50000
#fs.file-max = 51200
net.core.rmem_max = 524288000
net.core.wmem_max = 524288000
net.core.rmem_default = 10000000
net.core.wmem_default = 11059200
net.core.somaxconn = 1048576
################################
net.ipv4.icmp_echo_ignore_all = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_keepalive_intvl = 12
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_rfc1337 = 1
#net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 12
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_rmem = 30000000 30000000 67108864
net.ipv4.tcp_wmem = 30000000 30000000 67108864
net.ipv4.tcp_mem = 94500000 91500000 92700000
net.ipv4.udp_rmem_min = 16384
net.ipv4.udp_wmem_min = 16384
net.ipv4.tcp_mtu_probing = 0
##############################
net.ipv4.conf.all.arp_ignore = 2
net.ipv4.conf.default.arp_ignore = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_announce = 2
##############################
net.ipv4.tcp_autocorking = 0
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_max_syn_backlog = 1048576
net.core.default_qdisc = fq_codel
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_notsent_lowat = 81920
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_ecn = 2
net.ipv4.tcp_ecn_fallback = 1
net.ipv4.tcp_frto = 0
##############################
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0
vm.swappiness = 0
net.ipv4.ip_unprivileged_port_start = 0
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
fs.file-max = 40000500
fs.nr_open = 40000500
###########new
net.netfilter.nf_conntrack_max = 1048576
net.nf_conntrack_max = 1048576
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 30
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 30
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 15
net.netfilter.nf_conntrack_tcp_timeout_established = 60
net.ipv4.tcp_max_orphans = 131072
net.ipv4.tcp_retries2 = 5
###########
net.core.optmem_max = 10000000
net.ipv4.tcp_fack = 1
net.ipv4.tcp_retrans_collapse = 1
原文地址: https://www.cveoy.top/t/topic/qDIo 著作权归作者所有。请勿转载和采集!