slirp

command
v0.0.0-...-b2cb540 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package main provides an example implementation of SLiRP. * * You will need to run this program with CAP_NET_ADMIN capabilities to create * the TUN interface. * * For example: * * $ go build -o slirp * $ sudo setcap cap_net_admin=+ep ./slirp * $ ./slirp * * For testing you will need to create a network namespace: * * $ sudo mkdir -p /etc/netns/slirp-ns * $ echo "nameserver 1.1.1.1" | sudo tee /etc/netns/slirp-ns/resolv.conf > /dev/null * $ sudo ip netns add slirp-ns * $ sudo ip link set nsh0 netns slirp-ns * $ sudo ip netns exec slirp-ns ip addr add 100.64.0.2/24 dev nsh0 * $ sudo ip netns exec slirp-ns ip link set nsh0 up * $ sudo ip netns exec slirp-ns ip route add default via 100.64.0.1 dev nsh0 * * You can then open a shell in the network namespace, any traffic will be * forwarded through the SLiRP example: * * $ sudo ip netns exec slirp-ns bash * $ curl http://icanhazip.com * * To clean up when you are done, you can delete the network namespace: * * $ sudo ip netns delete slirp-ns

Jump to

Keyboard shortcuts

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