Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 





Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Alternative Computing > Linux Support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Linux Support Linux - Operating Systems and Applications Support

Reply
 
Thread Tools
Old 04-23-2008, 06:41 AM   #1 (permalink)
Registered User
 
Join Date: Apr 2008
Posts: 4
OS: LINUX


Iptables/TC: how to make masqueraded traffic go through an openVPN tun0?

Hi all!

We have a setup of three computers;
Machine A (eth0) -> Machine B (eth0, hso0, tun0) -> Machine C (eth0, tun0)

hso0 is the packet interface of a 3G modem, it behaves like a normal network interface.

Machine B and C are connected in a VPN using openVPN (TCP). Machine A is a client that receives Network-configuration using DHCP from Machine B automatically.

Machine A eth0 : DHCP
Machine B eth0 : 192.168.2.1
Machine B hso0 : Static IP addr, Internet use
Machine B tun0 : 10.11.0.10 (openVPN client)
Machine C eth0 : Static IP addr, Internet use
Machine C tun0 : 10.11.0.1 (openVPN server)

OpenVPN (server) is configured to allow Internet-traffic to its clients. Code in server.conf:
# Make sure clients traverse tun0 when accessing Internet
push "redirect-gateway def1"
# Push a DNS server (handled by openVPN)
push "dhcp-option DNS 10.11.0.1"

We’re having issues to make Machine C release Internet traffic from Machine A. Note that we have setup masquerading on Machine B using iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE.
Currently Iptables on Machine B and Machine C have a policy of ACCEPT.

We have managed to make traffic from Machine A reach Machine C, but only with the internal IP of 192.168.2.48 (DHCP).
OpenVPN drops those packets (as it should!) because they come from 192.* and not 10.*

Is there a way to solve this? Thank you!
theVOID is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-24-2008, 07:43 PM   #2 (permalink)
Registered User
 
Join Date: Oct 2007
Location: Littleton, Colorado USA
Posts: 407
OS: xp 64 sp2 Fedora Core 8 (vmware xp core 8 x32) Minix


Re: Iptables/TC: how to make masqueraded traffic go through an openVPN tun0?

I don't think iptables will fix this. I think you need to look at the routing table. You want just the packets that go between your VPN networks to be tunneled. Everything else you want to go down the default route to the Internet and be masqueraded.

What does "/sbin/route -nv " say? I also thought that the VPN software was supposed to take care of routing issues.

Sorry I am not more help.
lensman3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-25-2008, 12:46 AM   #3 (permalink)
Registered User
 
Join Date: Apr 2008
Posts: 4
OS: LINUX


Re: Iptables/TC: how to make masqueraded traffic go through an openVPN tun0?

Hey there

Yes, that's correct. The following is the routing table on Machine B.

machine:~ # route -nv
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.11.0.1 10.11.0.9 255.255.255.255 UGH 0 0 0 tun0
10.11.0.9 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 hso1
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 hso0



Somewhere there, we've missed something.
theVOID is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 04-26-2008, 06:43 PM   #4 (permalink)
Registered User
 
Join Date: Oct 2007
Location: Littleton, Colorado USA
Posts: 407
OS: xp 64 sp2 Fedora Core 8 (vmware xp core 8 x32) Minix


Re: Iptables/TC: how to make masqueraded traffic go through an openVPN tun0?

See if you can put hso0 before hso1. That way packets go through hso1 before hso0. I didn't see where interface hso0 was in your first blog.

0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 hso0

I think the above route means all packets (0.0.0.0) coming from and going to go out hso0. The 10.11.* packets should go out through the tunnel.

Last edited by lensman3 : 04-26-2008 at 06:44 PM.
lensman3 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 08:31 AM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82