LinuxQuestions.org
Visit Jeremy's Blog.
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 07-13-2012, 09:46 PM   #1
andrew44
LQ Newbie
 
Registered: Apr 2011
Posts: 28

Rep: Reputation: 0
IPTABLES ? - 1 ip in a different subnet push all traffic from that ip through vpn


Hi,

I have a linux machine that I use as a vpn openVPN server and a pptp client and home router.

I have another machine that I want to use for connecting to a foreign country. This machine does not need to connect to any other resources on the "home network".

How can I get IPTABLES or any other app to forward all traffic, TCP, UDP etc. everything this device might use through a VPN interface? I've tried a couple of things and its not working.

If the above doesn't work I do have space to put another NIC in the router. Whilst I'd rather not spend the money, if that is the only way to do it I'm open to that too.

Thanks
 
Old 07-14-2012, 11:15 AM   #2
andrew44
LQ Newbie
 
Registered: Apr 2011
Posts: 28

Original Poster
Rep: Reputation: 0
I see lots of views on this but no answers, do I need to rephrase the question? Or am I asking something that cant be done?
 
Old 07-18-2012, 03:40 AM   #3
SuperJediWombat!
Member
 
Registered: Apr 2009
Location: Perth, Australia
Distribution: Ubuntu/CentOS
Posts: 208

Rep: Reputation: 50
Your question is not very clear. It would help if you could draw up a basic network diagram showing the configuration that you are hoping to achieve.

Do you currently have a VPN connection to the foreign country you have specified?
 
Old 07-18-2012, 04:34 AM   #4
Lexus45
Member
 
Registered: Jan 2010
Location: Kurgan, Russia
Distribution: Slackware, Ubuntu
Posts: 339
Blog Entries: 3

Rep: Reputation: 47
There's an option in OpenVPN server configuration file, which allows to pass all client's traffic through the VPN link, making it a default gateway.
http://openvpn.net/index.php/open-so....html#examples

Code:
# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# the TUN/TAP interface to the internet in
# order for this to work properly).
# CAVEAT: May break client's network config if
# client's local DHCP server packets get routed
# through the tunnel.  Solution: make sure
# client's local DHCP server is reachable via
# a more specific route than the default route
# of 0.0.0.0/0.0.0.0.
;push "redirect-gateway"

Last edited by Lexus45; 07-18-2012 at 04:39 AM.
 
Old 07-18-2012, 11:25 PM   #5
andrew44
LQ Newbie
 
Registered: Apr 2011
Posts: 28

Original Poster
Rep: Reputation: 0
Thanks for the replies. I found a solution this afternoon, sourced based routing.

http://www.wlug.org.nz/SourceBasedRouting

http://www.tipsfortux.com/?p=10

It wasn't exactly what I wanted but it will do the job; I think the ideal would be destination based routing but I will look into that in the future.

Thanks for the replies.
 
  


Reply

Tags
client, router, vpn


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
IPTables unable to nat trough VPN traffic cygnusx Linux - Networking 1 04-27-2012 10:11 AM
Forcing all traffic through VPN (using iptables?) tbaac Linux - Networking 4 04-25-2011 09:24 AM
IPTABLES: Forward from VPN to LAN, Need traffic to appear as if its coming from LAN. a2brute Linux - Networking 3 11-17-2008 11:53 AM
Trying to configure shorewall to allow bridged vpn traffic to the local subnet perlchun Linux - Networking 4 06-25-2008 09:13 PM
IPTables Reroute Outing Traffic Through VPN Usogi Linux - Networking 6 04-11-2008 01:29 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration