在 Kali Linux 中使用 VPN 的困难

在 Kali Linux 中使用 VPN 的困难

我正在尝试将运行 Kali Linux 滚动升级的计算机连接到 VPN(使用 OpenVPN 连接)。我创建了一个免费帐户这里,下载必要的配置文件,然后在 Kali 网络管理器中添加 VPN。当我尝试连接到此 VPN 时,它显示我已连接。但是,当我去检查我的 IP/地理位置时,它没有改变。任何帮助都将不胜感激!

更新信息!

无 VPN 的路由表:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    600    0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan0

带有 VPN 的路由表:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    600    0        0 wlan0
10.12.0.14      0.0.0.0         255.255.255.255 UH    50     0        0 tun0
23.19.26.250    192.168.1.1     255.255.255.255 UGH   600    0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan0

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 193.43.27.132'
#     foreign_option_2='dhcp-option DNS 193.43.27.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

运行建议的命令后:

root@kali:/etc/openvpn# openvpn --config config.ovpn
Sat Mar  5 14:45:15 2016 OpenVPN 2.3.10 x86_64-pc-linux-gnu [SSL   (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Jan 21 2016
Sat Mar  5 14:45:15 2016 library versions: OpenSSL 1.0.2f  28 Jan 2016, LZO 2.08
Sat Mar  5 14:45:15 2016 WARNING: file 'client.key' is group or others  accessible
Sat Mar  5 14:45:15 2016 UDPv4 link local: [undef]
Sat Mar  5 14:45:15 2016 UDPv4 link remote: [AF_INET]23.19.26.250:5353
Sat Mar  5 14:45:16 2016 [server] Peer Connection Initiated with     [AF_INET]23.19.26.250:5353
Sat Mar  5 14:45:18 2016 TUN/TAP device tun2 opened
Sat Mar  5 14:45:18 2016 do_ifconfig, tt->ipv6=0,     tt->did_ifconfig_ipv6_setup=0
Sat Mar  5 14:45:18 2016 /sbin/ip link set dev tun2 up mtu 1500
Sat Mar  5 14:45:18 2016 /sbin/ip addr add dev tun2 local 10.13.0.98 peer     10.13.0.97
RTNETLINK answers: File exists
Sat Mar  5 14:45:23 2016 ERROR: Linux route add command failed: external  program exited with error status: 2
RTNETLINK answers: File exists
Sat Mar  5 14:45:23 2016 ERROR: Linux route add command failed: external    program exited with error status: 2
RTNETLINK answers: File exists
Sat Mar  5 14:45:23 2016 ERROR: Linux route add command failed: external     program exited with error status: 2
RTNETLINK answers: File exists
Sat Mar  5 14:45:23 2016 ERROR: Linux route add command failed: external   program exited with error status: 2
Sat Mar  5 14:45:23 2016 Initialization Sequence Completed

答案1

我自己已经注册了同样的服务,并且运行良好。您的config文件应该是这样的,

remote 23.19.26.250
port 5353
client
dev tun
pull
resolv-retry infinite
ca ca.crt
cert client.crt
key client.key
persist-key
ns-cert-type server
persist-tun
comp-lzo
nobind
mute-replay-warnings
route-delay 5
keepalive 5 28

确保你的和我的相同。然后发出以下命令:

 apt-get install openvpn
 openvpn --config config.ovpn

其中第二条命令必须在文件所在的目录中给出ca.crt, client.crt, client.key, config.ovpn

现在打开一个新终端并发出此命令:

 wget http://ipinfo.io/ip -qO -

其输出应为 23.19.26.150

相关内容