NAME Linux::Clone - an interface to the linux clone, unshare, setns, pivot_root and kcmp syscalls SYNOPSIS use Linux::Clone; DESCRIPTION This module exposes the linux clone(2), unshare(2) and some related syscalls to Perl. $retval = unshare $flags The following CLONE_ flag values (without CLONE_ prefix) are supported for unshare, if found, in this release. See the documentation for unshare(2) for more info on what they do: Linux::Clone::FILES Linux::Clone::FS Linux::Clone::NEWNS (in unshare, implies FS) Linux::Clone::VM (in unshare, implies SIGHAND) Linux::Clone::THREAD (in unshare, implies VM, SIGHAND) Linux::Clone::SIGHAND Linux::Clone::SYSVSEM Linux::Clone::NEWUSER (in unshare, implies CLONE_THREAD) Linux::Clone::NEWPID Linux::Clone::NEWUTS Linux::Clone::NEWIPC Linux::Clone::NEWNET Linux::Clone::NEWCGROUP Linux::Clone::NEWTIME Example: unshare the network namespace and prove that by calling ifconfig, showing only the unconfigured lo interface. Linux::Clone::unshare Linux::Clone::NEWNET and "unshare: $!"; Linux::Clone::configure_loopback; system "ifconfig"; Example: unshare the network namespace, initialise the loopback interface, create a veth interface pair, put one interface into the parent processes namespace (use ifconfig -a from another shell), configure the other interface with 192.168.99.2 -> 192.168.99.1 and start a shell. use Linux::Clone; # unshare our network namespace Linux::Clone::unshare Linux::Clone::NEWNET and "unshare: $!"; Linux::Clone::configure_loopback; my $ppid = getppid; system " # create veth pair ip link add name veth_master type veth peer name veth_slave # move veth_master to our parent process' namespace ip link set veth_master netns $ppid # configure the local interface ip link set veth_slave up ip addr add 192.168.99.2/32 dev veth_slave ip route add 192.168.99.1/32 dev veth_slave "; print < http://home.schmorp.de/