| Linode Forum https://forum.linode.com/ |
|
| OpenVPN DNS and Routing Issue https://forum.linode.com/viewtopic.php?f=19&t=4390 |
Page 1 of 2 |
| Author: | vista1821 [ Tue Jul 07, 2009 7:26 pm ] |
| Post subject: | OpenVPN DNS and Routing Issue |
Hi, I have been trying to configure an OpenVPN server on my Linode 360. I have configured the server and the client, a Vista laptop. The server starts fine and client connects to it just fine. However, I can only ping across the tunnel at what I think is the OpenVPN gateway (10.0.0.1). When I use tcpdump to scan tun0, tun0 shows the websites and icmp requests that I am sending. When I attempt to ping websites, the ping fails, as does nslookup, and tracert and 4.2.2.2. I have listed my server.conf and client.conf files below. Please help. client.conf client dev tun proto udp remote 97.x.x.x 1194 ping 10 resolv-retry infinite nobind persist-key persist-tun cipher bf-cbc ca ca1.crt cert client.crt key client.key ns-cert-type server comp-lzo pull verb 3 route-method exe route-delay 4 mssfix 1200 ifconfig 10.0.0.6 10.0.0.1 server.conf dev tun proto udp port 1194 tls-server ca ca.crt cert server.crt key server.key dh dh2048.pem server 10.0.0.0 255.255.255.0 keepalive 10 60 persist-key persist-tun cipher BF-CBC push "redirect-gateway def1" push "dhcp-option DNS 10.0.0.1" push "dhcp-option DNS 4.2.2.2" ifconfig 10.0.0.1 10.0.0.6 client-to-client comp-lzo |
|
| Author: | A-KO [ Tue Jul 07, 2009 7:38 pm ] |
| Post subject: | |
Interesting you bring this up. I have the exact same problem.... Last week I had to reboot my linode due to a memory crash, and ever since I haven't been able to get openvpn to work. Configs didn't change, iptables routing is set up as per the openvpn howto, and I've had this working for the past 6 months.... I made sure that /proc/sys/net/ipv4/ip_forward is set to 1. I am/was able to ping the internal IP of the other side of my vpn but unable to route out. server and client configs have not changed for openvpn. They are the same as they had always been... |
|
| Author: | vista1821 [ Tue Jul 07, 2009 7:59 pm ] |
| Post subject: | |
Are my .conf files correct? I have never setup OpenVPN without a class C IP before. So I am wondering, if I need to push a route, or I have overlooked something? |
|
| Author: | biovore [ Tue Jul 07, 2009 11:03 pm ] |
| Post subject: | OpenVPN Crash course |
OpenVPN configuration is a little weird. But here is the easy way to setup a local Certificate Authority and create self signed OpenVPN keys for roaming users to you. Here I am using the stock install of Debian 5.0 from linode. Step 1: create a /dev/net/tun device since linode's default install doesn't seem to have it, but tun/tap is compiled into the kernel. mknod /dev/net/tun c 10 200 Step 2: Install openVPN. In my case on ubuntu/debian just: (sudo or as root) apt-get install openVPN Step 3: Setup easy-rsa to create key system (as root) cp /usr/share/doc/openvpn/examples/easy-rsa/2.0/ /etc/openvpn/easy-rsa cd /etc/openvpn/easy-rsa edit the vars file and update varables as needed: export EASY_RSA="/etc/openvpn/easy-rsa" export KEY_DIR="../keys" Step 4: Create server & keys using easy-rsa: source ./vars ./clean-all ./build-ca -- Set Common name to OpenVPN-CA ./build-key-server server -- Set Common name to server ./build-dh Step 5: Create user keys to they can login. ./build-key <client_name> Files get output to /etc/openvpn/keys Here is the breakdown of the key files: Code: File Needed By Purpose Secret Simple Server Configuration File: server.conf Code:
Each client will need to have a folder that openVPN client uses. On windows this you can use the OpenVPN-GUI program and make a folder c:/program files/OpenVPN/config/myVPN In this folder place the users .crt .key files as well as the server's ca.crt file along with a myVPN.ovpn configuration file. (myVPN is a place holder for what every name you want) Code: ############################################## Happy VPNing |
|
| Author: | biovore [ Tue Jul 07, 2009 11:10 pm ] |
| Post subject: | route to other networks via VPN |
If you use the setup above, or some other setup that gets you some basic connectivity via openVPN. You can forward the tun0 interface like a NAT or modem so allow access to other network. You might need to push additional routes to the clients. push "route 172.16.16.0/24 255.255.255.0" for instance. if you want to route all network traffic from clients though the VPN and they then get there internet access from you, you will need to setup NAT masquerading and add a gateway line to the client's config. Hope this all helps someone.. |
|
| Author: | vista1821 [ Tue Jul 07, 2009 11:12 pm ] |
| Post subject: | |
Thank you. I will give it a try and report back. |
|
| Author: | efuoax [ Tue Jul 07, 2009 11:53 pm ] |
| Post subject: | check masquerade and routes |
Try to check if you linux box is marquerading your tun trafic ... someting like sudo iptables -t nat -A POSTROUTING -s ip.ra.n.ge/24 -o eth0 -j MASQUERADE, and check echo 1 > /proc/sys/net/ipv4/ip_forward also maybe you need to specify at your client were are dns , if your home router is giving you a dns server 192.168.0.x it would never be reached at tun interface, tell windows vista to route that traficc to local ethernet not tun interface best regards, Efuoax |
|
| Author: | vista1821 [ Wed Jul 08, 2009 12:08 am ] |
| Post subject: | |
I have completely elimindate iptables. IP forward is at 1 and I have followed biovore's instructions. I am still unable to route out and surf the web. Biovore, you mentioned "add a gateway line to the client's config." How can I do that? Thanks for your help. |
|
| Author: | biovore [ Wed Jul 08, 2009 12:13 am ] |
| Post subject: | |
you want to redirect all network traffic from the client though the VPN to the VPN server and out to the internet? Try adding the following line to the server configuration push "redirect-gateway def1" the do a masquerade with iptables to forward traffic and make all internet connection look like they came from the VPN server and not the client. iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE where eth0 port on the server is connected to the internet.. you could also do this vi tun0 interface a the souce iptables -t nat -A POSTROUTING -i tun0 -o eth0 -j MASQUERADE They have there advantages and drawbacks, but ether one would get the job done. |
|
| Author: | vista1821 [ Wed Jul 08, 2009 12:18 am ] |
| Post subject: | |
Yes I do. I have added push "redirect-gateway def1" in the server. |
|
| Author: | biovore [ Wed Jul 08, 2009 12:20 am ] |
| Post subject: | |
Is your client windows or linux? |
|
| Author: | vista1821 [ Wed Jul 08, 2009 12:23 am ] |
| Post subject: | |
Client is Windows Vista |
|
| Author: | biovore [ Wed Jul 08, 2009 12:32 am ] |
| Post subject: | |
There is a glitch that the default route sometimes doesn't get set on windows. if you open up a dos command box and type in "route print" you should see windows route table. you will notice that 0.0.0.0 is still pointing to your normal default gw. Thus nothing is going to the server. Might need to set the default GW manually. |
|
| Author: | vista1821 [ Wed Jul 08, 2009 12:39 am ] |
| Post subject: | |
This is what mine looks like. I think you are referring to the first line. IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.26 26 0.0.0.0 128.0.0.0 172.16.1.5 172.16.1.6 31 97.107.X.X 255.255.255.255 192.168.1.1 192.168.1.26 26 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 128.0.0.0 128.0.0.0 172.16.1.5 172.16.1.6 31 172.16.1.0 255.255.255.0 172.16.1.5 172.16.1.6 31 172.16.1.4 255.255.255.252 On-link 172.16.1.6 286 172.16.1.6 255.255.255.255 On-link 172.16.1.6 286 172.16.1.7 255.255.255.255 On-link 172.16.1.6 286 192.168.1.0 255.255.255.0 On-link 192.168.1.26 281 192.168.1.26 255.255.255.255 On-link 192.168.1.26 281 192.168.1.255 255.255.255.255 On-link 192.168.1.26 281 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 172.16.1.6 286 224.0.0.0 240.0.0.0 On-link 192.168.1.26 281 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 172.16.1.6 286 255.255.255.255 255.255.255.255 On-link 192.168.1.26 281 =========================================================================== |
|
| Author: | biovore [ Wed Jul 08, 2009 12:40 am ] |
| Post subject: | |
You you got it. If the route get pushed.. that first line shouldn't have 192.168.1.1 but should have 10.8.0.1 or whatever your using. Figured it out here though. Add "redirect-gateway" to the client config. Worked here. Windows OpenVPN client dosn't seem to respond correctly to server push. Add to client config file above: Code: # Redirect all traffic over VPN? Worked here. (Famous last words) If you loose all network connectivity, it works, you server nat/masquerade isn't setup right though. |
|
| Page 1 of 2 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|