# Openvpn trouble

## silverchris

I am trying to set up openvpn on my laptop running gentoo.  Openvpn seems to connect fine but has trouble setting up the routing? This is what gets logged:

```
Sep 14 17:19:15 [openvpn] OpenVPN 2.0.6 i486-pc-linux-gnu [SSL] [LZO] [EPOLL] built on Sep 14 2007

Sep 14 17:19:15 [openvpn] WARNING: file 'static.key' is group or others accessible

Sep 14 17:19:15 [openvpn] LZO compression initialized

Sep 14 17:19:15 [udevd-event] rename_netif: error changing netif name tap0 to netlink/tap0: Invalid argument

Sep 14 17:19:15 [openvpn] TUN/TAP device tap0 opened

Sep 14 17:19:15 [openvpn] ERROR: Linux route add command failed: shell command exited with error status: 7

Sep 14 17:19:15 [openvpn] Attempting to establish TCP connection with 65.93.33.198:443

Sep 14 17:19:15 [openvpn] TCP: connect to 65.93.33.198:443 failed, will try again in 5 seconds: Connection refused (errno=111)

Sep 14 17:19:20 [openvpn] TCP connection established with 65.93.33.198:443

Sep 14 17:19:20 [openvpn] TCP/UDP: Dynamic remote address changed during TCP connection establishment

Sep 14 17:19:20 [openvpn] TCPv4_CLIENT link local: [undef]

Sep 14 17:19:20 [openvpn] TCPv4_CLIENT link remote: 65.93.33.198:443

Sep 14 17:19:20 [openvpn] Peer Connection Initiated with 65.93.33.198:443

Sep 14 17:19:21 [openvpn] Initialization Sequence Completed

Sep 14 17:23:54 [openvpn] event_wait : Interrupted system call (code=4)

Sep 14 17:23:54 [openvpn] ERROR: Linux route delete command failed: shell command exited with error status: 7

Sep 14 17:23:54 [openvpn] SIGTERM[hard,] received, process exiting
```

Also I get this on the terminal when starting openvpn with /etc/init.d/openvpn start:

```
SIOADDRT: Network is unreachable
```

It looks to me that openvpn connects to the server fine but it can't set up the proper network stuff on the laptop?

----------

## ksool

Can you post your server config, and the output of "route -n" before and after you connect with openVPN?

----------

## silverchris

route -n before open vpn

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

216.209.175.241 0.0.0.0         255.255.255.255 UH    0      0        0 ppp0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         216.209.175.241 0.0.0.0         UG    0      0        0 ppp0

localhost ~ # 
```

route -n with openvpn running.

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

65.93.33.155    216.209.175.241 255.255.255.255 UGH   0      0        0 ppp0

216.209.175.241 0.0.0.0         255.255.255.255 UH    0      0        0 ppp0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

localhost ~ # 
```

config file

```
remote root-localhost.is-a-geek.org

port 443

dev tap

secret static.key

proto tcp-client

comp-lzo

route-gateway 192.168.0.2

redirect-gateway

```

with openvpn running ping says the network is unreachable also.

----------

## ksool

I'm assuming that's your client config?

At a quick guess, I think you might want to consider using "dev tap0" instead of "dev tap" but definitely check that you've properly modified your kernel as outlined here: http://gentoo-wiki.com/HOWTO_Road_Warriors_with_OpenVPN

The routing information is generally sent from the server. You might want to turn up the verbosity on your logging and see what is actually sent to see if its a server or client side problem.

----------

## silverchris

Ya that's my client config. I was doing some playing around today and I switched to using certificates and using tap0 instead of tap. It now connects to the network and I can ping computers that are on the other end of the VPN. I ran the command to start the vpn from the console on the laptop and It failed to do routing still and I get more info about the error this way. 

It seems to be executing these commands for route

```
route add -net 67.70.206.127 netmask 255.255.255.255 gw 206.172.238.241

route del -net 0.0.0.0 netmask 0.0.0.0

route add -net 0.0.0.0 netmask 0.0.0.0 gw 192.168.0.2

```

Right after those commands it says

```

SIOCADDRT: Network is unreachable

Error: Linux route add command failed: Shell command exited with error status: 7

```

Servers config(Server is a router running dd-wrt)

```

# Tunnel options

mode server       # Set OpenVPN major mode

proto udp         # Setup the protocol (server)

port 1194         # TCP/UDP port number

dev tap0          # TUN/TAP virtual network device

keepalive 15 60   # Simplify the expression of --ping 

daemon            # Become a daemon after all initialization

verb 3            # Set output verbosity to n 

comp-lzo          # Use fast LZO compression 

# OpenVPN server mode options

client-to-client  # tells OpenVPN to internally route client-to-client traffic 

duplicate-cn      # Allow multiple clients with the same common name

# TLS Mode Options

tls-server        # Enable TLS and assume server role during TLS handshake 

ca ca.crt         # Certificate authority (CA) file

dh dh1024.pem     # File containing Diffie Hellman parameters 

cert server.crt   # Local peer's signed certificate

key server.key    # Local peer's private key 
```

This would be my first time setting up a vpn so I most likely missed something that could be a big error.

EDIT: I just checked my WAN ip for my laptop when connect through the vpn and it is the same as my network its connected too over the vpn. So I guess its working but I would still like to see if there is a way to get rid of the error.

----------

