Connects no errors but no data goes through tunnel

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
mrebbert
OpenVpn Newbie
Posts: 5
Joined: Sat Feb 26, 2011 2:04 am

Connects no errors but no data goes through tunnel

Post by mrebbert » Sun Feb 27, 2011 3:48 am

So I switched from OpenVPNAS to just OPENVPN, configured server (Fedora 14) and client side (Windows Vista Ultimate) and got them to connect and I watch it go through the motions on both sides and I get no errors (had to run OpenVPN and OpenVPNGUI as admin to get that to work) but no traffic goes through tunnel. When I go to dslreports and do a whois/ip it shows my non-vpn connection ip address (Using my moto Droid with PDANet to connect to my home VPN). When I do a tracert it is showing it does not use my tunnel. It assigns 10.8.0.6 with a subnet 255.255.255.252 and a gateway of 10.8.0.5. Not sure where that is set though. Any insight? How do I get all traffic to go through the tunnel from my client? How do I get it to access shares on my home network 192.168.1.55.

Here is my server config. I added this one line before I had it working right and just left it in not sure if it effects it "push redirect-gateway 10.8.0.5"

port 1194

proto udp

dev tun

ca /home/Matthew/Downloads/openvpn-2.1.4/easy-rsa/2.0/keys/ca.crt
cert /home/Matthew/Downloads/openvpn-2.1.4/easy-rsa/2.0/keys/server.crt
key /home/Matthew/Downloads/openvpn-2.1.4/easy-rsa/2.0/keys/server.key # This file should be kept secret
dh /home/Matthew/Downloads/openvpn-2.1.4/easy-rsa/2.0/keys/dh1024.pem

server 10.8.0.0 255.255.255.0

push redirect-gateway 10.8.0.5

ifconfig-pool-persist ipp.txt

keepalive 10 120

comp-lzo

persist-key

persist-tun

status openvpn-status.log

verb 3

User avatar
Bebop
Forum Team
Posts: 301
Joined: Wed Dec 15, 2010 9:24 pm

Re: Connects no errors but no data goes through tunnel

Post by Bebop » Sun Feb 27, 2011 9:26 am

You're doing OK so far, and are on the right track. Lets break it down and solve one problem at a time.
  • Problem 1: you would like client traffic to go through the VPN. Which means, you can visit a website such as whatismyip.com from your client, and see the external IP of your VPN server. Am I understanding the first part of your problem correctly?
First:

Code: Select all

push redirect-gateway 10.8.0.5


^ won't do anything.

The correct syntax is:

Code: Select all

push "redirect-gateway def1"
The above code will redirect every client's traffic through the VPN. Next will be a proper IPTABLES or firewall setup, because OpenVPN it-self does not do forwarding.

Something like:

Code: Select all

 iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
 iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
 iptables -A FORWARD -j REJECT
 iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

--------------------------------------------------------------
With the above done. Take a break. Make sure it all works.
If not working, ask again how to get it working.
--------------------------------------------------------------
  • Problem 2: Understand the local IP addressing
mrebbert wrote:It assigns 10.8.0.6 with a subnet 255.255.255.252 and a gateway of 10.8.0.5. Not sure where that is set though. Any insight?
If you want an IP addressing scheme which is less mind boggling then add:

Code: Select all

topology subnet
to your server.conf.

Then your default gateway will be 10.8.0.1, and your client IP's will automatically be assigned as 10.8.0.2, 10.8.0.3, 10.8.0.4, etc.
The cure for boredom is curiosity

mrebbert
OpenVpn Newbie
Posts: 5
Joined: Sat Feb 26, 2011 2:04 am

Re: Connects no errors but no data goes through tunnel

Post by mrebbert » Sun Feb 27, 2011 12:47 pm

So I did what you suggested and I am getting different results (so we are getting somewhere) however still no dice. So after removing my push statement and substituting yours now nothing works but pings to the gateway (10.8.0.1) on the client laptop. I turned off iptables to see if that was it and it was not. Tracert's to websites fail because it cannot resolve. Tracert's to ip's in my home network (with the exception of 10.8.0.1) fail from 1 on. According to my Client.log on my laptop it is accepting 128.0.0.0 128.0.0.0 10.8.0.5 and 0.0.0.0 128.0.0.0 10.8.0.5 so I believe the route on my laptop is right. For whatever reason it is not getting directed when it gets through the tunnel (my belief). Any other idea's? Need to see any logs, configs, etc...? I know the my VPNServer can reach out to the internet because thats what I am using to post this.

The funny thing is when I was using OpenVPNAS all this worked. Flawlessly. The only problem is once my server would reboot OpenVPNAS would not come up because of MD5 issues I was never able to fix. I would have to uninstall and reinstall openvpnas which clearly is not a good solution.

After I gave up on OpenVPNAS I reloaded Fedora 14 and loaded OpenVPN community and I have had just as much heart ache.

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Connects no errors but no data goes through tunnel

