GithubHelp home page GithubHelp logo

YAOSDN

Clojars Dependencies Status

Yet Another Overlay Software Defined Network

Installation

Until Java bindings for libtuntap are implemented, YAOSDN uses clj-linux-net which is Linux only. Well, I'll consider creating JNI/JNA interface on my spare time, but don't know how much would it take.

Install prerequisites for Fedora / CentOS / RHEL:

sudo dnf update
sudo dnf install iproute git java-1.8.0-openjdk

Install prerequisites for Debian / Ubuntu:

sudo apt-get update
sudo apt-get install iproute2 git openjdk-8-jre

Install Leiningen.

Get YAOSDN sources:

git clone https://github.com/yaosdn/yaosdn.git
cd yaosdn

Usage

Local testing

First terminal

On the first console do the following to create tun2 interface with 10.0.2.2/24 ip address:

export TUN_IF=tun2
export TUN_IP=10.0.2.2/24

sudo ip tuntap add dev $TUN_IF mode tun user $USER
sudo ip addr add $TUN_IP dev $TUN_IF
sudo ip link set $TUN_IF up
sudo tcpdump -vnni $TUN_IF

Second terminal

One the second console do the same operation for tun3 interface with 10.0.3.3/24 ip address:

export TUN_IF=tun3
export TUN_IP=10.0.3.3/24

sudo ip tuntap add dev $TUN_IF mode tun user $USER
sudo ip addr add $TUN_IP dev $TUN_IF
sudo ip link set $TUN_IF up
sudo tcpdump -vnni $TUN_IF

So, now we've got two IPs in two separate networks. How do we send pings between them? Well, SD in YAOSDN means Software Defined and thus we may simply mangle IP addresses as we wish.

Let packets transmitted through tun2 to 10.0.2.0/24 network increase their third octet for source and destination fields so that pinging 10.0.2.3 would internally mean sending packets from 10.0.3.2 to 10.0.3.3. And vice versa for tun3 let's decrease packets' third octet number. So, answering to 10.0.3.2 would internally mean sending packet with source 10.0.2.3 and destination 10.0.2.2.

When mangling ICMP packets by simply changing source and destination, the checksum will actually broke. We will fix that rebuilding packets when sending them using automatic checksum correction - internally used pcap4j allows us to do that.

Third terminal

Open the third terminal and run YAOSDN REPL:

lein repl

Now start procedure that I've written for some simplification of doing the above:

(repl-test-local-node "tun2" inc)

Fourth terminal

Do the same for the fourth terminal:

lein repl

For tun3 we do mirrored operation - we decrease third octet in IP:

(repl-test-local-node "tun3" dec)

Fifth terminal

Here we just use ping command to check out if this actually works:

ping 10.0.2.3

You should see packets (source and destination IPs) in each opened console and successful pinging. If something is not working - don't hesitate to create an issue here so I may try to help you.

Running two or more nodes

On each node create tun0 interface where 0 is a number of your choice by using snippets from the above. Assign any non-conflicting IP address (preferably from the private range) to freshly created tun0.

Start YAOSDN on each node:

lein run tun0

If nodes are in the same subnet and multicast packets are allowed then they should find each other automatically. Otherwise you should consider configuring Apache Ingite which is used as a broker internally.

License

Copyright © 2018 Sergey Sobko

Distributed under the MIT License.

YAOSDN's Projects

clj-linux-net icon clj-linux-net

Clojure library to access all Linux advanced network options

libtuntap icon libtuntap

The portable Tun/Tap devices configuration utility

yaosdn icon yaosdn

Yet Another Overlay Software Defined Network

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.