From 1b0b13fe97e372d5f234ab87de5afaa1df7b80fd Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Mon, 18 May 2020 15:58:28 -0500 Subject: [PATCH] veth.4: Add a more direct example iproute2 allows you to specify the netns for either side of a veth interface at creation time. Add an example of this to veth(4) so it doesn't sound like you have to move the interfaces in a separate step. Verified with commands: # ip netns add alpha # ip netns add bravo # ip link add foo netns alpha type veth peer bar netns bravo # ip -n alpha link show # ip -n bravo link show Signed-off-by: Michael Kerrisk --- man4/veth.4 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/man4/veth.4 b/man4/veth.4 index 20294c097..2d59882a0 100644 --- a/man4/veth.4 +++ b/man4/veth.4 @@ -63,13 +63,23 @@ A particularly interesting use case is to place one end of a .B veth pair in one network namespace and the other end in another network namespace, thus allowing communication between network namespaces. -To do this, one first creates the -.B veth -device as above and then moves one side of the pair to the other namespace: +To do this, one can provide the +.B netns +parameter when creating the interfaces: .PP .in +4n .EX -# ip link set netns +# ip link add netns type veth peer netns +.EE +.in +.PP +or, for an existing +.B veth +pair, move one side to the other namespace: +.PP +.in +4n +.EX +# ip link set netns .EE .in .PP