Battlemesh logo
  • Comments
  • Edit
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
    • Edit SideBar
  • Login

Navigation

  • RecentChanges
  • FindPage
  • PastEvents
  • ContactUs
  • HelpContents
Revision 12 as of 2010-03-19 16:15:59
  • BattleMeshV3
  • NodeConfigScript

What is the NodeConfig script?

use this NodeConfig scripts to easily change the configuration of any number of nodes. Just connect all nodes over the cabled ethernet network, note all the mac-addresses of the nodes you want to configure, and run the available scripts configure all of those.

usage of the attached scripts:

  • ./telnet-loop.sh nodetable.csv nodeconfigscript

will connect to all nodes (one-by-one), listed in the nodetable.csv (mac-addresses, etc.) execute the nodeconfigscript _on the node. It is using the telnet daemon running on the nodes to connect.

the variant ssh-loop.sh uses ssh to connect to the nodes -- use ssh keys to connect without having to enter passwords...

use copy-loop.sh to copy files over to all of the nodes listed in your table.

Files

  • [get | view] (2016-12-28 10:25:07, 1.2 KB) [[attachment:copy-loop.sh]]
  • [get | view] (2016-12-28 10:25:07, 1.3 KB) [[attachment:nodeconfigscript]]
  • [get | view] (2016-12-28 10:25:07, 0.8 KB) [[attachment:nodetable.csv]]
  • [get | view] (2016-12-28 10:25:07, 1.6 KB) [[attachment:ssh-loop.sh]]
  • [get | view] (2016-12-28 10:25:07, 1.5 KB) [[attachment:telnet-loop.sh]]
 All files | Selected Files: delete move to page copy to page

Snippets

usefull short fragments of code to script the configuration -- we use the 'uci' command to set the system configuration, as it is standard on openwrt and easy to use command line tool.

using parameters

the 'node-configuration-factory' parses the node table, and exports the parameters specified using the variable names @PARAM0@ to @PARAM9@ -- use these in your scripts for node specific parameters.

eg. if you specified an ip address in the 4th column

 IP="@PARAM3@" 

setting hostname

set -a
NAME="@PARAM1@"
sysctl -w kernel.hostname=$NAME
uci set system.@system[0].hostname=$NAME
uci commit

wireless device name

the wireless device has different names on different types of devices -- you can query the name from the uci system (it's typically 'wifi0' or 'radio0')

DEVICE=`uci get wireless.@wifi-iface[0].device`

and then use it further in your script, eg.

uci set wireless.$DEVICE.channel=4

configure wireless interface

set -a
# adapt PARAM2 to the parameter in your node table
IP="@PARAM2@"
#query wireless device' name
DEVICE=`uci get wireless.@wifi-iface[0].device`

uci set wireless.$DEVICE.channel=5
uci set wireless.$DEVICE.disabled=0
uci set wireless.$DEVICE.hwmode=11g
uci set wireless.@wifi-iface[0].network=wlan
uci set wireless.@wifi-iface[0].mode=adhoc
uci set wireless.@wifi-iface[0].ssid=WBM2009v2-Test0
uci set wireless.@wifi-iface[0].encryption=none
uci set wireless.@wifi-iface[0].bssid=02:ca:fe:ca:ca:00
uci set wireless.@wifi-iface[0].rate=54M
uci set wireless.@wifi-iface[0].bgscan=0
uci set network.wlan=interface
uci set network.wlan.proto=static
uci set network.wlan.ipaddr=$IP
uci set network.wlan.netmask=255.255.255.0

# commit uci changes and restart wifi
uci commit wireless && wifi

disabling dnsmasq, firewall, httpd

set -a

/etc/init.d/dnsmasq stop
/etc/init.d/dnsmasq disable

/etc/init.d/firewall stop
/etc/init.d/firewall disable

/etc/init.d/httpd stop
/etc/init.d/httpd disable
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01