LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-16-2013, 11:56 AM   #1
keymoo
Member
 
Registered: Jan 2002
Location: UK
Distribution: Desktop - Ubuntu, Server - Debian, CentOS
Posts: 72

Rep: Reputation: 15
OpenVPN client on CentOS 6.4 x64 headless server?


I have a Windows 7 workstation which connects to the internet through my CentOS 6.4 headless firewall/proxy/router. Is it possible to connect to the internet via an openVPN client on my CentOS 6.4 machine so that machines that route through CentOS go through the VPN? On my CentOS box I have Shorewall to configure iptables, with squid proxy. I have two NICs one external through my ADSL router on network 192.168.0.0 and one for my internal network 10.0.0.0. I want all clients on 10.0.0.0 connecting to the internet to connect via the VPN.

I am using www.privateinternetaccess.com as my destination VPN server.

Any help appreciated.
 
Old 09-16-2013, 12:29 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
If you have the VPN set up, it should just be setting the default route to use a gateway at privateinternetaccess.com instead of the one provided by your ISP. You may need to update your iptables rules also.

# list routes
route -n
# remove current default through ISP
route del default gw a.b.c.d
# add VPN gateway
route add default gw A.B.C.D
 
Old 09-16-2013, 01:12 PM   #3
keymoo
Member
 
Registered: Jan 2002
Location: UK
Distribution: Desktop - Ubuntu, Server - Debian, CentOS
Posts: 72

Original Poster
Rep: Reputation: 15
I don't have the VPN client, I'm wondering which one should I use that supports openVPN? Is there an rpm, etc?
 
Old 09-16-2013, 07:56 PM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
How about OpenVPN?
 
Old 09-17-2013, 05:02 AM   #5
keymoo
Member
 
Registered: Jan 2002
Location: UK
Distribution: Desktop - Ubuntu, Server - Debian, CentOS
Posts: 72

Original Poster
Rep: Reputation: 15
I have managed to make some progress. Here's what I've done so far.
Code:
yum install openvpn
Configured the openvpn server.conf file with

Code:
client
dev tun
proto udp
remote <REMOTE_SERVER_IP> 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
tls-client
remote-cert-tls server
auth-user-pass
comp-lzo
verb 1
reneg-sec 0
auth-nocache
auth-user-pass /root/.pia
started the openvpn client manually with:

Code:
# openvpn --config server.conf
Tue Sep 17 01:03:40 2013 OpenVPN 2.2.2 x86_64-unknown-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] built on Apr  5 2012
Tue Sep 17 01:03:40 2013 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Tue Sep 17 01:03:40 2013 LZO compression initialized
Tue Sep 17 01:03:40 2013 UDPv4 link local: [undef]
Tue Sep 17 01:03:40 2013 UDPv4 link remote: <REMOTE_SERVER_IP>:1194
Tue Sep 17 01:03:42 2013 [server] Peer Connection Initiated with <REMOTE_SERVER_IP>:1194
Tue Sep 17 01:03:44 2013 TUN/TAP device tun0 opened
Tue Sep 17 01:03:44 2013 /sbin/ip link set dev tun0 up mtu 1500
Tue Sep 17 01:03:44 2013 /sbin/ip addr add dev tun0 local 10.115.1.6 peer 10.115.1.5
Tue Sep 17 01:03:44 2013 Initialization Sequence Completed


# ifconfig tun0

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.118.1.6  P-t-P:10.118.1.5  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
If I try and do
Code:
# service openvpn start
Starting openvpn:                                          [FAILED]
If I can get the service started, I will then try and configure shorewall to use the tun0 interface.
 
  


Reply

Tags
centos6, vpnclient



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Directing OpenVPN client's traffic through the OpenVPN server mohtasham1983 Linux - Networking 1 01-17-2012 06:44 PM
How to login multiple client pc on using via openvpn server from client side raja6525 Linux - Networking 1 11-24-2010 09:42 AM
Any OpenVPN gui Client for Centos turiyain Linux - Desktop 2 08-23-2010 12:51 AM
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration