Review your favorite Linux distribution.
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 06-29-2013, 09:13 AM   #1
LQ Newbie
Registered: Aug 2011
Posts: 24

Rep: Reputation: Disabled
Routing whole traffic through OpenVPN

I have such situation:
PCs ( -> (eth1 - Server1 (eth0 - + tun0 (as client) - -> Internet -> Server 2 (eth0 - + tun0 -

I would like to forward whole traffic from my network through OpenVPN, but i can't make this working.

OpenVPN is establieshed and it works. There is problem with routing. I've spent several hours to make this working but now luck.

What routes should I use?
Should I also use SNAT on Server2?

ip route add dev tun0 src table VPN
ip route add default via table VPN
ip rule add from table VPN
I'm able to ping I checked also TCPdump and seems that problem is in routing in Server2.
So now, Server2 routing table:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface UH    0      0        0 tun0 UH    0      0        0 lo   UG    0      0        0 tun0   U     0      0        0 eth0         UG    0      0        0 eth0
Server2: IPtables

iptables -vL (cut)
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  tun0   eth0    anywhere             anywhere
iptables -t nat -vL
Chain PREROUTING (policy ACCEPT 5598 packets, 489K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
  237 18277 MASQUERADE  all  --  any    eth0    anywhere             anywhere

Chain OUTPUT (policy ACCEPT 237 packets, 18277 bytes)
 pkts bytes target     prot opt in     out     source               destination
So i believe problem is in routing/NAT in Server2.
Can you please help?

Last edited by Kean; 06-29-2013 at 01:16 PM.


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
[SOLVED] routing all traffic from ppp0 to openvpn then masquerading it to LAN problem matters Slackware 18 03-22-2012 08:50 AM
Directing OpenVPN client's traffic through the OpenVPN server mohtasham1983 Linux - Networking 1 01-17-2012 06:44 PM
Error When converting Routing OpenVPN to bridge mode openvpn danmartinj Linux - Software 0 11-06-2009 09:23 AM
OpenVPN traffic routing on secondary IP problem dominos Linux - Networking 1 07-06-2009 10:42 PM
policy routing for HTTP traffic over OpenVPN mikeage Linux - Networking 1 05-21-2009 07:13 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:09 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration