Skip to content

Instantly share code, notes, and snippets.

@sora
Created February 11, 2017 15:32
Show Gist options
  • Save sora/77d83b50325896ed86f4683ddbb84980 to your computer and use it in GitHub Desktop.
Save sora/77d83b50325896ed86f4683ddbb84980 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(void)
{
int fd0;
fd0 = open("/tmp/tap0", O_RDWR);
if (fd0 < 0) {
perror("open");
return 1;
}
while(1) {
sleep(1);
}
return 0;
}
#!/bin/bash
set -e
# tap0
ip tuntap add dev tap0 mode tap user root
ip addr add 10.2.2.2/24 dev tap0
ip link set tap0 up
mknod /tmp/tap0 c 10 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment