Coder Social home page Coder Social logo

kevinbird61 / virtual-router Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 5.0 127 KB

Using tuntap to simulate router port, implement software router and related network functions with C.

Home Page: https://hackmd.io/@scyu/HyGwpzGL8

License: GNU General Public License v3.0

Makefile 1.01% Shell 5.45% C 82.45% Objective-C 6.39% C++ 4.70%
c router virtualization tuntap

virtual-router's Introduction

Virtual router

Using tuntap to simulate router port, and C to implement software router and related network functions.

We demostrate this virtual router with 2 router ports for simplicity. All environment can be run on single computer with linux network virtualization support.

  1. Using namespace to simulate host machine.
  2. Using tuntap client to simulate router's port.
  3. Using virtual link (veth) to connect namespace with our ports in bridge.

How to use

  • Build demo topology
    • ./.scripts/create_topo.sh
  • Build and run virtual router
    • make
    • ./router.exe -i tap0 tap1
  • Run the traffic
    • ping
      • h1 to h2: ip netns exec h1 ping 10.0.1.1
      • h1 to port0: ip netns exec h1 ping 10.0.0.2
      • h2 to h1: ip netns exec h2 ping 10.0.0.1
      • h2 to port1: ip netns exec h2 ping 10.0.1.2

Contact

virtual-router's People

Contributors

kevinbird61 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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