我租了一个 VPS。我想在上面运行一个 VPN 服务器,使用openvpn
。
我是openvpn
这样安装的:
sudo apt-get install openvpn
具有所需的依赖项。但是,我必须对其进行配置...
只有一文件位于/etc/openvpn
:
user@server:~$ cat /etc/openvpn/update-resolv-conf
#!/bin/bash
#
# Parses DHCP options from openvpn to update resolv.conf
# To use set as 'up' and 'down' script in your openvpn *.conf:
# up /etc/openvpn/update-resolv-conf
# down /etc/openvpn/update-resolv-conf
#
# Used snippets of resolvconf script by Thomas Hood and Chris Hanson.
# Licensed under the GNU GPL. See /usr/share/common-licenses/GPL.
#
# Example envs set from openvpn:
#
# foreign_option_1='dhcp-option DNS X.Y.Z.132'
# foreign_option_2='dhcp-option DNS X.Y.Z.133'
# foreign_option_3='dhcp-option DOMAIN be.bnc.ch'
#
[ -x /sbin/resolvconf ] || exit 0
[ "$script_type" ] || exit 0
[ "$dev" ] || exit 0
split_into_parts()
{
part1="$1"
part2="$2"
part3="$3"
}
case "$script_type" in
up)
NMSRVRS=""
SRCHS=""
for optionvarname in ${!foreign_option_*} ; do
option="${!optionvarname}"
echo "$option"
split_into_parts $option
if [ "$part1" = "dhcp-option" ] ; then
if [ "$part2" = "DNS" ] ; then
NMSRVRS="${NMSRVRS:+$NMSRVRS }$part3"
elif [ "$part2" = "DOMAIN" ] ; then
SRCHS="${SRCHS:+$SRCHS }$part3"
fi
fi
done
R=""
[ "$SRCHS" ] && R="search $SRCHS
"
for NS in $NMSRVRS ; do
R="${R}nameserver $NS
"
done
echo -n "$R" | /sbin/resolvconf -a "${dev}.openvpn"
;;
down)
/sbin/resolvconf -d "${dev}.openvpn"
;;
esac
我应该怎么办?每一个我发现的教程处理的是我没有的文件。
答案1
您应该转到/usr/share/doc/openvpn/examples/
,那里有一些示例配置文件。您可以将client.conf
示例复制到您的/etc/openvpn/
目录中。此外,您应该编辑/etc/default/openvpn
并设置AUTOSTART=client
。这将使您的 openvpn 服务器启动配置文件/etc/openvpn/client.conf
。现在您可以转到您的教程来配置它。
我希望这能对你有帮助。
问候