On 2/4/19 5:10 PM, Grant Taylor wrote:
Consider the following commands to start the ""container:

ip netns add myContainer
ip link add myContainer type veth peer name myHost netns myContainer
ip link set myContainer up
ip addr add 192.0.2.1/24 dev myContainer
ip netns exec myContainer ip link set myHost up
ip netns exec myContainer ip addr add 192.0.2.2/24 dev myHost

Consider the following command to stop the ""container:

ip netns del myContainer

This is the other method that I'm starting containers.

unshare --mount=/run/mountns/$container --net=/run/netns/$container --uts=/run/utsns/$container /bin/true

nsenter --mount=/run/mountns/$container --net=/run/netns/$container --uts=/run/utsns/$container /bin/hostname $container

I can use nsenter to execute similar ip link & addr commands to bring the links up.



--
Grant. . . .
unix || die

Reply via email to