All Projects → twitchyliquid64 → Subnet

twitchyliquid64 / Subnet

Licence: mit
Simple, auditable & elegant VPN, built with TLS mutual authentication and TUN.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Subnet

Algo
Set up a personal VPN in the cloud
Stars: ✭ 24,275 (+2234.13%)
Mutual labels:  vpn, vpn-client, vpn-server
Setup Ipsec Vpn
Scripts to build your own IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2
Stars: ✭ 16,987 (+1533.37%)
Mutual labels:  vpn, vpn-client, vpn-server
Vpngate With Proxy
vpn gate client for linux, be able to connect to open vpn server through proxy
Stars: ✭ 150 (-85.58%)
Mutual labels:  vpn, vpn-client, vpn-server
Fanqiang Vpn.github.io
2021年 中国翻墙软件、VPN推荐指南,对比VPS搭建梯子、SSR机场、蓝灯、WireGuard、V2ray、老王VPN等科学上网软件与翻墙方法,中国最新科学上网翻墙VPN梯子下载推荐,稳定好用。
Stars: ✭ 390 (-62.5%)
Mutual labels:  vpn, vpn-client, vpn-server
Aws Vpn Server Setup
Setup your own private, secure, free* VPN on the Amazon AWS Cloud in 10 minutes. CloudFormation
Stars: ✭ 672 (-35.38%)
Mutual labels:  vpn, vpn-client, vpn-server
Vpncn.github.io
2021中国翻墙软件VPN推荐以及科学上网避坑,稳定好用。对比SSR机场、蓝灯、V2ray、老王VPN、VPS搭建梯子等科学上网与翻墙软件,中国最新科学上网翻墙梯子VPN下载推荐。
Stars: ✭ 3,925 (+277.4%)
Mutual labels:  vpn, vpn-client, vpn-server
Shadowsocks Heroku
本项目已删除
Stars: ✭ 224 (-78.46%)
Mutual labels:  vpn, vpn-client, vpn-server
Tizi
✅ ✅ ✅ 梯子 TOP推荐(持续更新) ✅ ✅ ✅ PC梯子,Windows梯子,电脑梯子,国外好用梯子,推荐翻墙梯子软件,海外加速器梯子,国外vpn,科学上网工具,靠谱iPhone/iPad/安卓/Android/Mac/Linux/PC/路由器都可以用的梯子
Stars: ✭ 168 (-83.85%)
Mutual labels:  vpn, vpn-client, vpn-server
iosvpn.github.io
iPhone和iOS 翻墙梯子VPN推荐,2022中国苹果手机iPhone翻墙软件和科学上网避坑指南,稳定梯子推荐。
Stars: ✭ 72 (-93.08%)
Mutual labels:  vpn, vpn-server, vpn-client
killswitch-windows
VPN kill switch for windows.
Stars: ✭ 22 (-97.88%)
Mutual labels:  tunnel, vpn, vpn-client
Wg Install
Wireguard road warrior installer for Ubuntu, Debian, CentOS and Fedora
Stars: ✭ 99 (-90.48%)
Mutual labels:  vpn, vpn-client, vpn-server
Pi Hole On Google Compute Engine Free Tier With Full Tunnel And Split Tunnel Wireguard Vpn Configs
Run your own privacy-first ad blocking service at home, or in the cloud for free with Google Cloud Services.
Stars: ✭ 343 (-67.02%)
Mutual labels:  vpn, vpn-client, vpn-server
Strongswan
strongSwan - IPsec-based VPN
Stars: ✭ 1,112 (+6.92%)
Mutual labels:  vpn, vpn-client, vpn-server
Docker Ipsec Vpn Server
Docker image to run an IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2
Stars: ✭ 4,356 (+318.85%)
Mutual labels:  vpn, vpn-client, vpn-server
Softethervpn
Cross-platform multi-protocol VPN software. Pull requests are welcome. The stable version is available at https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.
Stars: ✭ 8,531 (+720.29%)
Mutual labels:  vpn, vpn-server, tls
topvpn.github.io
Top VPN in China (mainland) 在全球(含中國大陆)好用的国外优质付费vpn推荐
Stars: ✭ 27 (-97.4%)
Mutual labels:  vpn, vpn-server, vpn-client
KidVPN
The world's smallest VPN server and client.
Stars: ✭ 63 (-93.94%)
Mutual labels:  vpn, vpn-server, vpn-client
Node
Mysterium Network Node - official implementation of distributed VPN network (dVPN) protocol
Stars: ✭ 681 (-34.52%)
Mutual labels:  vpn, vpn-client, vpn-server
Iodine
Official git repo for iodine dns tunnel
Stars: ✭ 3,950 (+279.81%)
Mutual labels:  vpn, tunnel
Announcement
Stars: ✭ 391 (-62.4%)
Mutual labels:  vpn, tunnel

subnet

VPN server/client for the rest of us.

Authors note: Subnet works but lacks thorough review, and hits performance limits over ~100Mbps. I strongly recommend Wireguard instead for real deployments.

Overview

subnet establishes a TLS connection to the server. A TUN interface is created, and setup with the given network parameters (local IP, subnet). All traffic that matches the localIP + subnet gets routed to the VPN server.

