veth.4: Add a more direct example
Subsystems (3)
PATCH 1/1 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
---
man4/veth.4 | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)man4/veth.4 +13 -3
@@ -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 +To do this, one can provide the +.B netns +parameter when creating the interfaces: +.PP +.in +4n +.EX +# ip link add <p1-name> netns <p1-ns> type veth peer <p2-name> netns <p2-ns> +.EE +.in +.PP +or, for an existing .B veth -device as above and then moves one side of the pair to the other namespace: +pair, move one side to the other namespace: .PP .in +4n .EX -# ip link set <p2-name> netns <p2-namespace> +# ip link set <p2-name> netns <p2-ns> .EE .in .PP
Signature · 1 line
2.26.2
Hello Devin
Quoted 10 lines · Devin J. Pohly
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
Nice patch, and nice commit message! Thanks. Applied.
Cheers,
Michael
Quoted 36 lines
--- man4/veth.4 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)man4/veth.4 +13
-3@@ -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 +To do this, one can provide the +.B netns +parameter when creating the interfaces: +.PP +.in +4n +.EX +# ip link add <p1-name> netns <p1-ns> type veth peer <p2-name> netns <p2-ns> +.EE +.in +.PP +or, for an existing .B veth -device as above and then moves one side of the pair to the other namespace: +pair, move one side to the other namespace: .PP .in +4n .EX -# ip link set <p2-name> netns <p2-namespace> +# ip link set <p2-name> netns <p2-ns> .EE .in .PP
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/