Tuning Tun: TUN write error: cannot identify IP version

Official client software for OpenVPN Access Server and OpenVPN Cloud.
Post Reply
Mercury
OpenVpn Newbie
Posts: 1
Joined: Sun Mar 22, 2015 4:19 pm

Tuning Tun: TUN write error: cannot identify IP version

Post by Mercury » Sun Mar 22, 2015 4:59 pm

Hi guys (and gals)

I am sure it is a simple error, but I cannot figure it out :oops: .

I set up openvpn (first time :lol: ) on a Raspberry Pi 2 server running Rasperian. Need to use it with an iPad running iOS 8. Installation appeared to go very well and I generated and imported the .ovpn file into the iPad app smoothly. Connection and handshake between the server and client is clean and smooth, but we seem to have a 'tun' issue that I cannot solve. I am unable to access any internet service when connected via the Openvpn app, although it shows steady and connected. Originally I received the following error message:

Code: Select all


2015-03-22 11:11:48 EVENT: ASSIGN_IP
2015-03-22 11:11:48 Connected via tun
2015-03-22 11:11:48 EVENT: CONNECTED @xx.xxx.xxx.xxx:1194
(77.248.123.152) via /UDPv4 on tun/xx.xx.0.6/
2015-03-22 11:11:48 SetStatus Connected
2015-03-22 11:11:48 NET Internet:ReachableViaWiFi/-R t----l-
2015-03-22 11:11:58 TUN write error: cannot identify IP version for prefix
2015-03-22 11:12:29 TUN write error: cannot identify IP version for prefix
2015-03-22 11:12:50 TUN write error: cannot identify IP version for prefix
2015-03-22 11:13:01 TUN write error: cannot identify IP version for prefix
2015-03-22 11:13:40 TUN reset routes
2015-03-22 11:13:40 EVENT: DISCONNECTED
2015-03-22 11:13:40 Raw stats on disconnect:
  BYTES_IN : 15101
  BYTES_OUT : 27300
  PACKETS_IN : 131
  PACKETS_OUT : 282
  TUN_BYTES_IN : 10975
  TUN_BYTES_OUT : 32
  TUN_PACKETS_IN : 164
  TUN_PACKETS_OUT : 1
  REPLAY_ERROR : 23
  TUN_FRAMING_ERROR : 9
  KEEPALIVE_TIMEOUT : 1
  N_RECONNECT : 1
  PKTID_UDP_REPLAY_WINDOW_BACKTRACK : 13
  PKTID_UDP_LARGE_DIFF : 23
2015-03-22 11:13:40 Performance stats on disconnect:
  CPU usage (microseconds): 1155253
  Tunnel compression ratio (uplink): 2.48747
  Tunnel compression ratio (downlink): 471.906
  Network bytes per CPU second: 36702
  Tunnel bytes per CPU second: 9527
2015-03-22 11:13:40 ----- OpenVPN Stop -----
2015-03-22 11:25:58 ----- OpenVPN Start -----
OpenVPN core 3.0 ios armv7a thumb2 32-bit
2015-03-22 11:25:58 UNUSED OPTIONS
4 [resolv-retry] [infinite]
5 [nobind]
6 [persist-key]
7 [persist-tun]
8 [mute-replay-warnings]

I then added this additional code, suggested in another article

Code: Select all


push "comp-lzo"

to server.conf file and the TUN error disappeared, but I still am unable to access any internet service, including web pages, mail, et al. I see the following message now in the same section when I connect

Code: Select all


2015-03-22 15:14:27 LZO-ASYM init swap=0 asym=0
2015-03-22 15:14:27 EVENT: ASSIGN_IP
2015-03-22 15:14:27 Connected via tun
2015-03-22 15:14:27 EVENT: CONNECTED @X.X.X.X:1194
(77.248.123.152) via /UDPv4 on tun/10.8.0.6/
2015-03-22 15:14:27 SetStatus Connected
2015-03-22 15:14:27 NET Internet:ReachableViaWiFi/-R t----l-
2015-03-22 15:16:27 Session invalidated: KEEPALIVE_TIMEOUT
2015-03-22 15:16:27 Client terminated, restarting in 2...
2015-03-22 15:16:27 TUN reassert
2015-03-22 15:16:27 TUN reset routes
2015-03-22 15:16:27 NET Internet:ReachableViaWiFi/-R -----l-

My server conf file is below

Code: Select all


local 192.168.192.81
dev tun 
proto udp 
port 1194 
ca /etc/openvpn/easy-rsa/keys/ca.crt 
cert /etc/openvpn/easy-rsa/keys/Server.crt 
key /etc/openvpn/easy-rsa/keys/Server.key 
dh /etc/openvpn/easy-rsa/keys/dh2048.pem 
server X.X.0.0 255.255.255.0 
# server and remote endpoints 
ifconfig X.X.0.1 10.8.0.2 
# Add route to Client routing table for the OpenVPN Server 
push "route X.X.0.1 255.255.255.255" 
# Add route to Client routing table for the OpenVPN Subnet 
push "route X.X.0.0 255.255.255.0" 
# your local subnet 
push "route 192.168.192.81 255.255.255.255" 
# Set primary domain name server address to the SOHO Router 
# If your router does not do DNS, you can use Google DNS 8.8.8.8 
push "dhcp-option DNS 8.8.8.8" # This should already match your router address and not need to be changed.
# Override the Client default gateway by using 0.0.0.0/1 and 
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of 
# overriding but not wiping out the original default gateway. 
push "redirect-gateway def1" 
client-to-client 
duplicate-cn 
keepalive 10 120 
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0 
cipher AES-128-CBC 
comp-lzo 
user nobody 
group nogroup 
persist-key 
persist-tun

#added 22MAR2015
push "comp-lzo"

status /var/log/openvpn-status.log 20 
log /var/log/openvpn.log 
verb 1

Any solutions/guidance/code to fix this issue would be appreciated. Thx ;) .

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Tuning Tun: TUN write error: cannot identify IP version

Post by Traffic » Sun Mar 22, 2015 7:36 pm

Please see this HOWTO:
HOWTO: Routing all client traffic (including web-traffic) through the VPN

Also, Server:
Mercury wrote:

Code: Select all

server X.X.0.0 255.255.255.0                  # ok
ifconfig X.X.0.1 10.8.0.2                     # delete
push "route X.X.0.1 255.255.255.255"          # delete
push "route X.X.0.0 255.255.255.0"            # delete
# your local subnet
push "route 192.168.192.81 255.255.255.255"   # not subnet only server
verb 1                                        # change to verb 4

Post Reply