https://github.com/kevinbird61/virtual-router
Using tuntap to simulate router port, implement software router and related network functions with C.
https://github.com/kevinbird61/virtual-router
c router tuntap virtualization
Last synced: 7 months ago
JSON representation
Using tuntap to simulate router port, implement software router and related network functions with C.
- Host: GitHub
- URL: https://github.com/kevinbird61/virtual-router
- Owner: kevinbird61
- License: gpl-3.0
- Created: 2020-03-14T03:09:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T05:14:17.000Z (about 5 years ago)
- Last Synced: 2025-03-18T15:43:27.558Z (7 months ago)
- Topics: c, router, tuntap, virtualization
- Language: C
- Homepage: https://hackmd.io/@scyu/HyGwpzGL8
- Size: 124 KB
- Stars: 14
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
* Kevin Cyu, kevinbird61@gmail.com