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

    Code
    sudo apt-get install pptp-linux tinyproxy dyndns


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

    Code
    sudo nano /etc/ppp/chap-secrets


    Paste this code, change it to your needs:

    Code
    # Secrets for authentication using CHAP
    # client        server  secret                  IP addresses
    YOUR_USERNAME      ipredator       "YOUR_PASSWORD"     *


    Create ipredator configuration file:

    Code
    sudo nano /etc/ppp/peers/ipredator


    Paste this code, change to your needs:

    Code
    persist
    maxfail 0
    pty "pptp pptp.ipredator.se --nolaunchpppd"
    name YOUR_USERNAME
    remotename ipredator
    require-mppe-128
    file /etc/ppp/options.pptp
    ipparam ipredator
    updetach


    Edit options.conf:

    Code
    sudo nano /etc/ppp/options.pptp


    Paste this code:


    Make the VPN connection to start on boot:

    Code
    sudo nano /etc/network/interfaces


    Add this at the end of the file:

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


    To start manualy run:

    Code
    sudo pon ipredator


    To stop manualy run:

    Code
    sudo poff ipredator


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

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


    Paste this code, change any IP to your needs:


    Start transmission:

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


    Paste this code:

    Bash
    #!/bin/bash
    #start transmission
    /etc/init.d/transmission-daemon start


    Update dyndns if you use any:

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


    Paste this code:

    Bash
    #!/bin/bash
    
    
    # Update dyndns
    /usr/bin/dyndns --config /etc/dyndns/dyndns.conf


    4. Create ip-down scripts
    Stop transmission daemon:

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


    Paste this code:

    Bash
    #!/bin/bash
    #stop transmission
    /etc/init.d/transmission-daemon stop


    I also created this to be on the safe side:

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


    Paste this code:

    Bash
    #!/bin/bash
    #stop transmission
    killall transmission-daemon


    Stop thunneling all traffic through VPN:

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


    Paste this code, change any IP to your needs:


    Update dyndns if you have any:

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


    Paste this code:

    Bash
    #!/bin/bash
    # Update dyndns
    /usr/bin/dyndns --config /etc/dyndns/dyndns.conf


    Make ip-up and ip-down scrips executable:

    Code
    sudo chmod +x /etc/ppp/ip-down.d/10-stop-transmission \
                           /etc/ppp/ip-down.d/20-kill-transmission \
                           /etc/ppp/ip-down.d/80-stop-all-to-tunnel-routing \
                           /etc/ppp/ip-down.d/90-update-dyndns \
                           /etc/ppp/ip-up.d/10-start-all-to-tunnel-routing \
                           /etc/ppp/ip-up.d/80-start-transmission \
                           /etc/ppp/ip-up.d/90-update-dyndns


    5. Configure tinyproxy:

    Code
    sudo nanno /etc/tinyproxy.conf


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


    6. Update dyndns script

    Code
    sudo nano /etc/dyndns/dyndns.conf


    Paste this code, change it to your needs:


    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.

  • 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:


    Code
    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:


    Code
    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?

  • 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: http://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.

  • The latest script from jhmiller just introduced the install of deluge on this thread: http://forums.openmediavault.o…?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:

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


    The code:

    Bash
    #!/bin/bash
    #start deluge
    /etc/init.d/deluge-daemon start


    Stop deluge daemon:

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


    The code:

    Bash
    #!/bin/bash
    #stop deluge
    /etc/init.d/deluge-daemon stop


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

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


    The code:

    Bash
    #!/bin/bash
    #start SABnzbd
    /etc/init.d/SABnzbd start


    Stop SABnzbd daemon:

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


    The code:

    Bash
    #!/bin/bash
    #stop SABnzbd
    /etc/init.d/SABnzbd stop


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

    Code
    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:

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


    The line

    Code
    "default_daemon": ""


    ... should be replaced with:

    Code
    "default_daemon": "127.0.0.1:58846"
  • Has anyone successfully set up PPTP with IPVanish? It appears to connect but internet facing apps cease to bring in data.


    Is there a better way to test to drill down to the actual problem?


    Thanks,
    Mark

  • 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:



    And ifconfig output:



    Thanks Laowai.

  • 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?


  • Try to configure dns in pptpd options:


    Code
    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:


    Code
    ms-dns 192.168.1.1
  • 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.

  • 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.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!