Sample Header Ad - 728x90

How to specify a namespace when creating a tun/tap device?

1 vote
1 answer
3155 views
On linux I can create a new tun/tap device in C using something like: int fd = open("/dev/net/tun", O_RDWR); ioctl(fd, TUNSETIFF, (void *)&ifr); This will create a new network interface in the current network namespace. I could afterwards use something like ip link set tap0 netns foo to move it to another namespace from shell. What is the right way to create it in the correct namespace in the first place, or at least move it to that namespace from my C code?
Asked by michas (21872 rep)
Aug 1, 2016, 12:26 PM
Last activity: Oct 24, 2016, 02:13 PM