Ubuntu 网络提速实操指南
先确认系统与版本
cat /etc/os-releaseip addrsudo netplan apply。DNS 与解析优化
sudo apt update && sudo apt install -y dnsmasq/etc/dnsmasq.conf:
listen-address=127.0.0.1resolv-file=/etc/resolv.dnsmasq.conf/etc/resolv.dnsmasq.conf 写入:
nameserver 223.5.5.5nameserver 223.6.6.6nameserver 1.1.1.1/etc/systemd/resolved.conf,设置 DNS=127.0.0.1,然后:
sudo systemctl restart systemd-resolvedsudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.confdig example.com +short 观察响应时间与命中缓存情况。MTU 与链路调优
ip link show dev eth0sudo ip link set dev eth0 mtu 1400(示例值,按网络环境微调)mtu: 1400 后 sudo netplan apply。echo 3 | sudo tee /proc/sys/net/ipv4/tcp_fastopen/etc/sysctl.conf 加入:net.ipv4.tcp_fastopen=3 并 sudo sysctl -p。内核网络参数与安全加固
/etc/sysctl.conf(或 /etc/sysctl.d/99-network.conf):
net.ipv4.tcp_window_scaling=1net.ipv4.tcp_sack=1net.ipv4.tcp_keepalive_time=600net.ipv4.tcp_tw_reuse=1net.ipv4.tcp_max_syn_backlog=2048net.ipv4.tcp_syncookies=1sudo sysctl -p带宽测量与进一步方案
sudo apt install -y iperf3
iperf3 -siperf3 -c <server_ip> -t 20sudo apt install -y mptcpdsudo sysctl -w net.mptcp.mptcp_enabled=1ss -ant | grep MPTCP