Search code examples
network-programminglinux-kernelclonelinux-namespaces

How can i create more network namespace?


How to use unshare(), clone() to create lots of network namespace in linux?


Solution

  • Just

    if (unshare(CLONE_NEWNET) < 0) {
            fprintf(stderr, "Failed to create a new network namespace: %s\n",
                    strerror(errno));
            goto out;
    }