Skip to content

Example of creating and configuring a TUN device, to provide an IP link over a serial interface

License

Notifications You must be signed in to change notification settings

ririyeye/tun-example

 
 

Repository files navigation

tun-example

Example program to create a TUN device (virtual IP network interface), configure address/netmask for it, then configure the routing table.

Usage

Build:

make

Build with optimisations:

make O=2

View help:

./bin/iplink --help

Example:

# Build
make

# Run on one endpoint (change uart arg as needed)
./bin/iplink --uart=/dev/ttyS0 --addr=10.0.0.1/24

# Run on other endpoint (change uart arg as needed)
./bin/iplink --uart=/dev/ttyS0 --addr=10.0.0.2/24

# The two ends can now communicate with IP, using their respective addresses.
# You could use some simple network program e.g. netcat to show this.

About

Example of creating and configuring a TUN device, to provide an IP link over a serial interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 86.2%
  • C 11.8%
  • Makefile 2.0%