From patchwork Thu Apr 28 20:54:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 15985 X-Patchwork-Delegate: mareklindner@neomailbox.ch Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id CE625822BB; Thu, 28 Apr 2016 22:55:48 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=lunn.ch Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=178.209.37.122; helo=vps0.lunn.ch; envelope-from=andrew@lunn.ch; receiver=b.a.t.m.a.n@lists.open-mesh.net Authentication-Results: open-mesh.org; dmarc=none header.from=lunn.ch Received: from vps0.lunn.ch (vps0.lunn.ch [178.209.37.122]) by open-mesh.org (Postfix) with ESMTPS id 6A625821F2 for ; Thu, 28 Apr 2016 22:55:47 +0200 (CEST) Received: from andrew by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1avsxh-0003JL-JO; Thu, 28 Apr 2016 22:55:01 +0200 From: Andrew Lunn To: "B.A.T.M.A.N" Date: Thu, 28 Apr 2016 22:54:56 +0200 Message-Id: <1461876897-12677-2-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1461876897-12677-1-git-send-email-andrew@lunn.ch> References: <1461876897-12677-1-git-send-email-andrew@lunn.ch> Subject: [B.A.T.M.A.N.] [PATCH 1/2] batctl: Document a network namespaces example. X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" Add example of has BATMAN can be used with network name spaces in the README. Signed-off-by: Andrew Lunn --- README | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/README b/README index f87c551..431c62e 100644 --- a/README +++ b/README @@ -520,3 +520,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 &