dns解锁tcp调优一些操作

退完瓦工的2c2g40G的美西还是回到了dmit。

记录一下必要的操作。

tcp调优安装
第一步
1安装 iferf3

在Debian/Ubuntu系统上安装
apt update
apt install iperf3

防火墙放行端口 (这里以ufw为例,如果你没有开启防火墙可略过这一步)
ufw allow 5201

服务端启动iperf3
iperf3 -s

windows安装服务端iperf3
下载地址
https://github.com/ar51an/iperf3-win-builds/releases/download/3.18/iperf-3.18-win64.zip

在iperf3.exe所在路径输入cmd,回车

在弹出的窗口里输入如下并敲击回车(此处为测试下行速度30s,想调整时间修改-t后的数值即可,想测上行就去掉-R)
iperf3 -c 服务端IP -R -t 30

更具返回信息看需要调高还是调低

一般Debian/Ubuntu系统的默认参数:
net.ipv4.tcp_wmem=4096 16384 4194304
net.ipv4.tcp_rmem=4096 87380 6291456

此处我们先用公式计算出一个理论值:BDP(时延带宽积)= 带宽(bps,bit/s)× 往返时延(RTT, 秒)
例:本地600Mbps,小鸡1.5Gbps,RTT170ms,取瓶颈带宽600Mbps,可以求得——600×1000×1000×0.17=102000000bit,再除以8转换为12750000byte

打开宝塔到根目录打开\etc\sysctl.conf

修改 net.ipv4.tcp_wmem="4096 16384 你的合理值(此处先用理论值)"

 net.ipv4.tcp_rmem="4096 87380 同上"

————————————————————————————————————————————————————————————————————————————————————————————————————

dns解锁
这是dns分流解锁
alice 申请账号
找到给你的解锁dns
然后修改xui面板里面的xray设置
修改之前备份xray设置

{
"api": {

"services": [
  "HandlerService",
  "LoggerService",
  "StatsService"
],
"tag": "api"

},
"inbounds": [

{
  "listen": "127.0.0.1",
  "port": 62789,
  "protocol": "dokodemo-door",
  "settings": {
    "address": "127.0.0.1"
  },
  "tag": "api"
}

],
"outbounds": [

{
  "protocol": "freedom",
  "settings": {"domainStrategy": "UseIP"}
},
{
  "protocol": "blackhole",
  "settings": {},
  "tag": "blocked"
}

],
"policy": {

"system": {
  "statsInboundDownlink": true,
  "statsInboundUplink": true
}

},
"routing": {

"rules": [
  {
    "inboundTag": [
      "api"
    ],
    "outboundTag": "api",
    "type": "field"
  },
  {
    "ip": [
      "geoip:private"
    ],
    "outboundTag": "blocked",
    "type": "field"
  },
  {
    "outboundTag": "blocked",
    "protocol": [
      "bittorrent"
    ],
    "type": "field"
  }
]

}, "dns": {

"servers": [
  "1.1.1.1","8.8.8.8", 
  {
    "address": "***你的DNS***", 
    "port": 53,
    "domains": [
   "geosite:netflix","geosite:bahamut","geosite:hulu","geosite:hbo","geosite:disney","geosite:bbc","geosite:4chan","geosite:fox","geosite:abema","geosite:dmm","geosite:niconico","geosite:pixiv","geosite:bilibili","geosite:viu"
    ]
  }
]

},
"stats": {}
}


我的参数

net.core.default_qdisc = fq
net.core.rmem_max = 27108864
net.core.wmem_max = 27108864
net.core.somaxconn = 4096
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_wmem = 4096 16384 10108864
net.ipv4.tcp_rmem = 4096 87380 10108864
net.ipv4.tcp_adv_win_scale = -2
net.ipv4.tcp_sack = 1
net.ipv4.tcp_timestamps = 1
kernel.panic = -1
vm.swappiness = 0

本文著作权归作者 [  ] 享有,未经作者书面授权,禁止转载,封面图片来源于 [ 互联网 ] ,本文仅供个人学习、研究和欣赏使用。如有异议,请联系博主及时处理。

发表留言