我已经为连接到在 AWS EC2 (CentOS) 实例上运行的 OpenVPN 服务器的客户端设置了静态 IP 配置。分配静态 IP 的目的是将QUOTA使用分配iptables给每个客户端,以便控制带宽使用。
以下是我的配置:
服务器.conf:
mode server
tls-server
dev tun
topology subnet
push "topology subnet"
ifconfig 10.8.1.1 255.255.255.0
push "route-gateway 10.8.1.1"
port 443
proto tcp-server
push "redirect-gateway def1 bypass-dhcp"
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
tls-crypt tc.key
cipher AES-256-CBC
user nobody
group nobody
persist-key
persist-tun
client-config-dir /etc/openvpn/ccd/
management localhost 7505
Run Code Online (Sandbox Code Playgroud)
/etc/openvpn/ccd/client:
ifconfig-push 10.8.1.2 255.255.255.0
Run Code Online (Sandbox Code Playgroud)
iptables 规则:
-P FORWARD DROP
-A FORWARD -d 10.8.1.2/32 -g client
-A …Run Code Online (Sandbox Code Playgroud)