On the server, all traffic which is received is checked against all client's localIPs. If it matches, it goes down there. If it doesn't, it gets routed to the servers TUN device (to its network). If the server's kernel is configured correctly, packets coming back into the TUN device will be NATed, and hence can be routed correctly. They then get routed back to the correct client.

Use cases

Tunnel all non-LAN traffic through another box on the internet (traditional VPN).

Setup the server:

export GOPATH=`pwd` #set your GOPATH where you want the build to happen
go get -u github.com/twitchyliquid64/subnet
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -j MASQUERADE
./bin/subnet --mode init-server-certs --cert server.certPEM --key server.keyPEM --ca ca.certPEM --ca_key ca.keyPEM
./bin/subnet --mode server --key server.keyPEM --cert server.certPEM --ca ca.certPEM --network 192.168.69.1/24 0.0.0.0

Setup the client:

First, generate a certificate/key pair for each client, by running this on the server:

./bin/subnet --mode make-client-cert --ca ca.certPEM --ca_key ca.keyPEM client.certPEM client.keyPEM

Then, transfer client.certPEM, client.keyPEM and ca.certPEM to your client.

Now, run this on the client:

export GOPATH=`pwd` #set your GOPATH where you want the build to happen
go get -u github.com/twitchyliquid64/subnet
sudo ./bin/subnet -gw 192.168.69.1 -network 192.168.69.4/24 -cert client.certPEM -key client.keyPEM -ca ca.certPEM <server address>

#If you are on Mac OSX (replace 'Wi-Fi' with your interface):
networksetup -setdnsservers Wi-Fi 8.8.8.8

Explanation:

  • subnet is downloaded and compiled on both client and server.
  • A CA certificate is generated, and a server certificate is generated which is signed by the CA cert (init-server-certs mode).
  • A client certificate is generated, which again is based off the CA cert (make-client-cert mode).
  • Server's networking stack is told to allow the forwarding of packets and to apply NAT to the packets.
  • Server gets the VPN address 192.168.69.1, managing traffic for 192.168.69.1 - 192.168.69.255.
  • Client gets the address 192.168.69.4.
  • Client remaps its default gateway to 192.168.69.1, forcing all non-LAN traffic through the VPN server.
  • On connection, both sides verify the TLS cert against the CA cert given on the command line.

Make a remote LAN accessible on your machine.

Setup the server (linux only):

export GOPATH=`pwd` #set your GOPATH where you want the build to happen
go get -u github.com/twitchyliquid64/subnet
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -j MASQUERADE
./bin/subnet --mode init-server-certs --cert server.certPEM --key server.keyPEM --ca ca.certPEM --ca_key ca.keyPEM
./bin/subnet --mode server --key server.keyPEM --cert server.certPEM --ca ca.certPEM --network 192.168.69.1/24 0.0.0.0

Setup the client:

First, generate a certificate/key pair for each client, by running this on the server:

./bin/subnet --mode make-client-cert --ca ca.certPEM --ca_key ca.keyPEM client.certPEM client.keyPEM

Then, transfer client.certPEM, client.keyPEM and ca.certPEM to your client.

Now, run this on the client:

export GOPATH=`pwd` #set your GOPATH where you want the build to happen
go get -u github.com/twitchyliquid64/subnet
sudo ./bin/subnet -network 192.168.69.4/24 -cert client.certPEM -key client.keyPEM -ca ca.certPEM <server address>

Explanation:

  • subnet is downloaded and compiled on both client and server.
  • Certificates are generated, all based on the CA cert which is also generated.
  • Server gets the VPN address 192.168.69.1, managing traffic for 192.168.69.1 - 192.168.69.255.
  • Client gets the address 192.168.69.4. The /24 subnet mask means traffic for addresses 192.168.69.1 to 192.168.69.255 will be routed through the VPN.
  • Any traffic to 192.168.69.1 will go to the VPN server. Any traffic to 192.168.69.1 to 192.168.69.255 will go to clients connected to the same server with that address. All other traffic is routed outside of subnet.

Usage

Usage of ./subnet:
./subnet <server address>
  -blockProfile
    	Enable block profiling
  -ca string
    	Path to PEM-encoded cert to validate client/serv
  -ca_key string
    	Path to PEM-encoded key to use generating certificates
  -cert string
    	Path to PEM-encoded cert for our side of the connection
  -cpuProfile
    	Enable CPU profiling
  -gw string
    	(Client only) Set the default gateway to this value
  -i string
    	TUN interface, one is picked if not specified
  -key string
    	Path to PEM-encoded key for our cert
  -mode string
    	Whether the process starts a server or as a client (default "client")
  -network string
    	Address for this interface with netmask (default "192.168.69.1/24")
  -port string
    	Port for the VPN connection (default "3234")

TODO

  • [x] Fix server crash when processing packet when the client closes connection
  • [x] Document server setup procedure, inc forward, masquasde & cert setup
  • [x] Make client resilient to connection failures to the server
  • [ ] Test routing between two clients on the same server.
  • [x] Fix throughput issues - 5% of normal connection speed. Latency is good though.
  • [x] Get working on OSX.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].