Giter Club home page Giter Club logo

anodevpn-server's Introduction

Anode VPN server

Install:

Before using, you must install and run cjdns.

$ npm install

Configure:

cp config.example.js config.js

Edit your config file as you see fit. The default settings should work.

Run:

node index.js

Running with pm2

pm2 is a daemon process manager to make running applications in the background a little easier.

Installing pm2:

$ npm install pm2 -g

Run the vpn server in the background.

$ pm2 start index.js

Firewall

Make sure to allow access to TCP and UDP for the cjdns port (change 30969 to match your cjdns port):

$ ufw allow 30969

Routing

You will need to set up IP Masquerading to route traffic from your connected clients to the Internet.

Each system is diffferent, but here's an example for Debian (replace eth0 with the name of your public-facing ethernet device):

$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ iptables -A FORWARD -i tun0 -j ACCEPT
$ iptables -A FORWARD -o tun0 -j ACCEPT
$ sudo sysctl -w net.ipv4.ip_forward=1
$ iptables-save

Persist between reboots:

# Enable use 1, Disable use 0
# 1. Edit "sysctl.conf" file
sudo nano /etc/sysctl.conf
# 2. Add following line at the bottom of the file, if it's not in the file, otherwise replace 0 with 1
net.ipv4.ip_forward = 1
# 3. Use Ctrl + X, Y, Enter key to Save and exit nano editor
# 4. Apply the change
sudo sysctl -p
or
sudo sysctl -p /etc/sysctl.conf
iptables-save > /etc/iptables.rules

mkdir -p /etc/network/if-pre-up.d
echo "#!/bin/bash" > /etc/network/if-pre-up.d/firewall
echo "/sbin/iptables-restore < /etc/iptables.rules" >> /etc/network/if-pre-up.d/firewall
chmod +x /etc/network/if-pre-up.d/firewall

Add a route (replace 10.66.0.0/16 with a network range compatible with your config.js settings)

$ ip route add 10.66.0.0/16 dev tun0

anodevpn-server's People

Contributors

cjdelisle avatar backupbrain avatar thomasjp0x42 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.