Created
February 11, 2017 15:32
-
-
Save sora/77d83b50325896ed86f4683ddbb84980 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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