O local remoto estava bloqueando a maior parte do tráfego de saída. Eu tive que executar o OpenVPN na porta 443 (porta SSL) para fazê-lo funcionar a partir do local específico. Nenhum local remoto bloquearia 443.
Eu configurei o OpenVPN em uma máquina Linux no meu porão.
Consigo me conectar da minha máquina com Windows 8.1 sem problemas quando estou conectado à rede local.
Neste caso, eu configurei o arquivo de configuração para usar remote 192.168.0.111 1194
Quando deixo minha rede local, altero esse arquivo de configuração para dizer: remote 63.xxx.x.xxx 1194
Onde 63.xxx.xx.xx
é meu IP público.
Quando estou fora da minha rede local, não consigo me conectar. Aqui está a minha entrada de log da minha última tentativa de conexão de uma rede externa.
Mon Oct 06 13:59:54 2014 OpenVPN 2.3.4 i686-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on May 2 2014
Mon Oct 06 13:59:54 2014 library versions: OpenSSL 1.0.1g 7 Apr 2014, LZO 2.05
Mon Oct 06 13:59:54 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Mon Oct 06 13:59:54 2014 Need hold release from management interface, waiting...
Mon Oct 06 13:59:55 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Mon Oct 06 13:59:55 2014 MANAGEMENT: CMD 'state on'
Mon Oct 06 13:59:55 2014 MANAGEMENT: CMD 'log all on'
Mon Oct 06 13:59:55 2014 MANAGEMENT: CMD 'hold off'
Mon Oct 06 13:59:55 2014 MANAGEMENT: CMD 'hold release'
Mon Oct 06 13:59:55 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
Mon Oct 06 13:59:55 2014 UDPv4 link local: [undef]
Mon Oct 06 13:59:55 2014 UDPv4 link remote: [AF_INET]63.xxx.xx.xx:1194
Mon Oct 06 13:59:55 2014 MANAGEMENT: >STATE:1412625595,WAIT,,,
Mon Oct 06 14:00:55 2014 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Mon Oct 06 14:00:55 2014 TLS Error: TLS handshake failed
Mon Oct 06 14:00:55 2014 SIGUSR1[soft,tls-error] received, process restarting
Mon Oct 06 14:00:55 2014 MANAGEMENT: >STATE:1412625655,RECONNECTING,tls-error,,
Mon Oct 06 14:00:55 2014 Restart pause, 2 second(s)
Mon Oct 06 14:00:57 2014 Socket Buffers: R=[65536->65536] S=[65536->65536]
Mon Oct 06 14:00:57 2014 UDPv4 link local: [undef]
Mon Oct 06 14:00:57 2014 UDPv4 link remote: [AF_INET]63.xxx.xx.xx:1194
Mon Oct 06 14:00:57 2014 MANAGEMENT: >STATE:1412625657,WAIT,,,
Parece que pode ser um problema de firewall , mas passei por cada um dos pontos da página novamente e novamente e não consigo encontrar quaisquer problemas.
- A perimeter firewall on the server's network is filtering out incoming OpenVPN packets (by default OpenVPN uses UDP or TCP port
number 1194).
Eu verifiquei e verifiquei duas vezes a configuração do roteador, e a porta 1194 deve ser encaminhada para a minha caixa linux ... Aqui está a configuração do iptables do roteador:
> iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
drop all -- anywhere 63.xxx.xx.xx
ACCEPT 2 -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp echo-request
DROP tcp -- anywhere anywhere tcp dpt:www
DROP tcp -- anywhere anywhere tcp dpt:https
DROP tcp -- anywhere anywhere tcp dpt:telnet
DROP tcp -- anywhere anywhere tcp dpt:ssh
DROP tcp -- anywhere anywhere tcp dpt:ftp
DROP tcp -- anywhere anywhere tcp dpt:domain
DROP tcp -- anywhere anywhere tcp dpt:44401
DROP tcp -- anywhere anywhere tcp dpt:49431
DROP udp -- anywhere anywhere udp dpt:domain
DROP udp -- anywhere anywhere udp dpt:tftp
DROP udp -- anywhere anywhere udp dpt:1900
DROP udp -- anywhere anywhere udp dpt:37000
DROP udp -- anywhere anywhere udp dpt:38000
DROP udp -- anywhere anywhere udp dpts:5098:5100
DROP udp -- anywhere anywhere udp dpt:50032
DROP udp -- anywhere anywhere udp dpt:54008
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT udp -- anywhere anywhere udp dpt:500
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT !esp -- anywhere anywhere MARK match 0x10000000/0x10000000
ACCEPT !ah -- anywhere anywhere MARK match 0x10000000/0x10000000
ACCEPT tcp -- anywhere anywhere tcp dpt:4567
DROP all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 224.0.1.60
ACCEPT udp -- anywhere 192.168.0.111 udp dpt:1194
ACCEPT tcp -- anywhere 192.168.0.111 tcp dpt:1194
ACCEPT tcp -- anywhere 192.168.0.111 tcp dpt:https
ACCEPT udp -- anywhere 192.168.0.17 udp dpt:51490
ACCEPT udp -- anywhere 192.168.0.25 udp dpt:53681
ACCEPT udp -- anywhere 192.168.0.111 udp dpt:1194
ACCEPT tcp -- anywhere 192.168.0.111 tcp dpt:1194
ACCEPT udp -- anywhere 192.168.0.111 udp dpt:https
ACCEPT tcp -- anywhere 192.168.0.111 tcp dpt:https
ACCEPT tcp -- anywhere 5.5.126.125 tcp dpt:15979
ACCEPT udp -- anywhere 192.168.0.22 udp dpt:16402
ACCEPT all -- anywhere 224.0.0.0/3
ACCEPT icmp -- anywhere anywhere icmp echo-request
ACCEPT icmp -- anywhere anywhere icmp echo-reply
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp type 30
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
ACCEPT tcp -- anywhere 192.168.0.111 tcp dpt:www
ACCEPT udp -- anywhere 192.168.0.18 udp dpt:62558
ACCEPT udp -- anywhere 192.168.0.17 udp dpt:57874
ACCEPT udp -- anywhere 192.168.0.17 udp dpt:51621
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:58670
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:50209
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:60530
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:60285
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:59415
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:62603
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:52438
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:53919
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:62384
ACCEPT tcp -- anywhere 192.168.0.3 tcp dpt:35689
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:35689
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:55287
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:50487
ACCEPT udp -- anywhere 192.168.0.3 udp dpt:51697
urlfilter tcp -- anywhere anywhere tcp flags:FIN,SYN,RST/NONE
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT !esp -- anywhere anywhere MARK match 0x10000000/0x10000000
ACCEPT !ah -- anywhere anywhere MARK match 0x10000000/0x10000000
DROP udp -- 192.168.0.9 anywhere udp dpt:l2tp
DROP tcp -- 192.168.0.9 anywhere tcp dpt:1723
ACCEPT tcp -- anywhere anywhere tcp dpts:5060:5061
ACCEPT udp -- anywhere anywhere udp dpts:5060:5061
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT udp -- 205.171.2.65 anywhere udp dpt:domain
ACCEPT udp -- 205.171.3.65 anywhere udp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpts:27167:27169
ACCEPT tcp -- anywhere anywhere tcp dpts:27164:27166
ACCEPT tcp -- anywhere anywhere tcp dpts:27161:27163
drop all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain drop (2 references)
target prot opt source destination
ACCEPT icmp -- anywhere anywhere icmp echo-request
LOG all -- anywhere anywhere LOG level info prefix 'firewall drop: '
DROP all -- anywhere anywhere
Chain urlfilter (1 references)
target prot opt source destination
SKIPLOG tcp -- anywhere anywhere tcp dpt:www
QUEUE tcp -- anywhere anywhere tcp dpt:www
Parece que meu roteador deve encaminhar a porta 1194 para minha caixa linux. Eu tenho também encaminhando a porta 80 sem qualquer problema para a mesma caixa.
Eu duvido que meu ISP esteja bloqueando a porta 1194, e não a porta 80 ...
- A software firewall running on the OpenVPN server machine itself is filtering incoming connections on port 1194. Be aware that many OSes
will block incoming connections by default, unless configured
otherwise.
Eu usei o Yast na minha caixa local para abrir a porta 1194 na máquina linux. Tenho certeza de que esse não é o problema, pois posso conectar-me à caixa do Linux enquanto estiver conectado à minha rede local. Se o firewall da caixa do linux fosse o problema, eu não seria capaz de me conectar a partir de um endereço local.
- A NAT gateway on the server's network does not have a port forward rule for TCP/UDP 1194 to the internal address of the OpenVPN server
machine.
Tenho certeza de que isso também está configurado corretamente no roteador. Aqui está a configuração nat do iptables no roteador:
> iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 224.0.0.0/3
ACCEPT tcp -- anywhere anywhere tcp dpt:4567
DNAT udp -- anywhere anywhere udp dpt:51697 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:50487 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:55287 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:35689 to:192.168.0.3
DNAT tcp -- anywhere anywhere tcp dpt:35689 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:62384 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:53919 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:52438 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:62603 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:59415 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:60285 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:60530 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:50209 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:58670 to:192.168.0.3
DNAT udp -- anywhere anywhere udp dpt:51621 to:192.168.0.17
DNAT udp -- anywhere anywhere udp dpt:57874 to:192.168.0.17
DNAT udp -- anywhere anywhere udp dpt:62558 to:192.168.0.18
DNAT tcp -- anywhere anywhere tcp dpt:www to:192.168.0.111
REDIRECT tcp -- anywhere anywhere tcp dpt:webcache redir ports 80
DNAT udp -- anywhere anywhere udp dpt:57106 to:192.168.0.22:16402
DNAT tcp -- anywhere anywhere tcp dpt:15980 to:5.5.126.125:15979
DNAT tcp -- anywhere anywhere tcp dpt:https to:192.168.0.111
DNAT udp -- anywhere anywhere udp dpt:https to:192.168.0.111
DNAT tcp -- anywhere anywhere tcp dpt:1194 to:192.168.0.111
DNAT udp -- anywhere anywhere udp dpt:1194 to:192.168.0.111
DNAT udp -- anywhere anywhere udp dpt:53681 to:192.168.0.25
DNAT udp -- anywhere anywhere udp dpt:51490 to:192.168.0.17
DNAT tcp -- anywhere anywhere tcp dpt:https to:192.168.0.111
DNAT tcp -- anywhere anywhere tcp dpt:1194 to:192.168.0.111
DNAT udp -- anywhere anywhere udp dpt:1194 to:192.168.0.111
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
- The OpenVPN client config does not have the correct server address in its config file. The remote directive in the client config file must point to either the server itself or the public IP address of the server network's gateway.
Eu verifiquei, verifiquei novamente e tripliquei este IP para o qual ele está se conectando e está correto.
- Another possible cause is that the windows firewall is blocking access for the openvpn.exe binary. You may need to whitelist (add it
to the "Exceptions" list) it for OpenVPN to work.
Tenho quase certeza de que esse não é o problema, porque consigo me conectar a partir da minha rede local. Estou errado? O windows 8.1 bloqueia o binário quando está se conectando a um endereço remoto, mas não quando está se conectando a um endereço local? Isso parece altamente improvável para mim ...
EDITAR
Aqui está meu arquivo de configuração
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
##############################################
# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client client1
# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun
# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one. On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap
# Are we connecting to a TCP or
# UDP server? Use the same setting as
# on the server.
;proto tcp
proto udp
# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
;remote 192.168.0.111 1194
remote 63.xxx.xx.xx 1194
# Choose a random host from the remote
# list for load-balancing. Otherwise
# try hosts in the order specified.
;remote-random
# Keep trying indefinitely to resolve the
# host name of the OpenVPN server. Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite
# Most clients don't need to bind to
# a specific local port number.
nobind
# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nobody
# Try to preserve some state across restarts.
persist-key
persist-tun
# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here. See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]
# Wireless networks often produce a lot
# of duplicate packets. Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings
# SSL/TLS parms.
# See the server config file for more
# description. It's best to use
# a separate .crt/.key file pair
# for each client. A single ca
# file can be used for all clients.
ca "C:\Program Files\OpenVPN\config\ca.crt"
cert "C:\Program Files\OpenVPN\config\client1.crt"
key "C:\Program Files\OpenVPN\config\client1.key"
# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server". This is an
# important precaution to protect against
# a potential attack discussed here:
# http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server". The build-key-server
# script in the easy-rsa folder will do this.
ns-cert-type server
# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1
# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x
# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
comp-lzo yes
# Set log file verbosity.
verb 3
# Silence repeating messages
;mute 20
auth-nocache
script-security 2
remote-cert-tls server
Alguém tem alguma outra ideia de por que eu tenho problemas de conexão?
EDIT2 - Eu usei isso para configurar o openVPN: link
Há uma seção lá para "Configuração do Firewall" que não se aplica a mim, pois não tenho o openvz nem o kvm. Eu usei o yast para abrir a porta 1194 no SuSEfirewall2