PPTP VPN with auto-shutdown of torrent if connection is lost

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • PPTP VPN with auto-shutdown of torrent if connection is lost

      Reposting from the old forum...

      I have gotten iPredator up and running. Transmission is shut down if connection is lost.
      I have also uTorrent running and also controlled. I use uTorrent to finnish seeding my old torrents I moved from my old Windows server.

      I have also proxy running on the OMV-box which i surf through with my other computers. This way I surf annonymously with all computers.

      I guess you can use any other VPN service with this. Adapt your scripts to get it working.

      I found information to get all this to work from different sources on the internet, but I dont remember all of them. But thanks to all sources wherever they where.

      In this guide I have used 192.168.1.100 as OMV IP and 192.168.1.1 as router IP and port 8888 for tinyproxy.
      Modify this values to your needs.

      To save and exit from nano do:
      ctrl-o to save, ctrl-x to exit nano

      1. Install package pptp-linux, tinyproxy and dyndns if you use any

      Source Code

      1. sudo apt-get install pptp-linux tinyproxy dyndns


      2. Create the configuration files for VPN (ipredator in my case).

      Source Code

      1. sudo nano /etc/ppp/chap-secrets

      Paste this code, change it to your needs:

      Source Code

      1. # Secrets for authentication using CHAP
      2. # client server secret IP addresses
      3. YOUR_USERNAME ipredator "YOUR_PASSWORD" *


      Create ipredator configuration file:

      Source Code

      1. sudo nano /etc/ppp/peers/ipredator

      Paste this code, change to your needs:

      Source Code

      1. persist
      2. maxfail 0
      3. pty "pptp pptp.ipredator.se --nolaunchpppd"
      4. name YOUR_USERNAME
      5. remotename ipredator
      6. require-mppe-128
      7. file /etc/ppp/options.pptp
      8. ipparam ipredator
      9. updetach


      Edit options.conf:

      Source Code

      1. sudo nano /etc/ppp/options.pptp

      Paste this code:

      Source Code

      1. ###############################################################################
      2. # $Id: options.pptp,v 1.3 2006/03/26 23:11:05 quozl Exp $
      3. #
      4. # Sample PPTP PPP options file /etc/ppp/options.pptp
      5. # Options used by PPP when a connection is made by a PPTP client.
      6. # This file can be referred to by an /etc/ppp/peers file for the tunnel.
      7. # Changes are effective on the next connection. See "man pppd".
      8. #
      9. # You are expected to change this file to suit your system. As
      10. # packaged, it requires PPP 2.4.2 or later from http://ppp.samba.org/
      11. # and the kernel MPPE module available from the CVS repository also on
      12. # http://ppp.samba.org/, which is packaged for DKMS as kernel_ppp_mppe.
      13. ###############################################################################
      14. # Lock the port
      15. lock
      16. # Authentication
      17. # We don't need the tunnel server to authenticate itself
      18. noauth
      19. # We won't do PAP, EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2
      20. # (you may need to remove these refusals if the server is not using MPPE)
      21. #refuse-pap
      22. #refuse-eap
      23. #refuse-chap
      24. #refuse-mschap
      25. # Compression
      26. # Turn off compression protocols we know won't be used
      27. nobsdcomp
      28. nodeflate
      29. # Encryption
      30. # (There have been multiple versions of PPP with encryption support,
      31. # choose with of the following sections you will use. Note that MPPE
      32. # requires the use of MSCHAP-V2 during authentication)
      33. # http://ppp.samba.org/ the PPP project version of PPP by Paul Mackarras
      34. # ppp-2.4.2 or later with MPPE only, kernel module ppp_mppe.o
      35. # {{{
      36. # Require MPPE 128-bit encryption
      37. require-mppe-128
      38. # }}}
      39. # http://polbox.com/h/hs001/ fork from PPP project by Jan Dubiec
      40. # ppp-2.4.2 or later with MPPE and MPPC, kernel module ppp_mppe_mppc.o
      41. # {{{
      42. # Require MPPE 128-bit encryption
      43. #mppe required,stateless
      44. # }}}
      Display All


      Make the VPN connection to start on boot:

      Source Code

      1. sudo nano /etc/network/interfaces

      Add this at the end of the file:

      Source Code

      1. # Start ipredator VPN
      2. post-up pon ipredator &>/dev/null 2>&1


      To start manualy run:

      Source Code

      1. sudo pon ipredator

      To stop manualy run:

      Source Code

      1. sudo poff ipredator


      3. Create ip-up scripts
      Start thunneling all traffic through VPN:

      Source Code

      1. sudo nano /etc/ppp/ip-up.d/10-start-all-to-tunnel-routing

      Paste this code, change any IP to your needs:

      Shell-Script

      1. PRIMARY=eth0
      2. SERVER=$5
      3. GATEWAY="192.168.1.1"
      4. CONNECTION=$6
      5. if [ "${CONNECTION}" = "" ]; then CONNECTION=${PPP_IPPARAM}; fi
      6. TUNNEL=$1
      7. if [ "${TUNNEL}" = "" ]; then TUNNEL=${PPP_IFACE}; fi
      8. if [ "${CONNECTION}" = "ipredator" ] ; then
      9. route del ${SERVER} dev ${TUNNEL}
      10. if [ "${GATEWAY}" = "" ] ; then
      11. route add -host ${SERVER} dev ${PRIMARY}
      12. else
      13. route add -host ${SERVER} gw ${GATEWAY} dev ${PRIMARY}
      14. fi
      15. route del default ${PRIMARY}
      16. route add default dev ${TUNNEL}
      17. fi
      Display All


      Start transmission:

      Source Code

      1. sudo nano /etc/ppp/ip-up.d/80-start-transmission

      Paste this code:

      Shell-Script

      1. /etc/init.d/transmission-daemon start


      Update dyndns if you use any:

      Source Code

      1. sudo nano /etc/ppp/ip-up.d/90-update-dyndns

      Paste this code:

      Shell-Script

      1. /usr/bin/dyndns --config /etc/dyndns/dyndns.conf


      4. Create ip-down scripts
      Stop transmission daemon:

      Source Code

      1. sudo nano /etc/ppp/ip-down.d/10-stop-transmission

      Paste this code:

      Shell-Script

      1. /etc/init.d/transmission-daemon stop


      I also created this to be on the safe side:

      Source Code

      1. sudo nano /etc/ppp/ip-down.d/20-kill-transmission

      Paste this code:

      Shell-Script

      1. killall transmission-daemon


      Stop thunneling all traffic through VPN:

      Source Code

      1. sudo nano /etc/ppp/ip-down.d/80-stop-all-to-tunnel-routing

      Paste this code, change any IP to your needs:

      Shell-Script

      1. PRIMARY=eth0
      2. SERVER=$5
      3. GATEWAY="192.168.1.1"
      4. CONNECTION=$6
      5. if [ "${CONNECTION}" = "" ]; then CONNECTION=${PPP_IPPARAM}; fi
      6. TUNNEL=$1
      7. if [ "${TUNNEL}" = "" ]; then TUNNEL=${PPP_IFACE}; fi
      8. if [ "${CONNECTION}" = "ipredator" ] ; then
      9. route del default ${TUNNEL}
      10. route del ${SERVER} dev eth0
      11. if [ "${GATEWAY}" = "" ] ; then
      12. route add default dev ${PRIMARY}
      13. else
      14. route add default gw ${GATEWAY} dev ${PRIMARY}
      15. fi
      16. fi
      Display All


      Update dyndns if you have any:

      Source Code

      1. sudo nano /etc/ppp/ip-down.d/90-update-dyndns

      Paste this code:

      Shell-Script

      1. /usr/bin/dyndns --config /etc/dyndns/dyndns.conf


      Make ip-up and ip-down scrips executable:

      Source Code

      1. sudo chmod +x /etc/ppp/ip-down.d/10-stop-transmission \
      2. /etc/ppp/ip-down.d/20-kill-transmission \
      3. /etc/ppp/ip-down.d/80-stop-all-to-tunnel-routing \
      4. /etc/ppp/ip-down.d/90-update-dyndns \
      5. /etc/ppp/ip-up.d/10-start-all-to-tunnel-routing \
      6. /etc/ppp/ip-up.d/80-start-transmission \
      7. /etc/ppp/ip-up.d/90-update-dyndns


      5. Configure tinyproxy:

      Source Code

      1. sudo nanno /etc/tinyproxy.conf

      Paste this code, edit ipadresses and ports to your needs:

      Source Code

      1. ##
      2. ## tinyproxy.conf -- tinyproxy daemon configuration file
      3. ##
      4. ## This example tinyproxy.conf file contains example settings
      5. ## with explanations in comments. For decriptions of all
      6. ## parameters, see the tinproxy.conf(5) manual page.
      7. ##
      8. #
      9. # User/Group: This allows you to set the user and group that will be
      10. # used for tinyproxy after the initial binding to the port has been done
      11. # as the root user. Either the user or group name or the UID or GID
      12. # number may be used.
      13. #
      14. User nobody
      15. Group nogroup
      16. #
      17. # Port: Specify the port which tinyproxy will listen on. Please note
      18. # that should you choose to run on a port lower than 1024 you will need
      19. # to start tinyproxy using root.
      20. #
      21. Port 8888
      22. #
      23. # Listen: If you have multiple interfaces this allows you to bind to
      24. # only one. If this is commented out, tinyproxy will bind to all
      25. # interfaces present.
      26. #
      27. Listen 192.168.1.100
      28. #
      29. # Bind: This allows you to specify which interface will be used for
      30. # outgoing connections. This is useful for multi-home'd machines where
      31. # you want all traffic to appear outgoing from one particular interface.
      32. #
      33. #Bind 192.168.0.1
      34. #
      35. # BindSame: If enabled, tinyproxy will bind the outgoing connection to the
      36. # ip address of the incoming connection.
      37. #
      38. #BindSame yes
      39. #
      40. # Timeout: The maximum number of seconds of inactivity a connection is
      41. # allowed to have before it is closed by tinyproxy.
      42. #
      43. Timeout 600
      44. #
      45. # ErrorFile: Defines the HTML file to send when a given HTTP error
      46. # occurs. You will probably need to customize the location to your
      47. # particular install. The usual locations to check are:
      48. # /usr/local/share/tinyproxy
      49. # /usr/share/tinyproxy
      50. # /etc/tinyproxy
      51. #
      52. #ErrorFile 404 "/usr/share/tinyproxy/404.html"
      53. #ErrorFile 400 "/usr/share/tinyproxy/400.html"
      54. #ErrorFile 503 "/usr/share/tinyproxy/503.html"
      55. #ErrorFile 403 "/usr/share/tinyproxy/403.html"
      56. #ErrorFile 408 "/usr/share/tinyproxy/408.html"
      57. #
      58. # DefaultErrorFile: The HTML file that gets sent if there is no
      59. # HTML file defined with an ErrorFile keyword for the HTTP error
      60. # that has occured.
      61. #
      62. DefaultErrorFile "/usr/share/tinyproxy/default.html"
      63. #
      64. # StatHost: This configures the host name or IP address that is treated
      65. # as the stat host: Whenever a request for this host is received,
      66. # Tinyproxy will return an internal statistics page instead of
      67. # forwarding the request to that host. The default value of StatHost is
      68. # tinyproxy.stats.
      69. #
      70. #StatHost "tinyproxy.stats"
      71. #
      72. #
      73. # StatFile: The HTML file that gets sent when a request is made
      74. # for the stathost. If this file doesn't exist a basic page is
      75. # hardcoded in tinyproxy.
      76. #
      77. StatFile "/usr/share/tinyproxy/stats.html"
      78. #
      79. # Logfile: Allows you to specify the location where information should
      80. # be logged to. If you would prefer to log to syslog, then disable this
      81. # and enable the Syslog directive. These directives are mutually
      82. # exclusive.
      83. #
      84. Logfile "/var/log/tinyproxy/tinyproxy.log"
      85. #
      86. # Syslog: Tell tinyproxy to use syslog instead of a logfile. This
      87. # option must not be enabled if the Logfile directive is being used.
      88. # These two directives are mutually exclusive.
      89. #
      90. #Syslog On
      91. #
      92. # LogLevel:
      93. #
      94. # Set the logging level. Allowed settings are:
      95. # Critical (least verbose)
      96. # Error
      97. # Warning
      98. # Notice
      99. # Connect (to log connections without Info's noise)
      100. # Info (most verbose)
      101. #
      102. # The LogLevel logs from the set level and above. For example, if the
      103. # LogLevel was set to Warning, then all log messages from Warning to
      104. # Critical would be output, but Notice and below would be suppressed.
      105. #
      106. LogLevel Info
      107. #
      108. # PidFile: Write the PID of the main tinyproxy thread to this file so it
      109. # can be used for signalling purposes.
      110. #
      111. PidFile "/var/run/tinyproxy/tinyproxy.pid"
      112. #
      113. # XTinyproxy: Tell Tinyproxy to include the X-Tinyproxy header, which
      114. # contains the client's IP address.
      115. #
      116. #XTinyproxy Yes
      117. #
      118. # Upstream:
      119. #
      120. # Turns on upstream proxy support.
      121. #
      122. # The upstream rules allow you to selectively route upstream connections
      123. # based on the host/domain of the site being accessed.
      124. #
      125. # For example:
      126. # # connection to test domain goes through testproxy
      127. # upstream testproxy:8008 ".test.domain.invalid"
      128. # upstream testproxy:8008 ".our_testbed.example.com"
      129. # upstream testproxy:8008 "192.168.128.0/255.255.254.0"
      130. #
      131. # # no upstream proxy for internal websites and unqualified hosts
      132. # no upstream ".internal.example.com"
      133. # no upstream "www.example.com"
      134. # no upstream "10.0.0.0/8"
      135. # no upstream "192.168.0.0/255.255.254.0"
      136. # no upstream "."
      137. #
      138. # # connection to these boxes go through their DMZ firewalls
      139. # upstream cust1_firewall:8008 "testbed_for_cust1"
      140. # upstream cust2_firewall:8008 "testbed_for_cust2"
      141. #
      142. # # default upstream is internet firewall
      143. # upstream firewall.internal.example.com:80
      144. #
      145. # The LAST matching rule wins the route decision. As you can see, you
      146. # can use a host, or a domain:
      147. # name matches host exactly
      148. # .name matches any host in domain "name"
      149. # . matches any host with no domain (in 'empty' domain)
      150. # IP/bits matches network/mask
      151. # IP/mask matches network/mask
      152. #
      153. #Upstream some.remote.proxy:port
      154. #
      155. # MaxClients: This is the absolute highest number of threads which will
      156. # be created. In other words, only MaxClients number of clients can be
      157. # connected at the same time.
      158. #
      159. MaxClients 100
      160. #
      161. # MinSpareServers/MaxSpareServers: These settings set the upper and
      162. # lower limit for the number of spare servers which should be available.
      163. #
      164. # If the number of spare servers falls below MinSpareServers then new
      165. # server processes will be spawned. If the number of servers exceeds
      166. # MaxSpareServers then the extras will be killed off.
      167. #
      168. MinSpareServers 5
      169. MaxSpareServers 20
      170. #
      171. # StartServers: The number of servers to start initially.
      172. #
      173. StartServers 10
      174. #
      175. # MaxRequestsPerChild: The number of connections a thread will handle
      176. # before it is killed. In practise this should be set to 0, which
      177. # disables thread reaping. If you do notice problems with memory
      178. # leakage, then set this to something like 10000.
      179. #
      180. MaxRequestsPerChild 0
      181. #
      182. # Allow: Customization of authorization controls. If there are any
      183. # access control keywords then the default action is to DENY. Otherwise,
      184. # the default action is ALLOW.
      185. #
      186. # The order of the controls are important. All incoming connections are
      187. # tested against the controls based on order.
      188. #
      189. Allow 127.0.0.1
      190. Allow 192.168.1.0/24
      191. #Allow 172.16.0.0/12
      192. #Allow 10.0.0.0/8
      193. #
      194. # AddHeader: Adds the specified headers to outgoing HTTP requests that
      195. # Tinyproxy makes. Note that this option will not work for HTTPS
      196. # traffic, as Tinyproxy has no control over what headers are exchanged.
      197. #
      198. #AddHeader "X-My-Header" "Powered by Tinyproxy"
      199. #
      200. # ViaProxyName: The "Via" header is required by the HTTP RFC, but using
      201. # the real host name is a security concern. If the following directive
      202. # is enabled, the string supplied will be used as the host name in the
      203. # Via header; otherwise, the server's host name will be used.
      204. #
      205. ViaProxyName "tinyproxy"
      206. #
      207. # DisableViaHeader: When this is set to yes, Tinyproxy does NOT add
      208. # the Via header to the requests. This virtually puts Tinyproxy into
      209. # stealth mode. Note that RFC 2616 requires proxies to set the Via
      210. # header, so by enabling this option, you break compliance.
      211. # Don't disable the Via header unless you know what you are doing...
      212. #
      213. DisableViaHeader Yes
      214. #
      215. # Filter: This allows you to specify the location of the filter file.
      216. #
      217. #Filter "/etc/filter"
      218. #
      219. # FilterURLs: Filter based on URLs rather than domains.
      220. #
      221. #FilterURLs On
      222. #
      223. # FilterExtended: Use POSIX Extended regular expressions rather than
      224. # basic.
      225. #
      226. #FilterExtended On
      227. #
      228. # FilterCaseSensitive: Use case sensitive regular expressions.
      229. #
      230. #FilterCaseSensitive On
      231. #
      232. # FilterDefaultDeny: Change the default policy of the filtering system.
      233. # If this directive is commented out, or is set to "No" then the default
      234. # policy is to allow everything which is not specifically denied by the
      235. # filter file.
      236. #
      237. # However, by setting this directive to "Yes" the default policy becomes
      238. # to deny everything which is _not_ specifically allowed by the filter
      239. # file.
      240. #
      241. #FilterDefaultDeny Yes
      242. #
      243. # Anonymous: If an Anonymous keyword is present, then anonymous proxying
      244. # is enabled. The headers listed are allowed through, while all others
      245. # are denied. If no Anonymous keyword is present, then all headers are
      246. # allowed through. You must include quotes around the headers.
      247. #
      248. # Most sites require cookies to be enabled for them to work correctly, so
      249. # you will need to allow Cookies through if you access those sites.
      250. #
      251. #Anonymous "Host"
      252. #Anonymous "Authorization"
      253. #Anonymous "From"
      254. #Anonymous "Referer"
      255. #Anonymous "Server"
      256. #Anonymous "WWW-Authenticate"
      257. #Anonymous "Link"
      258. #Anonymous "Cookie"
      259. #
      260. # ConnectPort: This is a list of ports allowed by tinyproxy when the
      261. # CONNECT method is used. To disable the CONNECT method altogether, set
      262. # the value to 0. If no ConnectPort line is found, all ports are
      263. # allowed (which is not very secure.)
      264. #
      265. # The following two ports are used by SSL.
      266. #
      267. ConnectPort 443
      268. ConnectPort 563
      269. #
      270. # Configure one or more ReversePath directives to enable reverse proxy
      271. # support. With reverse proxying it's possible to make a number of
      272. # sites appear as if they were part of a single site.
      273. #
      274. # If you uncomment the following two directives and run tinyproxy
      275. # on your own computer at port 8888, you can access Google using
      276. # http://localhost:8888/google/ and Wired News using
      277. # http://localhost:8888/wired/news/. Neither will actually work
      278. # until you uncomment ReverseMagic as they use absolute linking.
      279. #
      280. #ReversePath "/google/" "http://www.google.com/"
      281. #ReversePath "/wired/" "http://www.wired.com/"
      282. #
      283. # When using tinyproxy as a reverse proxy, it is STRONGLY recommended
      284. # that the normal proxy is turned off by uncommenting the next directive.
      285. #
      286. #ReverseOnly Yes
      287. #
      288. # Use a cookie to track reverse proxy mappings. If you need to reverse
      289. # proxy sites which have absolute links you must uncomment this.
      290. #
      291. #ReverseMagic Yes
      292. #
      293. # The URL that's used to access this reverse proxy. The URL is used to
      294. # rewrite HTTP redirects so that they won't escape the proxy. If you
      295. # have a chain of reverse proxies, you'll need to put the outermost
      296. # URL here (the address which the end user types into his/her browser).
      297. #
      298. # If not set then no rewriting occurs.
      299. #
      300. #ReverseBaseURL "http://localhost:8888/"
      Display All


      6. Update dyndns script

      Source Code

      1. sudo nano /etc/dyndns/dyndns.conf

      Paste this code, change it to your needs:

      Source Code

      1. # http://www.nongnu.org/perl-dyndns/manual/
      2. # /etc/dyndns/dyndns.conf
      3. # Set to "yes" to make this configuration file excluded
      4. # from updates.
      5. disable = no # [default]
      6. #ethernet = ppp0 # [default]
      7. host = YOUR_DYNDNS_NAME # mydns.dyndns.org
      8. # Details how to get the world known IP address, in case the standard
      9. # Linux 'ifconfig' or Windows 'ipconfig' programs cannot be used. This
      10. # interests mainly Cable, DSL and router owners. NOTE: You may
      11. # not use all these options. E.g. [urlping-linksys4] is alternate
      12. # to [urlping] etc. See documentation.
      13. #urlping = "http://checkip.dyndns.org/"
      14. #urlping-regexp = (?:Current\s+IP\s+Address:)\s+([\d.]+)
      15. #urlping = "http://myip.dk/"
      16. #urlping-regexp = [Ii][Pp]\s*[Aa]ddress:[^>]*>[^>]*>([0-9.]+)
      17. #urlping-regexp = >([0-9.]+)
      18. urlping = "http://www.cmyip.com/"
      19. urlping-regexp = My\s+IP\s+Address\s+Is\s+([\d.]+)
      20. # Hou need this option only if you have multiple ethernet cards.
      21. # After which regexp the IP number appers in ifconfig(1) listing?
      22. # regexp = .*0xffffffff.*?inet
      23. # Where IPs are stored. Directory name or Directory name with
      24. # additional file prefix. The directory part must exist. You could
      25. # say 'file = /var/log/dyndns/' but that's the default.
      26. file = default # Use OS's default location
      27. # The DDNS account details
      28. login = YOUR_DYNDNS_LOGIN
      29. password = YOUR_DYNDNS_PASSWORD
      30. provider = dyndns # [default]
      31. # proxy = myproxy.myisp.net # set only if needed for HTTP calls
      32. # What account are you using? Select 'dyndns|statdns|custom'
      33. system = dyndns # Provider [dyndns] only
      34. # Yes, delegate all *.mydomain.dyndns.org calls
      35. wildcard = 1
      36. # If you route mail. See dyndns.org documentation for details
      37. # how to set up MX records. If you know nothing about DNS/BIND
      38. # Don't even consider using this option. Misuse or broken
      39. # DNS at your end will probably terminate your 'free' dyndns contract.
      40. # mxhost = mxhost.dyndns.org
      Display All


      Configure your browser proxy-settings to connect throught tinyproxy on your OMV-server:
      192.168.1.100:8888

      I think that was all. I hope it works for you!
      OMV x64 running on:
      Asus E45M1-I DELUXE mini-ITX / AMD E-450 / HD 6320
      8GB DDR3 (2x4GB)
      5x3TB SATA6 Western Digital Caviar Green IntelliPower in RAID5
      All living inside a Fractal Design Array R2.
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      Thank you mastayoda!

      I used your guide and now I have a working pptp.
      I have encountered a well-known problem when syslog is filled with thousands of following lines:

      Source Code

      1. pptp... buffering packet XXXXX (expecting XXXXX, lost or reordered)

      As a result syslog is gowning very fast.
      Also the connection was a lot slower compared to the windows pc connected to the same router.

      I tried the following:

      1. Changed the following line in peer config to disable buffering and reduce the number of messages:

      Source Code

      1. pty "pptp pptp.ipredator.se --nolaunchpppd --nobuffer --loglevel 0"

      I am not sure if this would completely resolve the syslog problem, need to test more.

      2. Tried different mtu sizes and found that 1492 (somehow :roll: ) offers better speed for my connection.

      Do you think the same kind of setup can be based on ipsec instead of pptp?
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      I did not see this problem when using ipredator, but I changed to another VPN and also got the same problem you describe (reordered packets). The connection also dropped all the time. This due to crappy pptp protocol or something.
      I ended up recompiling pptp with a patch here: osdir.com/ml/ubuntu-bugs/2012-04/msg16070.html.

      Now I have not seen the problem since and no more lost connections.

      I believe you can use the method on other protocols. I tried l2tp, but it was to much work to get it running, so I decided to go along with pptp.

      //
      Jimmy
      OMV x64 running on:
      Asus E45M1-I DELUXE mini-ITX / AMD E-450 / HD 6320
      8GB DDR3 (2x4GB)
      5x3TB SATA6 Western Digital Caviar Green IntelliPower in RAID5
      All living inside a Fractal Design Array R2.
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      The latest script from jhmiller just introduced the install of deluge on this thread: forums.openmediavault.org/view…?f=13&t=6&start=420#p7620

      I am thinking of adopting the same method for start/stopping the services to deluge and sabnzbd.
      I think I need to fo the following:
      ------------------------------
      Start deluge daemon:

      Source Code

      1. sudo nano /etc/ppp/ip-up.d/81-start-deluge

      The code:

      Shell-Script

      1. /etc/init.d/deluge-daemon start

      Stop deluge daemon:

      Source Code

      1. sudo nano /etc/ppp/ip-down.d/11-stop-deluge

      The code:

      Shell-Script

      1. /etc/init.d/deluge-daemon stop

      ------------------------------
      Start SABnzbd daemon:

      Source Code

      1. sudo nano /etc/ppp/ip-up.d/82-start-SABnzbd

      The code:

      Shell-Script

      1. /etc/init.d/SABnzbd start

      Stop SABnzbd daemon:

      Source Code

      1. sudo nano /etc/ppp/ip-down.d/12-stop-SABnzbd

      The code:

      Shell-Script

      1. /etc/init.d/SABnzbd stop

      ----------------------------------
      Make all scrips executable:

      Source Code

      1. sudo chmod +x [new scripts]

      ----------------------------------
      I encountered a small problem with deluge: it does not connect webui to localhost daemon at startup by default.
      So if connection had been lost and daemon was stopped you have to re-connect it.
      It can be fixed it by changing the config file.

      Note: log out of deluge webui first or your changes will be overwritten!

      Open deluge config file:

      Source Code

      1. nano ~/.config/deluge/web.conf

      The line

      Source Code

      1. "default_daemon": ""

      ... should be replaced with:

      Source Code

      1. "default_daemon": "127.0.0.1:58846"
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      The connection seems very odd to me - it appears to connect but I get connection errors immediately after when I try to search nzb providers with SickBeard for ex. when the VPN connection is made (sudo pon ipvanish). Do I need to modify the firewall rules or something else to complete this? I haven't made any more changes after following Masteryoda's setup...and adding your SABnzbd up/down addition. Thanks for you both for posting this!

      Here is the output from running 'sudo pon ipvanish' with debug switched on:

      Source Code

      1. root@MARKIOFS:/etc/ppp/peers# sudo pon ipvanish
      2. pppd options in effect:
      3. debug # (from /etc/ppp/options.pptp)
      4. updetach # (from /etc/ppp/peers/ipvanish)
      5. persist # (from /etc/ppp/peers/ipvanish)
      6. maxfail 0 # (from /etc/ppp/peers/ipvanish)
      7. dump # (from /etc/ppp/options.pptp)
      8. noauth # (from /etc/ppp/options.pptp)
      9. name javagenki # (from /etc/ppp/peers/ipvanish)
      10. remotename ipvanish # (from /etc/ppp/peers/ipvanish)
      11. # (from /etc/ppp/options.pptp)
      12. pty pptp lax-a01.ipvanish.com --nolaunchpppd # (from /etc/ppp/peers/ipvanish)
      13. crtscts # (from /etc/ppp/options)
      14. # (from /etc/ppp/options)
      15. asyncmap 0 # (from /etc/ppp/options)
      16. lcp-echo-failure 4 # (from /etc/ppp/options)
      17. lcp-echo-interval 30 # (from /etc/ppp/options)
      18. hide-password # (from /etc/ppp/options)
      19. ipparam ipvanish # (from /etc/ppp/peers/ipvanish)
      20. nobsdcomp # (from /etc/ppp/options.pptp)
      21. nodeflate # (from /etc/ppp/options.pptp)
      22. require-mppe-128 # (from /etc/ppp/options.pptp)
      23. noipx # (from /etc/ppp/options)
      24. using channel 20
      25. Using interface ppp0
      26. Connect: ppp0 <--> /dev/pts/1
      27. sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xea1e6d26> <pcomp> <accomp>]
      28. rcvd [LCP ConfReq id=0x1 <mru 1396> <asyncmap 0x0> <auth chap MS-v2> <magic 0x7bded1ab> <pcomp> <accomp>]
      29. sent [LCP ConfAck id=0x1 <mru 1396> <asyncmap 0x0> <auth chap MS-v2> <magic 0x7bded1ab> <pcomp> <accomp>]
      30. rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xea1e6d26> <pcomp> <accomp>]
      31. sent [LCP EchoReq id=0x0 magic=0xea1e6d26]
      32. rcvd [CHAP Challenge id=0xca <bc608a346b0a6a395d0045d2dfd9fe50>, name = "pptpd"]
      33. sent [CHAP Response id=0xca <df3ae75d7ce8ef0034148bf7673b720f000000000000000053ee82a2fb1c5b47065ae6469e4c7a37132dbfb317bd710200>, name = "javagenki"]
      34. rcvd [LCP EchoRep id=0x0 magic=0x7bded1ab]
      35. rcvd [CHAP Success id=0xca "S=91CC9656A9EE69D91C9E72A06916072AE83DCDF8"]
      36. CHAP authentication succeeded
      37. sent [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
      38. rcvd [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
      39. sent [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
      40. rcvd [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
      41. MPPE 128-bit stateless compression enabled
      42. sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>]
      43. rcvd [IPCP ConfReq id=0x1 <addr 69.16.172.130>]
      44. sent [IPCP ConfAck id=0x1 <addr 69.16.172.130>]
      45. rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
      46. sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>]
      47. rcvd [IPCP ConfNak id=0x2 <addr 172.20.0.3>]
      48. sent [IPCP ConfReq id=0x3 <addr 172.20.0.3>]
      49. rcvd [IPCP ConfAck id=0x3 <addr 172.20.0.3>]
      50. local IP address 172.20.0.3
      51. remote IP address 69.16.172.130
      52. root@MARKIOFS:/etc/ppp/peers#
      Display All


      And ifconfig output:

      Source Code

      1. root@MARKIOFS:/etc/ppp/peers# ifconfig
      2. eth0 Link encap:Ethernet HWaddr e4:11:5b:12:b7:87
      3. inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
      4. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
      5. RX packets:8869375 errors:0 dropped:0 overruns:0 frame:0
      6. TX packets:23260321 errors:0 dropped:0 overruns:0 carrier:0
      7. collisions:0 txqueuelen:1000
      8. RX bytes:7167232082 (6.6 GiB) TX bytes:30689965161 (28.5 GiB)
      9. Interrupt:18
      10. lo Link encap:Local Loopback
      11. inet addr:127.0.0.1 Mask:255.0.0.0
      12. UP LOOPBACK RUNNING MTU:16436 Metric:1
      13. RX packets:1077880 errors:0 dropped:0 overruns:0 frame:0
      14. TX packets:1077880 errors:0 dropped:0 overruns:0 carrier:0
      15. collisions:0 txqueuelen:0
      16. RX bytes:312200355 (297.7 MiB) TX bytes:312200355 (297.7 MiB)
      17. ppp0 Link encap:Point-to-Point Protocol
      18. inet addr:172.20.0.3 P-t-P:69.16.172.130 Mask:255.255.255.255
      19. UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1392 Metric:1
      20. RX packets:30 errors:0 dropped:0 overruns:0 frame:0
      21. TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
      22. collisions:0 txqueuelen:3
      23. RX bytes:1236 (1.2 KiB) TX bytes:1998 (1.9 KiB)
      Display All


      Thanks Laowai.
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      I'm begining to wonder if it might be a DNS issue???

      With pptp off I can ping google.com for ex but with pptp on google.com is not resolved.

      Did you have to configure DNS in some way - via OMV or router?

      Source Code

      1. root@MARKIOFS:/# sudo poff ipvanish
      2. /usr/bin/poff: No pppd is running. None stopped.
      3. root@MARKIOFS:/# ping google.com
      4. PING google.com (173.194.33.2) 56(84) bytes of data.
      5. 64 bytes from sea09s01-in-f2.1e100.net (173.194.33.2): icmp_req=1 ttl=55 time=10.8 ms
      6. 64 bytes from sea09s01-in-f2.1e100.net (173.194.33.2): icmp_req=2 ttl=55 time=9.84 ms
      7. 64 bytes from sea09s01-in-f2.1e100.net (173.194.33.2): icmp_req=3 ttl=55 time=13.6 ms
      8. 64 bytes from sea09s01-in-f2.1e100.net (173.194.33.2): icmp_req=4 ttl=55 time=10.1 ms
      9. ^C
      10. --- google.com ping statistics ---
      11. 4 packets transmitted, 4 received, 0% packet loss, time 3003ms
      12. rtt min/avg/max/mdev = 9.840/11.135/13.671/1.514 ms
      13. root@MARKIOFS:/# sudo pon ipvanish
      14. Using interface ppp0
      15. Connect: ppp0 <--> /dev/pts/0
      16. CHAP authentication succeeded
      17. MPPE 128-bit stateless compression enabled
      18. local IP address 172.20.0.1
      19. remote IP address 69.16.172.130
      20. root@MARKIOFS:/# ping google.com
      21. ping: unknown host google.com
      22. root@MARKIOFS:/#
      Display All
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      Try to configure dns in pptpd options:

      Source Code

      1. sudo nano /etc/ppp/pptpd-options


      If you are using your own router for name resolving then use the router IP (for example 192.168.1.1), if your vpn provider gave you the IP of their dns resolver then use that one. Append at the end of the file:

      Source Code

      1. ms-dns 192.168.1.1
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      Thanks, Laowai.

      It turned out that it was a DNS issue. For some reason my ISP was not resolving hostnames properly. Once I added Google's public DNS records everything started resolving. I'm still not sure I have the optimal settings and I don't know if I have the stop and starting of service (SABnzbd) working properly but it's much better than before.

      Now, if I could only get MYSQL (from JHMiller's Newznab install) to work after a reboot I think my system would be mostly stable.
    • Re: PPTP VPN with auto-shutdown of torrent if connection is

      There may be a simple answer to this question but for some reason I can't find it out there.

      Is there any way to specify the local IP address in the PPTP client?

      I'd like to be able to port forward to the PPTP client from my router for specific applications - actually not sure if that is possible due to VPN design.