[v11,10/11] batctl: Document a network namespaces example.

Message ID 1468836728-21890-10-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit 30c2e89d6510d9d09f66e35beaa71302eef5358e
Delegated to: Marek Lindner
Headers

Commit Message

Sven Eckelmann July 18, 2016, 10:12 a.m. UTC
  From: Andrew Lunn <andrew@lunn.ch>

Add example of has BATMAN can be used with network name spaces in the
README.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 README | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
  

Comments

Marek Lindner July 22, 2016, 9:10 a.m. UTC | #1
On Monday, July 18, 2016 12:12:07 Sven Eckelmann wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> 
> Add example of has BATMAN can be used with network name spaces in the
> README.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  README | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)

Applied in revision 30c2e89.

Thanks,
Marek
  

Patch

diff --git a/README b/README
index 6df669a..ce049d4 100644
--- a/README
+++ b/README
@@ -555,3 +555,60 @@  where:
 - IPv4 is the IP address of a client in the mesh network
 - MAC is the MAC address associated to that IP
 - last-seen is the amount of time since last refresh of this entry
+
+batctl and network name spaces
+==============================
+
+The batman-adv kernel module is netns aware. Mesh instances can be
+created in name spaces, and interfaces in that name space added to the
+mesh. The mesh interface cannot be moved between name spaces, as is
+typical for virtual interfaces.
+
+The following example creates two network namespaces, and uses veth
+pairs to connect them together into a mesh of three nodes.
+
+EMU1="ip netns exec emu1"
+EMU2="ip netns exec emu2"
+
+ip netns add emu1
+ip netns add emu2
+
+ip link add emu1-veth1 type veth peer name emu2-veth1
+ip link set emu1-veth1 netns emu1
+ip link set emu2-veth1 netns emu2
+
+$EMU1 ip link set emu1-veth1 name veth1
+$EMU2 ip link set emu2-veth1 name veth1
+
+$EMU1 ip link set veth1 up
+$EMU2 ip link set veth1 up
+
+ip link add emu1-veth2 type veth peer name veth2
+ip link set emu1-veth2 netns emu1
+$EMU1 ip link set emu1-veth2 name veth2
+
+$EMU1 ip link set veth2 up
+ip link set veth2 up
+
+$EMU1 batctl if add veth1
+$EMU1 batctl if add veth2
+$EMU1 ip link set bat0 up
+
+$EMU2 batctl if add veth1
+$EMU2 ip link set bat0 up
+
+batctl if add veth2
+ip link set bat0 up
+
+alfred and batadv-vis can also be used with name spaces. In this
+example, only netns has been used, so there are no filesystem name
+spaces. Hence the unix domain socket used by alfred needs to be given
+a unique name per instance.
+
+($EMU1 alfred -m -i bat0 -u /var/run/emu1-alfred.soc) &
+($EMU2 alfred -m -i bat0 -u /var/run/emu2-alfred.soc) &
+alfred -m -i bat0 &
+
+($EMU1 batadv-vis -s -u /var/run/emu1-alfred.soc) &
+($EMU2 batadv-vis -s -u /var/run/emu2-alfred.soc) &
+batadv-vis -s &