HowTos: Difference between revisions

From WirelessAfrica
mNo edit summary
No edit summary
Line 135: Line 135:
# domain-name, domain-name-servers, host-name,
# domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
netbios-name-servers, netbios-scope;
=HowTo setup your own network profiles on a laptop=
I have always wanted to write some good scripts that configure my laptop for home and work wireless/ethernet automatically in ubuntu and so I set about building up a set of scripts that I can call.
I have four scenarios:
1. use laptop at home with wireless access point
2. use laptop at home with ethernet
3. use laptop at work with wireless access point
4. use laptop at work with ethernet
I created two files in /etc/network: interfaces.work and interfaces.home with all the ethernet and wireless settings for home and work in this file
/etc/network/interfaces.home
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
iface eth0 inet static
address 10.3.13.102
netmask 255.255.255.0
gateway 10.3.13.1
#The wireless network interface
iface eth1 inet dhcp
wireless-essid pta-mesh
wireless-mode Ad-Hoc
wireless-channel 1
wireless-key off
/etc/network/interfaces.work
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
iface eth0 inet dhcp
# The wireless network interface
iface eth1 inet dhcp
wireless-essid icomtek
wireless_mode Managed
wireless-key off
I also created two files with my dns and domain settings for home and work in /etc/ called resolv.home and resolv.work
resolv.home
search icomtek.csir.co.za elarduspark.org.za cids.org.za
nameserver 146.64.28.1 10.3.13.1
resolv.work
search icomtek.csir.co.za cids.org.za
nameserver 146.64.28.1
Here are my scripts that configure my interfaces based on the above files
1. Setup for wireless networking at home
/usr/local/bin/homenet-wireless
#!/bin/bash
echo Setting up network for home wireless network
sudo cp /etc/network/interfaces.home /etc/network/interfaces
eth0_status=`ifconfig | grep eth0`
eth1_status=`ifconfig | grep eth1`
if [ -n "$eth0_status" ]; then
sudo ifdown eth0
fi
if [ -n "$eth1_status" ]; then
sudo ifdown eth1
fi
sudo ifup eth1
sudo cp /etc/resolv.home /etc/resolv.conf
2. Setup for ethernet networking at home
/usr/local/bin/homenet-fixed
#!/bin/bash
echo Setting up network for home ethernet
sudo cp /etc/network/interfaces.home /etc/network/interfaces
sudo cp /etc/resolv.home /etc/resolv.conf
eth0_status=`ifconfig | grep eth0`
eth1_status=`ifconfig | grep eth1`
if [ -n "$eth0_status" ]; then
sudo ifdown eth0
fi
if [ -n "$eth1_status" ]; then
sudo ifdown eth1
fi
sudo ifup eth0
3. Setup for wireless at work
/usr/local/bin/worknet-wireless
#!/bin/bash
echo Setting up network for work wireless network
sudo cp /etc/network/interfaces.work /etc/network/interfaces
sudo cp /etc/resolv.work /etc/resolv.conf
eth0_status=`ifconfig | grep eth0`
eth1_status=`ifconfig | grep eth1`
if [ -n "$eth0_status" ]; then
sudo ifdown eth0
fi
if [ -n "$eth1_status" ]; then
sudo ifdown eth1
fi
sudo ifup eth1
4. Setup for ethernet at work
/usr/local/bin/worknet-fixed
#!/bin/bash
echo Setting up network for work ethernet
sudo cp /etc/network/interfaces.work /etc/network/interfaces
sudo cp /etc/resolv.work /etc/resolv.conf
eth0_status=`ifconfig | grep eth0`
eth1_status=`ifconfig | grep eth1`
if [ -n "$eth0_status" ]; then
sudo ifdown eth0
fi
if [ -n "$eth1_status" ]; then
sudo ifdown eth1
fi
sudo ifup eth0

Revision as of 17:02, 21 November 2005

HowTo build your own mesh node

Firstly:

You will need the following:

Hardware:

Node:

Either a PC or a Wireless Router or SBC Single Board Computer

Antennae:

Buy or make your own (see Home-Brew Antennae).

Other:

  1. Cables: Rf and UTP cable
  2. POE convertors, Buy or make your own (see Home-Brew POE)
  3. Pole and brackets

Firmware

Your wireless router may require firmware updates that will be made available here.

OpenWRT and spinoffs (Freifunk, DD-WRT)

Sveasoft

Software

Routing

Firstly you need to choose a routing protocol, if any, that suits the rest of your network. You need to make sure that your node has the routing protocol installed and configured. For instance, you may need to install an OLSR client. Some firmware versions, like Freifunk's, have routing protocols installed by default.

Then:

Build it!

See Linksys hack for 1st stab at this, more soon!

Software/Firmware Settings

IP Allocation You will need to obtain an IP address for your node. 192.***.***.***/**

Routing protocl Settings

Example (OLSR):

HNA:

HowTo create an ipk package

TOOLS

Get the script rightfully called ipkg-build at, among other places, ftp://ftp.handhelds.org/packages/ipkg-utils, or http://www.mizi.com/download/mz20/ipkg-build.

CREATING THE PACKAGE STRUCTURE

Say you wanna create a package called MyPackage; you further wanna package the project called MyProject. Then do the following:

  1. Create a directory called MyPackage.
  2. Inside directory MyPackage, create a directory called CONTROL.
  3. Copy your project (MyProject) to the MyPackage directory.
  4. Inside directory CONTORL creating a file called control.

NOTE:

When the package is installed on the target, the MyPAckage directory will be created with respect to root. So if you wanted your files to be installed in /usr/bin on the target system, then our project would in this case be “/usr/bin”. That is you create inside directory MyPackage a directory called /usr/bin.

FORMAT AND CONTENTS OF /CONTROL/control


Package: MyPackage

Priority: optional // default

Version: 1.0 //package version

Architecture: mipsel

Maintainer: I_maintain@you.com

Source: ftp:ftp:122.122.122.122 //See Note below

Section: misc //See Note below

Description: This is an attempt to create ipkg.


NOTE:

The fields Section and Source seem rather useless to me in this example and I initially left them out; however the ipkg-build script complained requiring them, so I just put them in as a workaround without knowing/”caring” of their need. There are other fields not included here which you might need for your purposes, check the web for more.

Further the comments are mine for this documentation purposes only and the script MIGHT NOT permit comments.


RUNNING THE ipkg-build SCRIPT

Now simply run (of course being outside of the directory MyPackage):

“./ipkg-build –c –o root –g root MyPackage” // as root or non-root, or

“./ipkg-build –c MyPackage” //as root

IF all’s well, a package on the current directory will be created.

NOTE:

Without the “-c” option, I could not get the package installed successfully, you can try with or without and see for yourself.

HowTo create/be part of a VPN

If you want to be part of a Virtual Private Network, you will require VPN software on your client.

HowTo Stabilise a ver 2.2 WRT54G running OpenWRT based firmware

After a lot of tweaking OLSR running on Linksys has had no "ping down" messages for about 5 days now. Some of the tips to getting OLSR on OpenWRT stable.

1. Lock all the nodes to 802.11B don't let it auto sense 2. If there are any v2.2 hardware devices, change the clock speed to 216MHz with the following commands1

  1. nvram set clkfreq=216
  2. nvram commit
  3. reboot

3. Lock the RX and TX antenna to the one you connected your external antenna too, don't use AUTO. TAKE NOTE!!! On Version 2.0 hardware Antenna A is on the left looking from the front of the linksys and and on Version 2.,2 hardware Antenna A is on the right looking from the fron of the linksys. This caught me out a few times.

HowTo stop dhcp client over-writing resolv.conf

Finally I found out how to do it

Edit the /etc/dhcp3/dhclient.conf file Find the line that says request

Comment out the line that requests for domain-name, domain-name-servers and host-name

request subnet-mask, broadcast-address, time-offset, routers,

  1. domain-name, domain-name-servers, host-name,

netbios-name-servers, netbios-scope;


HowTo setup your own network profiles on a laptop

I have always wanted to write some good scripts that configure my laptop for home and work wireless/ethernet automatically in ubuntu and so I set about building up a set of scripts that I can call.

I have four scenarios: 1. use laptop at home with wireless access point 2. use laptop at home with ethernet 3. use laptop at work with wireless access point 4. use laptop at work with ethernet

I created two files in /etc/network: interfaces.work and interfaces.home with all the ethernet and wireless settings for home and work in this file

/etc/network/interfaces.home

  1. This file describes the network interfaces available on your system
  2. and how to activate them. For more information, see interfaces(5).
  1. The loopback network interface

auto lo iface lo inet loopback

  1. The primary network interface

iface eth0 inet static address 10.3.13.102 netmask 255.255.255.0 gateway 10.3.13.1

  1. The wireless network interface

iface eth1 inet dhcp wireless-essid pta-mesh wireless-mode Ad-Hoc wireless-channel 1 wireless-key off

/etc/network/interfaces.work

  1. This file describes the network interfaces available on your system
  2. and how to activate them. For more information, see interfaces(5).
  1. The loopback network interface

auto lo iface lo inet loopback

  1. The primary network interface

iface eth0 inet dhcp

  1. The wireless network interface

iface eth1 inet dhcp wireless-essid icomtek wireless_mode Managed wireless-key off

I also created two files with my dns and domain settings for home and work in /etc/ called resolv.home and resolv.work

resolv.home search icomtek.csir.co.za elarduspark.org.za cids.org.za nameserver 146.64.28.1 10.3.13.1

resolv.work search icomtek.csir.co.za cids.org.za nameserver 146.64.28.1

Here are my scripts that configure my interfaces based on the above files

1. Setup for wireless networking at home /usr/local/bin/homenet-wireless

  1. !/bin/bash

echo Setting up network for home wireless network sudo cp /etc/network/interfaces.home /etc/network/interfaces

eth0_status=`ifconfig | grep eth0` eth1_status=`ifconfig | grep eth1`

if [ -n "$eth0_status" ]; then sudo ifdown eth0 fi

if [ -n "$eth1_status" ]; then sudo ifdown eth1 fi

sudo ifup eth1

sudo cp /etc/resolv.home /etc/resolv.conf

2. Setup for ethernet networking at home /usr/local/bin/homenet-fixed

  1. !/bin/bash

echo Setting up network for home ethernet sudo cp /etc/network/interfaces.home /etc/network/interfaces sudo cp /etc/resolv.home /etc/resolv.conf

eth0_status=`ifconfig | grep eth0` eth1_status=`ifconfig | grep eth1`

if [ -n "$eth0_status" ]; then sudo ifdown eth0 fi

if [ -n "$eth1_status" ]; then sudo ifdown eth1 fi

sudo ifup eth0

3. Setup for wireless at work /usr/local/bin/worknet-wireless

  1. !/bin/bash

echo Setting up network for work wireless network sudo cp /etc/network/interfaces.work /etc/network/interfaces sudo cp /etc/resolv.work /etc/resolv.conf

eth0_status=`ifconfig | grep eth0` eth1_status=`ifconfig | grep eth1`

if [ -n "$eth0_status" ]; then sudo ifdown eth0 fi

if [ -n "$eth1_status" ]; then sudo ifdown eth1 fi

sudo ifup eth1

4. Setup for ethernet at work /usr/local/bin/worknet-fixed

  1. !/bin/bash

echo Setting up network for work ethernet sudo cp /etc/network/interfaces.work /etc/network/interfaces sudo cp /etc/resolv.work /etc/resolv.conf

eth0_status=`ifconfig | grep eth0` eth1_status=`ifconfig | grep eth1`

if [ -n "$eth0_status" ]; then sudo ifdown eth0 fi

if [ -n "$eth1_status" ]; then sudo ifdown eth1 fi

sudo ifup eth0