aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: amule and VPN tunnel  (Read 5329 times)

Magui

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
amule and VPN tunnel
« on: August 10, 2007, 04:50:00 AM »

I'll start by describing what I'm trying to do.  I am using a commercial service that provides a VPN tunnel for a fee.  I'm doing this to get myself some kind of anonymity while I run amule.  I'd like to restrict amule's Internet traffic to this VPN tunnel only, and use a normal connection to my ISP for all other Internet use.  Can I  configure amule to do this?  If so, how?  Any help would be much appreciated.

For those who care to read more...
I have been able to get amule to work through this tunnel (at least that 's what I thought) by changing the the tunnel properties so that all my Internet traffic goes through the tunnel, but this is not really the setup I want.  Moreover, I suspect that most ed2k connections established by amule (to other ed2k clients) are bypassing the tunnel and going directly through my ISP straight to my computer.  I would prefer to have all amule traffic go through the VPN to my ISP to my computer.   The reason I suspect this is that I am using conky to monitor all in-bound and out-bound network connections, and whenever I have amule running, it's showing me all the hostnames that have in-bound connections to my computer.  The port number that these hostnames are using matches the TCP port number that I specify in amule's preferences.  If all these ed2k connections were using the VPN tunnel, I wouldn't be seeing all these hostnames.  I would only see the one connection, to the VPN provider, and that's it.   At least, that's what I expect.

The software I am using to configure the VPN tunnel is pptpconfig, which seems to work well enough.  It also has a few options about the kind of routing you can choose:  Interface Only, Client to LAN, LAN to LAN, All to Tunnel.  amule works when I use "All to Tunnel", but I'd rather use something like "Client to LAN".

I should add that when I run Azureus (again, with the "All to Tunnel" option), conky doesn't show all the hostnames of the other bittorrent clients.  It shows just the VPN provider hostname in the list of connections.  I would like amule to do the same, but with all amule traffic going through the VPN tunnel, even the direct connections to other ed2k clients.

I did a search in this forum for "vpn" and I found this thread http://forum.amule.org/index.php?topic=9898.0.  This thread makes mention of an "Address" option in amule.conf, which it seems you can use to bind amule to an IP address.  I'm not sure what this means.  I was hoping that I could take the IP assigned to me by the VPN provider, and use this for "Address" in the conf file, but amule didn't work properly when I did that (kept getting lowid, and log messages about some trouble with my network connection).  When I used the "Bind to local IP address" in Azureus, with pptpconfig set to "Client to Tunnel", Azureus didn't quite work properly (kept showing DHT as firewalled, unable to get any connections to other peers or seeds on any active torrents).
Logged

Fred456

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 17
Re: amule and VPN tunnel
« Reply #1 on: September 01, 2007, 03:48:14 PM »

Hi there,
I have no experience yet with VPN but I was going to make a setup similar to yours. My worry was that some traffic would bypass the VPN. I've made some researches, you should have a look at http://openvpn.net/howto.html#redirect which explains how to route the entire traffic through VPN. This could be worth a look also http://www.tldp.org/HOWTO/text/VPN-HOWTO

Hope it helps.
Logged

skolnick

  • Global Moderator
  • Hero Member
  • *****
  • Karma: 24
  • Offline Offline
  • Posts: 1188
  • CentOS 6 User
Re: amule and VPN tunnel
« Reply #2 on: September 01, 2007, 11:26:33 PM »

You could bind aMule to the VPN interface, it has this option somewhere in opreferences.

Regards.
Logged

Magui

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: amule and VPN tunnel
« Reply #3 on: September 03, 2007, 09:36:30 AM »

Hi there,
I have no experience yet with VPN but I was going to make a setup similar to yours. My worry was that some traffic would bypass the VPN. I've made some researches, you should have a look at http://openvpn.net/howto.html#redirect which explains how to route the entire traffic through VPN. This could be worth a look also http://www.tldp.org/HOWTO/text/VPN-HOWTO

Hope it helps.

I got it working earlier today with Azureus.  Basically, I just did as this guy here http://forum.piratpartiet.se/Topic64139-164-1.aspx said (first post in the thread, a bit long).  His post is pretty well-written, and covers several different approaches to routing Internet traffic through a VPN tunnel.  Everything he writes is meant for somebody like me (using a PPTP VPN client to connect to a commercial VPN provider), so there is nothing there about OpenVPN or about running any kind of VPN server.  Using his instructions, I was able to get Azureus working just the way I wanted it.  I bound Azureus to some IP that I chose, and judging by what wireshark is telling me, all the Azureus traffic is now going through the tunnel interface (ppp0) and none of it through my default network interface (eth1).  If this is the kind of set-up you want, I strongly recommend reading through tephlon's post.  Replies in that thread also indicate that others have had success following his guidelines.

Now I have a routing set-up which I know works.  I just need to get amule to work with it.

I took a look at the two links you gave.  The OpenVPN link seems to be meant for people who have access to the VPN server (definitely not me).  I did have to add a rule to the POSTROUTING chain in the nat table, similar to the one they've got there, but the rule I used had a different action (not MASQUERADE), and I added one to the PREROUTING chain as well, and a few other rules.  The tldp link looked like a quick run-down on what VPN is, and how to get a server up and running.  I probably need to read up on that sometime.  Thanks for the links!
Logged

Magui

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: amule and VPN tunnel
« Reply #4 on: September 04, 2007, 07:21:49 AM »

You could bind aMule to the VPN interface, it has this option somewhere in opreferences.

Regards.
I didn't know about this for a long time, because I was using aMule 2.1.3.  Found out the CVS version has this option in Preferences, and that's what I'm running now.  So, with the VPN tunnel and routing set-up which works in Azureus, aMule seems to half-work.  That is, Kad works fine (it comes up "OK" within a few seconds of connecting, and the number of nodes begins to increase quickly, green arrow pops up in lower right-hand corner of the screen, etc.), but ed2k does not work.  ed2k basically behaves as if I'm blocked behind a firewall.  In the Log window, it gives me the message "Warning:  You have received LowID.  Most likely this is because you are behind a firewall or router" and so on, then it connects me to some server, and leaves a yellow arrow in the lower left-hand corner.  Even after running it for a couple of hours, nothing changes.  Meanwhile, with aMule continuing like this, I can start up Azureus, again using the VPN tunnel, and start seeding a torrent without any trouble (connect to the tracker OK, Azureus reports that my NAT set-up is OK, peers start downloading from me, etc.).

Another thing that I'm concerned about is that conky is showing that I have a direct connection to the ed2k server, on its port 4242.  On top of that, I occasionally see another connection established to some IP or hostname, on port 4662, as if some peer is using ed2k to connect directly to me.  I think this means that aMule has somehow bypassed the tunnel to connect to the ed2k server, which is not what I wanted (I'm trying to get all aMule traffic to go through the tunnel, not bypass it).

I must be missing something.  Using the "Bind to IP address" in aMule, I'm getting a different behavior from what I was expecting.  If you or anybody else has some additional thoughts on this, or can point to what I might be doing wrong, I would really appreciate it.  At this point, I'm wondering if I need to set up additional routing rules just to accomodate ed2k.  I just can't think of anything else to try.
Logged