LinuxQuestions.org
Help answer threads with 0 replies.
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 06-29-2013, 09:13 AM   #1
Kean
LQ Newbie
 
Registered: Aug 2011
Posts: 24

Rep: Reputation: Disabled
Routing whole traffic through OpenVPN


I have such situation:
PCs (172.20.21.0/24) -> (eth1 - 172.20.21.1) Server1 (eth0 - 66.77.88.99 + tun0 (as client) - 172.18.1.2) -> Internet -> Server 2 (eth0 - 11.22.33.44 + tun0 - 172.18.1.1)

I would like to forward whole traffic from my network 172.20.21.0/24 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?

Edit1:
Sever1:
Code:
ip route add 172.18.1.1 dev tun0 src 172.18.1.2 table VPN
ip route add default via 172.18.1.1 table VPN
ip rule add from 172.20.21.0/24 table VPN
I'm able to ping 66.77.88.99. I checked also TCPdump and seems that problem is in routing in Server2.
So now, Server2 routing table:
Kernel IP routing table
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.18.1.2      0.0.0.0         255.255.255.255 UH    0      0        0 tun0
127.0.0.0       0.0.0.0         255.255.255.255 UH    0      0        0 lo
172.20.21.0     172.18.1.2      255.255.255.0   UG    0      0        0 tun0
66.77.88.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         66.77.88.1      0.0.0.0         UG    0      0        0 eth0
Server2: IPtables

iptables -vL (cut)
Code:
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
Code:
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.
 
  


Reply


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


All times are GMT -5. The time now is 01:23 PM.

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