Connects but will not ping

Got a problem with Viscosity or need help? Ask here!

msmfoster

Posts: 3
Joined: Mon Sep 15, 2014 4:41 am

Post by msmfoster » Mon Sep 15, 2014 5:04 am
I have managed to installed OpenVPN 2.3.1p2 which is the OpenBSD 5.4 default installation. The keys have been generated and handshake has been established between the server and the Viscosity client. However under tunnel mode, I can ping the server and no one else (cannot ping the client from the server) and under bridging mode I cannot ping anyone at all.

Looking at the firewall on the server does not appear to be blocking traffic and even when the client side firewall (Windows 8.1) is disabled outright it still fails. On the server em1 and tun0 are set to promiscuous mode and bridge0 has them linked.
Code: Select all
em0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        lladdr 00:16:36:6c:1f:0a
        priority: 0
        groups: egress
        media: Ethernet autoselect (1000baseT full-duplex,master,rxpause,txpause)
        status: active
        inet 192.168.15.5 netmask 0xffffff00 broadcast 192.168.15.255
        inet6 fe80::216:36ff:fe6c:1f0a%em0 prefixlen 64 scopeid 0x1
tun0: flags=9942<BROADCAST,RUNNING,PROMISC,SIMPLEX,LINK0,MULTICAST> mtu 1500
        lladdr fe:e1:ba:d1:ed:3c
        priority: 0
        groups: tun
        status: active
bridge0: flags=41<UP,RUNNING>
        groups: bridge
        priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
        em0 flags=3<LEARNING,DISCOVER>
                port 1 ifpriority 0 ifcost 0
        tun0 flags=3<LEARNING,DISCOVER>
                port 5 ifpriority 0 ifcost 0
I essentially followed the instructions provided on http://www.chrisk.de/blog/2010/03/how-t ... layer2-vpn which seem to be fine based on the fact that I've seen similiar configurations used before. This is the server configuration:
Code: Select all
#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients <-> one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine <-> single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# Comments are preceded with '#' or ';'         #
#################################################


# openvpn_bsdauth is invoked by OpenVPN to 
# authenticate a user by checking a username and
# a password against the BSD Authentication 
# system. It supports both the via-file and 
# via-env methods employed by OpenVPN (see the 
# section about the auth-user-pass-verify 
# directive in openvpn(8) for the description 
# of these methods).
auth-user-pass-verify /usr/local/libexec/openvpn_bsdauth via-env

# Will tell the server to use the username for
# indexing purposes as it would use the Common
# Name of a client which was authenticating via 
# a client certificate.
username-as-common-name

# For OpenVPN versions 2.1 and up, the 
# .script-security. directive must be set to (at 
# least) .3. in order for openvpn_bsdauth to 
# receive the password from OpenVPN.
script-security 4

# Which local IP address should OpenVPN
# listen on? (optional)
local 192.168.15.5

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tun0
dev-type tap

# We need this thing to run in server mode
# and since we are bridge OpenVPN gets very
# confused.
mode server
tls-server

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca /etc/ssl/ethereal-realms.org.ca 
cert /etc/ssl/ethereal-realms.org.crt
key /etc/ssl/private/ethereal-realms.org.key  # This file should be kept secret

# Use of a shared secret is not as secure
# but is also not dependent on establising an
# entire SSL/TLS certificate infrastructure.
#secret /etc/ssl/private/openvpn_shared.key

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys. 
dh /etc/ssl/private/openvpn.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 192.168.7.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 192.168.7.1 Comment this line out if you are
# ethernet bridging. See the man page for more info.
;server 192.168.7.0 255.255.255.0

# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist /var/db/openvpn/ipp.txt

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
server-bridge 192.168.15.5 255.255.255.0 192.168.15.201 192.168.15.225

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;push "route 192.168.15.0 255.255.255.0"

# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"
push "dhcp-option WINS 192.168.15.5"
;push "route-gateway 192.168.15.1"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
;cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
max-clients 5

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
user _openvpn
group _openvpn

# Run the --ping-exit / --ping-restart timer 
# only if we have a remote address.  Use this
# option if you are starting the daemon in
# listen mode (i.e. without an explicit
# --remote peer), and you don't want to 
# start clocking timeouts until a remote 
# peer connects.
ping-timer-rem

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status /var/db/openvpn/status.log

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
;log-append  openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20
The routing tables on the client:
Code: Select all
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.21.1   192.168.21.100     60
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      169.254.0.0      255.255.0.0         On-link    169.254.159.64    261
   169.254.159.64  255.255.255.255         On-link    169.254.159.64    261
  169.254.255.255  255.255.255.255         On-link    169.254.159.64    261
     192.168.15.0    255.255.255.0         On-link    192.168.15.201    266
   192.168.15.201  255.255.255.255         On-link    192.168.15.201    266
   192.168.15.255  255.255.255.255         On-link    192.168.15.201    266
     192.168.21.0    255.255.255.0         On-link    192.168.21.100    286
   192.168.21.100  255.255.255.255         On-link    192.168.21.100    286
   192.168.21.255  255.255.255.255         On-link    192.168.21.100    286
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link    192.168.21.100    286
        224.0.0.0        240.0.0.0         On-link    169.254.159.64    261
        224.0.0.0        240.0.0.0         On-link    192.168.15.201    266
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link    192.168.21.100    286
  255.255.255.255  255.255.255.255         On-link    169.254.159.64    261
  255.255.255.255  255.255.255.255         On-link    192.168.15.201    266
===========================================================================
Persistent Routes:
  None
And server:
Code: Select all
Internet:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            io                 UGS       10     5351     -     8 em0
loopback           localhost          UGRS       0        0 33192     8 lo0
localhost          localhost          UH         3     1024 33192     4 lo0
192.168.15/24      link#1             UC         3        0     -     4 em0
io                 a8:39:44:8e:57:00  UHLc       1        0     -     4 em0
oberon             00:16:36:6c:1f:0a  UHLc       1      756     -     4 lo0
192.168.15.255     link#1             UHLc       2       63     -     4 em0
BASE-ADDRESS.MCAST localhost          URS        0        0 33192     8 lo0
The client logs are not particularly helpful:
Code: Select all
Sep 14 02:34:15: State changed to Connecting
Sep 14 02:34:15: Viscosity 1.5.0 (1260)
Sep 14 02:34:15: Running on Microsoft Windows 8.1 Pro with Media Center
Sep 14 02:34:15: Bringing up interface...
Sep 14 02:34:15: Checking reachability status of connection...
Sep 14 02:34:16: Connection is reachable. Starting connection attempt.
Sep 14 02:34:16: OpenVPN 2.3.4 Windows-MSVC [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Aug 27 2014
Sep 14 02:34:17: WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Sep 14 02:34:17: UDPv4 link local: [undef]
Sep 14 02:34:17: UDPv4 link remote: [AF_INET]142.68.43.146:1194
Sep 14 02:34:17: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Sep 14 02:34:20: [ethereal-realms.org] Peer Connection Initiated with [AF_INET]142.68.43.146:1194
Sep 14 02:34:22: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sep 14 02:34:22: open_tun, tt->ipv6=0
Sep 14 02:34:22: TAP-WIN32 device [Ethereal Realms] opened: \\.\Global\{4B96F975-CB12-4512-87A3-8A73E35805A1}.tap
Sep 14 02:34:22: Notified TAP-Windows driver to set a DHCP IP/netmask of 192.168.15.201/255.255.255.0 on interface {4B96F975-CB12-4512-87A3-8A73E35805A1} [DHCP-serv: 192.168.15.0, lease-time: 31536000]
Sep 14 02:34:22: Successful ARP Flush on interface [41] {4B96F975-CB12-4512-87A3-8A73E35805A1}
Sep 14 02:34:27: Initialization Sequence Completed
Sep 14 02:34:27: State changed to Connected
So I guess the question is? What now? The fact that pinging never really worked implies something is wrong, but not exactly sure where to look from now on.

Eric

User avatar
Posts: 1146
Joined: Sun Jan 03, 2010 3:27 am

Post by Eric » Mon Sep 15, 2014 9:08 am
Hi msmfoster,

The connection is successful, which means the server and client, for the most part, are setup correctly. If pings are failing, or you are unable to access the server the problem will be with routing or with firewall/proxy setup.

Routing on your client is setup correctly if you are trying to ping the server through the VPN Network (i.e. via 192.168.15.x). You have mentioned that the firewall on the server does not appear to be blocking, but it is quite standard for servers to block ICMP by default. Try disabling the servers firewall completely and seeing if connectivity is still a problem.

Also try accessing the server rather than pinging it, via a webpage or an SMB share for example.

Regards,
Eric
Eric Thorpe
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs

msmfoster

Posts: 3
Joined: Mon Sep 15, 2014 4:41 am

Post by msmfoster » Mon Sep 22, 2014 5:03 am
Thanks. The reason I assumed the firewall was not actively blocking the connection was related the fact that I could monitor what it logs. However it seems that those specific rules were not being logged at all, hence the problem.

I eventually opted to change my configuration to a Tunnel with Subnet configuration and with additional changes in the firewall everything started to work pretty much as expected. Odd thing is, as a bridge the routes should have matched the local Network rules perfectly and just worked.
3 posts Page 1 of 1