diff options
author | Akihiro Suda <suda.akihiro@lab.ntt.co.jp> | 2018-07-10 18:40:33 +0900 |
---|---|---|
committer | Akihiro Suda <suda.akihiro@lab.ntt.co.jp> | 2018-07-10 19:57:38 +0900 |
commit | d5c44a94a271701ddc48c9b20aa6e9539a92ad0a (patch) | |
tree | 291a2456c642c56432d275c661041dee35ede174 /README.md |
initial commit
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..355dc50 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# slirp4netns: slirp for network namespaces, without copying buffers across the namespaces + + +## Install + +Requires [libslirp](https://github.com/rd235/libslirp). + +```console +$ autoreconf -if +$ ./configure +$ make +``` + +Or just `cc -o slirp4netns *.c -lslirp -lpthread` + +### Static binary +You can also build a static binary by running `./configure LDFLAGS=-static`. + +Note that you need to install libslirp with `./configure --enable-static`. + +## Usage + +Terminal 1: +```console +$ unshare -r -n -m +unshared$ echo $$ > /tmp/pid +unshared$ ip tuntap add name tap0 mode tap +unshared$ ip link set tap0 up +unshared$ ip addr add 10.0.2.100/24 dev tap0 +unshared$ ip route add default via 10.0.2.2 dev tap0 +unshared$ echo "nameserver 10.0.2.3" > /tmp/resolv.conf +unshared$ mount --bind /tmp/resolv.conf /etc/resolv.conf +``` + +Terminal 2: +```console +$ slirp4netns $(cat /tmp/pid) tap0 +``` + +Terminal 1: +```console +unshared$ ping 10.0.2.2 +unshared$ curl https://example.com +``` |