Post by janjust » Sun Feb 27, 2011 9:54 pm

if you're using OpenVPN on Fedora then make sure that selinux is not interfering; for debugging purposes you're best off to disable SELinux altogether . A quick&dirty method for doing this is rebooting the box with a boot loader flag
selinux=0

mrebbert
OpenVpn Newbie
Posts: 5
Joined: Sat Feb 26, 2011 2:04 am

Re: Connects no errors but no data goes through tunnel

Post by mrebbert » Sun Feb 27, 2011 10:09 pm

Yeah I tried that too to no avail. I have given up and given in. I don't think OpenVPN is really designed for Fedora 14 yet. I am not sure if it is dependencies that it's not catching, or just incompatibilities. I have given up though. Over 30 hours have gone into trying to get a linux VPN Server and while I am not a linux SA I do perform a lot of linux functions at work on RHEL 5.4 servers, I am a network engineer mainly. So I do think its a bit silly that so much time has been wasted. I have ultimately given in and loaded Windows Vista on the box and will try openvpn all windows (server and client). I expect that to go much smoother, plus I don't have to worry about setting up linux to windows file shares. Thanks for all the help though. And perhaps the windows installs will give me headaches as well. For this thread though I am hitting the final nail in the coffin. :(

User avatar
Bebop
Forum Team
Posts: 301
Joined: Wed Dec 15, 2010 9:24 pm

Re: Connects no errors but no data goes through tunnel

Post by Bebop » Mon Feb 28, 2011 4:46 am

mrebbert wrote:after removing my push statement and substituting yours now nothing works but pings to the gateway (10.8.0.1) on the client laptop
Definitely a good sign. To me that means the traffic is getting to the VPN server and getting no further ('good' means its not bypassing the VPN completely as it did before). I would take it to suggest a firewall/forwarding problem on the VPN server.

mrebbert wrote:Need to see any logs, configs, etc...?
Server.conf and Client.conf and IPTABLES rules would be ideal. Not necessarily logs yet.

I can show you a default working setup. Compare it to your own:

Server.conf

Code: Select all

port 1194
proto udp
dev tun
server 10.8.0.0 255.255.255.0

ca ca.crt
cert server.crt
key server.key
dh dh1024.pem

keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
log         ./openvpn.log
verb 3
Client.conf

Code: Select all

client
dev tun
proto udp
remote 333.333.333.333 #  <-- replace it with the public IP of VPN server
resolv-retry infinite
nobind
persist-key
persist-tun

ca ca.crt
cert client.crt
key client.key
ns-cert-type server

comp-lzo
verb 3
ping 10
ping-restart 60
firewall_setup_script.sh #chmod 755 and execute this from cmd line

Code: Select all

#!/bin/sh
# Accept responses to pings
iptables -A INPUT -p icmp -m icmp --icmp-type echo-reply -j ACCEPT
# Respond to pings
iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j ACCEPT
# Accept traceroutes
iptables -A INPUT -p udp -m udp --dport 33434:33523 -j ACCEPT
  
#Enable forwarding
 echo 1 > /proc/sys/net/ipv4/ip_forward

#Allow all TUN
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A OUTPUT -o tun+ -j ACCEPT
iptables -A FORWARD -o tun+ -j ACCEPT  
 
#Accept connections on 1194 
 iptables -A INPUT -p udp --dport 1194 -j ACCEPT
 
#Apply forwarding

 iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
 iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
 iptables -A FORWARD -j REJECT
 iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
 
# Display 
 iptables -L -v
mrebbert wrote:I turned off iptables to see if that was it and it was not
A considerable under-estimate of the role which IPTABLES plays in achieving your goal. No IPTABLES = no forwarding. Not only do you need to enable IPTABLES, but you also the the specific FORWARD and MASQUERADE rules listed above. Unless you have the above codes in your IPATBLES aready, then that is the reason for no dice.
Last edited by Bebop on Mon Feb 28, 2011 8:25 am, edited 1 time in total.
The cure for boredom is curiosity

User avatar
janjust
Forum Team
Posts: 2703
Joined: Fri Aug 20, 2010 2:57 pm
Location: Amsterdam
Contact:

Re: Connects no errors but no data goes through tunnel

Post by janjust » Mon Feb 28, 2011 8:22 am

I run OpenVPN 2.1.4 on Fedora 12, 13 and 14 without any issues, but I mostly use it in client mode; I will test it in 'server' mode today.
You're able to ping the VPN remote endpoint - that is a good start. Your routing table looks OK. Is IP forwarding enabled on the server? Is the firewall allowing inbound traffic on tun+? Forwarding traffic on tun+ ?
For debugging purposes, try

Code: Select all

echo 1 > /proc/sys/net/ipv4/ip_forward
/etc/init.d/iptables stop
(provided that your default firewall policy is not DROP)

Post Reply