Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 10-10-2010, 03:09 AM   #1
LQ Newbie
Registered: Oct 2010
Posts: 2

Rep: Reputation: 0
OpenVPN, Squid and two networks. How to setup routing?


i hope this is the right place to post this problem!

I have a server with two different jobs, the first job is openvpn, the second is to be a proxy.
The sever has two network interfaces with two different networks (internet connections).
The first network is the internal network. This network has a 2 mbit internet connection with static ip which should be used to access the openvpn server. The second network is only a 16 mbit internet connection without staitc ip, this network should be used to access the internet (using the squid proxy).

And now the problem:
If i set the default gateway to network one (internal with 2mbit internet), i can establish a vpn connection using the static ip. Now the squid will use the 2mbit internet connection to access the internet, but the squid should use the other network (16mbit) to access the internt. The 2 mbit connection should only be used for vpn connection.
If i set the default gateway to network two (16 mbit internet), the squid will use this connection to access the internet, but i can't establish a vpn connection using the static ip. I can establish a vpn connection if i use the dynamic ip of the 16 mbit connection.

I don't know how to setup the server to use the 2mbit connection for vpn and the 16mbit connection for squid.

Does anybody know a solution without using two different computers?

Best regards,
Benjamin Tietze

PS: I hope my english is understandable.
Old 10-10-2010, 07:57 AM   #2
Senior Member
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
I suggest to take a look on IProute2 has rules for routing. You can probably divide your connections by source port or in some cases by destination port, mark connections with iptables and apply different routing rules.

There are a lot of examples around.

Last edited by nimnull22; 10-10-2010 at 08:02 AM.
Old 10-12-2010, 06:37 AM   #3
LQ Newbie
Registered: Oct 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Hi nimnull22,

thanks for your fast answer!

My linux and network knowhow isn't good enough to understand and find the right manual for my problem. I understand that i should set a rule for the openvpn port (1194 UDP) to use the gateway of network 1 (2MBit, static IP) and the default gateway should be the gateway of network 2.
But i don't know how to do this.

Can you give me little hit how to do this?


Best regards,
Benjamin Tietze


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
OpenVPN and Routing metallica1973 Linux - Networking 6 09-07-2010 07:50 AM
Error When converting Routing OpenVPN to bridge mode openvpn danmartinj Linux - Software 0 11-06-2009 09:23 AM
Complex OpenVPN setup and routing joadoor Linux - Networking 2 08-05-2008 08:28 PM
openVPN routing where local and remote networks clash andrewdodsworth Member Success Stories 0 09-11-2007 02:59 AM
LXer: How to bridge networks with OpenVPN LXer Syndicated Linux News 0 11-22-2006 04:03 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:12 AM.

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