VPN

VPN

Linux VPN server

Linux VPN server 端通用配置:

sysctl net.ipv4.ip_forward=1

iptables -A FORWARD -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

备注:iptables -t nat -A POSTROUTING 可以用 "-s 192.168.0.0/16", "-o eth0" 等参数指定数据包 src ip, outcoming interface 等。

优化

/etc/sysctl.conf , 启用 bbr。

net.ipv4.ip_forward=1
net.ipv4.tcp_congestion_control=bbr
net.core.default_qdisc=fq

Run sysctl -p to take effect.


Last update: 2021-11-02 03:11:16 UTC