tun_tcp_connect

command
v0.0.0-...-f34ef4e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Overview

This sample creates a stack with TCP and IPv4 protocols on top of a TUN device, and connects to a peer. Similar to "nc <address> <port>". While the sample is running, attempts to connect to its IPv4 address will result in a RST segment.

As an example of how to run it, a TUN device can be created and enabled on a linux host as follows (this only needs to be done once per boot):

[sudo] ip tuntap add user <username> mode tun <device-name> [sudo] ip link set <device-name> up [sudo] ip addr add <ipv4-address>/<mask-length> dev <device-name>

A concrete example:

$ sudo ip tuntap add user wedsonaf mode tun tun0 $ sudo ip link set tun0 up $ sudo ip addr add 192.168.1.1/24 dev tun0

Then one can run tun_tcp_connect as such:

$ ./tun/tun_tcp_connect tun0 192.168.1.2 0 192.168.1.1 1234

This will attempt to connect to the linux host's stack. One can run nc in listen mode to accept a connect from tun_tcp_connect and exchange data.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL