Openvpn

我在配置和執行 openvpn 伺服器時遇到問題

  • September 2, 2020

伺服器日誌

Options error: Unrecognized option or missing or extra parameter(s) in server.ovpn:4: cert (2.4.9) Use --help for more information.

伺服器配置

server 192.168.1.0 255.255.255.0
ifconfig-pool-persist ipp.txt
ca ca.crt
cert serverport 1194
proto udp

任何人都可以幫助解決這個問題嗎?

dev tun
server 192.168.1.0 255.255.255.0
ifconfig-pool-persist ipp.txt
ca ca.crt
cert serverVPN.crt
key serverVPN.key
dh dh1024.pem
push "route 192.168.1.0 255.255.255.0"
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
client-to-client
log-append /var/log/openvpn
group daemon
daemon
verb 3.crt
key server.key
dh dh1024.pem
push "route 192.168.1.0 255.255.255.0"
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
comp-lzo
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
client-to-client
log-append /var/log/openvpn
group daemon
daemon
verb 3

問題恰好在錯誤消息中指定的行上。

cert serverport 1194

您應該在指令中提供證書的文件名cert,並且serverport指令應該在下一行。

正確的伺服器配置是:

埠 1194 proto udp dev tun server 192.168.1.0 255.255.255.0 ifconfig-pool-persist ipp.txt ca ca.crt cert serverVPN.crt key serverVPN.key dh dh1024.pem push “route 192.168.1.0 255.255.255.0” push “redirect -gateway def1” push “dhcp-option DNS 8.8.8.8” push “dhcp-option DNS 8.8.4.4” comp-lzo keepalive 10 60 ping-timer-rem persist-tun persist-key client-to-client log-append / var/log/openvpn group daemon daemon verb 3.crt key server.key dh dh1024.pem push “route 192.168.1.0 255.255.255.0” push “redirect-gateway def1” push “dhcp-option DNS 8.8.8.8” push “dhcp -option DNS 8.8.4.4” comp-lzo keepalive 10 60 ping-timer-rem persist-tun persist-key client-to-client log-append /var/log/openvpn group daemon daemon verb 3

引用自:https://serverfault.com/questions/1032310