A super naive, (possibly unreliable), VPN implementation.

Overview

Poor Man's VPN

A super naive, (possibly unreliable), VPN implementation.

Try on Docker Containers

You can test the VPN on docker containers. up.sh script builds the image automatically and launches containers. down.sh script terminates the contianers.

Start containers:

$ sudo ./up.sh

and then attach the server container:

$ sudo docker attach server
# RUST_LOG=debug server

and attach the net1-host container:

$ sudo docker attach net1-host
# RUST_LOG=debug client

also, attach the net2-host container:

$ sudo docker attach net2-host
# RUST_LOG=debug client

Finally, net1-host and net2-host can communicate via vpn0 interface.

$ sudo docker exec -it net1-host /bin/bash
# ip addr show dev vpn0 | awk '/inet/{print $2}'
10.20.30.2/24
# ping 10.20.30.3  # ping to net2-host
PING 10.20.30.3 (10.20.30.3): 56 data bytes
64 bytes from 10.20.30.3: seq=0 ttl=64 time=0.846 ms
64 bytes from 10.20.30.3: seq=1 ttl=64 time=1.250 ms
64 bytes from 10.20.30.3: seq=2 ttl=64 time=1.253 ms
^C
--- 10.20.30.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.846/1.116/1.253 ms
$ sudo docker exec -it net2-host /bin/bash
# ip addr show dev vpn0 | awk '/inet/{print $2}'
10.20.30.3/24

To clean up the containers, just run:

$ sudo ./down.sh

Usage

  1. Generate a key pair on the server host:
    [server] $ mkdir keys
    [server] $ ./genkey.sh > keys/privkey.der
    [server] $ ./pubkey.sh < keys/privkey.der > server_pubkey.der
    
  2. Generate a pair of keys on a peer host:
    [peer1] $ mkdir keys
    [peer1] $ ./genkey.sh > keys/privkey.der
    [peer1] $ ./pubkey.sh < keys/privkey.der > peer1_pubkey.der
    [peer1] $ cp server_pukey.der keys/  # place the server public key under 'keys/'
    
  3. Generate a pair of keys on another peer host as well:
    [peer2] $ mkdir keys
    [peer2] $ ./genkey.sh > keys/privkey.der
    [peer2] $ ./pubkey.sh < keys/privkey.der > peer2_pubkey.der
    [peer2] $ cp server_pukey.der keys/  # place the server public key under 'keys/'
    
  4. Register peers' public key on the server:
    [server] $ cp peer1_pubkey.der keys/
    [server] $ cp peer2_pubkey.der keys/
    
  5. Start a server process on the server host:
    [server] $ # edit server-config.toml
    [server] $ cargo run --bin server
    
  6. Start a client process on the peer hosts:
    [peer1] $ # edit client-config.toml
    [peer1] $ cargo run --bin client
    
    [peer2] $ # edit client-config.toml
    [peer2] $ cargo run --bin client
    
  7. Now two peers (and server) can communicate via vpn0 interface.
    [peer1] $ ping 10.20.30.3  # ping-ing to peer2
    
    [peer2] $ ping 10.20.30.2  # ping-ing to peer1
    
You might also like...
Futures-based QUIC implementation in Rust

Pure-rust QUIC protocol implementation Quinn is a pure-rust, future-based implementation of the QUIC transport protocol undergoing standardization by

neqo — an Implementation of QUIC written in Rust

Neqo, an Implementation of QUIC written in Rust To run test HTTP/3 programs (neqo-client and neqo-server): cargo build ./target/debug/neqo-server [::]

The Rust Implementation of libp2p networking stack.

Central repository for work on libp2p This repository is the central place for Rust development of the libp2p spec. Warning: While we are trying our b

A pure Rust implementation of WebRTC API
A pure Rust implementation of WebRTC API

A pure Rust implementation of WebRTC API

Backroll is a pure Rust implementation of GGPO rollback networking library.

backroll-rs Backroll is a pure Rust implementation of GGPO rollback networking library. Development Status This is still in an untested alpha stage. A

A working demo of RustDesk server implementation

A working demo of RustDesk server implementation This is a super simple working demo implementation with only one relay connection allowed, without NA

axum-server is a hyper server implementation designed to be used with axum framework.

axum-server axum-server is a hyper server implementation designed to be used with axum framework. Features Conveniently bind to any number of addresse

Official Implementation of Findora Network.

Findora Platform Wiki Contribution Guide Licensing The primary license for Platform is the Business Source License 1.1 (BUSL-1.1), see LICENSE. Except

A small holepunching implementation written in Rust (UDP)

rust-udp-holepunch A small holepunching implementation written in Rust (UDP) Prerequisites Your rendezvous server must lay in a network which doesn't

Owner
algon
algon
Simple VPN implemented using rust

fubuki Simple VPN implemented using rust fubuki是类似与tincVPN的简单组网工具 不支持对等NAT 支持的平台: Windows Linux 工作机制 它由一台拥有公网IP的服务器来维持各个内网客户端的实际地址映射,在客户端和客户端之间实现P2P通信

XTY 84 Dec 31, 2022
MASQ Network 121 Dec 20, 2022
A WireGuard UWP VPN plugin.

WireGuard UWP A Universal Windows Platform (UWP) VPN Plug-in for WireGuard® written in Rust. Windows provides a plug-in based model for adding 3rd-par

Luqman Aden 92 Dec 13, 2022
A virtual network tool (or VPN)

switch A virtual network tool (VPN) 将不同网络下的多个设备虚拟到一个局域网下 示例: 在一台mac设备上运行,获取到ip 10.13.0.2: 在另一台windows上运行,获取到ip 10.13.0.3: 此时这两个设备之间就能用ip相互访问了 输入"list"

null 49 Jan 21, 2023
Rosenpass is a formally verified, post-quantum secure VPN that uses WireGuard to transport the actual data.

Rosenpass README This repository contains A description of the Rosenpass protocol The reference implementation of the protocol – the rosenpass tool A

Rosenpass 597 Mar 19, 2023
Super Fast Sub-domain Takeover Detection!

NtHiM - Super Fast Sub-domain Takeover Detection Installation Method 1: Using Pre-compiled Binaries The pre-compiled binaries for different systems ar

Binit Ghimire 326 Dec 31, 2022
A super minimal wrapper around unix sockets for IPC on top of tokio.

tokio-unix-ipc This crate implements a minimal abstraction over UNIX domain sockets for the purpose of IPC on top of tokio.

Armin Ronacher 26 Nov 18, 2022
Super simple tokio chat server for educational purposes.

achat A collection of simple modules which showcase simple use of tasks, channels, and other tokio primitives to implement simple networking applicati

Rafael Bachmann 2 Dec 29, 2022
Futures implementation for JSON-RPC

futures-jsonrpc Futures + JSON-RPC A lightweight remote procedure call protocol. It is designed to be simple! And, with futures, even more flexible! T

Victor Lopes 12 May 19, 2022
🥧 Savoury implementation of the QUIC transport protocol and HTTP/3

quiche is an implementation of the QUIC transport protocol and HTTP/3 as specified by the IETF. It provides a low level API for processing QUIC packet

Cloudflare 7.1k Jan 8, 2023