From patchwork Sun Aug 7 15:33:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 9266481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1222060839 for ; Sun, 7 Aug 2016 15:34:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0319227D5E for ; Sun, 7 Aug 2016 15:34:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBE0A27D85; Sun, 7 Aug 2016 15:34:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4692E27D5E for ; Sun, 7 Aug 2016 15:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751758AbcHGPeE (ORCPT ); Sun, 7 Aug 2016 11:34:04 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:58158 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbcHGPeC (ORCPT ); Sun, 7 Aug 2016 11:34:02 -0400 Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=omega.localdomain) by metis.ext.pengutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1bWQ4x-0006Tq-PP; Sun, 07 Aug 2016 17:33:31 +0200 From: Alexander Aring To: linux-wpan@vger.kernel.org Cc: Alexander Aring Subject: [PATCH wpan-misc 1/5] website: update testing scripts for netns Date: Sun, 7 Aug 2016 17:33:20 +0200 Message-Id: <20160807153324.9642-1-aar@pengutronix.de> X-Mailer: git-send-email 2.9.2 X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: aar@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wpan@vger.kernel.org Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Stefan Schmidt Signed-off-by: Alexander Aring Acked-by: Stefan Schmidt --- website/index.txt | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/website/index.txt b/website/index.txt index 65c6b9c..1438c6e 100644 --- a/website/index.txt +++ b/website/index.txt @@ -90,8 +90,13 @@ Setup a 6LowPAN test network ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Let's assume you want to setup a 6lowpan test network of six nodes. +Each of them will be created in their own net namespace to avoid +local IPv6 optimizations. Each netns is named according to the wpan +interface which available in the net namespace. --------------------------------------------------------------------- +#!/bin/sh + # we need some Private Area Network ID panid="0xbeef" # number of nodes @@ -102,25 +107,26 @@ numnodes=6 modprobe fakelb numlbs=$numnodes # initialize all the nodes -for i in $(seq 0 $numnodes); +for i in $(seq 0 `expr $numnodes - 1`); do - iwpan dev wpan${i} set pan_id 0xbeef - ip link wpan${i} name lowpan${i} type lowpan - ip link set wpan${i} up - ip link set lowpan${i} up + ip netns delete wpan${i} + ip netns add wpan${i} + PHYNUM=`iwpan dev | grep -B 1 wpan${i} | sed -ne '1 s/phy#\([0-9]\)/\1/p'` + iwpan phy${PHYNUM} set netns name wpan${i} + + ip netns exec wpan${i} iwpan dev wpan${i} set pan_id $panid + ip netns exec wpan${i} ip link add link wpan${i} name lowpan${i} type lowpan + ip netns exec wpan${i} ip link set wpan${i} up + ip netns exec wpan${i} ip link set lowpan${i} up done --------------------------------------------------------------------- Now let us send some data over our network: --------------------------------------------------------------------- -wireshark -kSl -i lowpan0 & -# get the IPv6 address of lowpan1 -lowpan1addr="$(ip addr show lowpan1 | grep inet6 \ - | sed 's,.*inet6 \([^/]*\).*,\1,')" -# tell ping6 to ping the IPv6 address of lowpan1 and send it via -# lowpan0 -ping6 ${lowpan1addr}%lowpan0 +ip netns exec wpan0 wireshark -kSl -i lowpan0 & +# ping all nodes +ip netns exec wpan0 ping6 ff02::1%lowpan0 --------------------------------------------------------------------- Now watch wireshark and all the nice ICMP packets there.