最近弄个Voip。可是没有公网IP。只能用VPN干了。
目标IP:172.16.0.7
Windows电脑IP:172.16.0.6
服务器IP:172.16.0.1
服务器参考如下配置:
port 11194
;proto udp
proto tcp
dev tap0
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
dh/etc/openvpn/keys/dh4096.pem
key /etc/openvpn/keys/server.key
server-bridge 172.16.0.1 255.255.255.0 192.168.0.155 192.168.0.165
push "172.16.0.0 255.255.255.0"
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 172.16.0.1"
client-to-client
ifconfig-pool-persistipp.txt
keepalive 10 120
comp-lzo
persist-key
bersist-tun
status /etc/openvpn/loqs/openvon-status.log
log
/etc/obenvon/loas/openvon.log
verh
3
客户端参考如下配置:
client
remote your_nameserver 11194
remote-cert-tls server
tls-auth ta.key 1
cipher AES-256-CBC
verb 3
;mute 20
ca ca.crt
cert client.crt
key client.key
;mute-replay-warnings
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]
persist-key
persist-tun
;user nobody
;group n。ogroup
nobind
resolv-retry infinite
;proto tcp
proto udp
;dev-node MyTap
dev tap0
;dev tun
注意的几点:
1,默认网关与地址池要一致。
2,默认UDP协议要开启,否则服务器不启动。
3,记得iptables开启端口
服务器与客户端连接后,我在用的Windows桥接两个端口进行通信的。也就是Windows客户端连接服务器后,客户端生成的虚拟网卡桥接到本地网卡。至此VOIP通讯完成。
附上VPN客户端:
openvpn-install-2.4.8-I602-Win10.exe: https://url64.ctfile.com/f/22136564-1032385367-eb654b (访问密码: 9280)
openvpn-install-2.4.8-I602-Win7.exe: https://url64.ctfile.com/f/22136564-1032385361-3dee13 (访问密码: 9280)