Building a Linux Wireless Network without Access Point (AP) from the scratch

Posted in How To's by Shafkat Shahzad, M.Sc - Senior Technical Content Manager on March 22nd, 2009

Installing the Client Computer
The computer is a:
Pentium I 133Mhz
Hard disk= 1.2Gb
VGA=Trident 256Kb ISA
Ethernet= 3Com 509c ISA
Wireless= Conceptronic Airbridge 11iDT (PCI)
RAM=32 Mb
Floppy and CDROM 44x

First be sure to have the PCMCIA card inside the PCI.

Select on bios CDROM to BOOT, insert Red Hat linux CD 1 and power on

On the first menu type: text

Welcome to Redhat Linux press OK

Language selection: I’ll select Spanish

Keyboard: es

Mouse selection: None (I don’t have it)

Installation Type: Custom

Hard disk Partition: Disk Druid

Delete all the partitions and then create:
ext3 type partition on / size=1150Mb
swap type partition with the rest of diskspace= 72Mb (aprox RAMx2)
OK
now a screen asks me to use SWAP because of the low RAM size it has.
Choose OK
Boot Manager menu
Select to install GRUB on /dev/hda Master Boot Record (MBR)
Special parameters for the boot manager? no, just press OK

Boot Manager Configuration, the default is OK

Grub Password? I do not need it, but if you want, type in a password

Firewall configuration, choose No Firewall (you can setup it later)

Languages supported: English(UK)

Time Zone: UK

Root Password: Type whatever you want as a password

User add: add an user account (recommended)

Autentication Configuration: Default is OK (Shadow and MD5)

Packages selection:
Choose this:

Notebook support
Network support
Emacs
Utilities
Software development
Kernel development

Total Size=821Mb

Press OK

Now you will have to wait for the installation process.
You will only need Redhat 7.3 disks 1 and 2
Then you’ll be asked to create a boot floppy disk (a good idea)
Completed , press OK to reboot
the CD will be ejected and the machine rebooted
Kudzu (hardware detection utility) detects the 3com ethernet card I press Configure
Do you like to setup networking? yes
IP adress 192.168.0.12
Netmask: 255.255.255.0
Default Gateway (IP):
Primary Nameserver: 195.235.113.3
OK
The login screen will appear

Red Hat Linux release 7.3 (Valhalla)
Kernel 2.4.18-3 on an i586

localhost login:

login as root and type the password you set.

Now we will install a ssh server to login remotely, this is optional (because the computer is not near)
insert CD number 2 and mount it:
mount /mnt/cdrom
cd /mnt/cdrom/Redhat/RPMS/
ls *ssh*
and install the ssh server
rpm -Uvh ssh-server….rpm
cd /
and umount it
umount /mnt/cdrom

now ssh server will be launched when you reboot, but to enable right now type:
/etc/init.d/sshd start

now from another linux computer on the network:
ssh root@192.168.0.12
to login remotely as root

Let’s continue. Seting up the wireless card:
chmod 744 /etc/pcmcia/config.opts

use now your favorite text editor:

emacs /etc/pcmcia/config.opts
go to the bottom and type:

card “Conceptronic Wireless”
version “802.11″, “11Mbps Wireless LAN Card”
bind “orinoco_cs”

Save (Ctrl+X,Ctrl+S) and exit (Ctrl+X,Ctrl+C)
Another file must change is:

chmod 744 /etc/pcmcia/wireless.opts

emacs /etc/pcmcia/wireless.opts

Go to the bottom and search for:

# Generic example (describe all possible settings)
*,*,*,*)

and modify with this fields like this:

*,*,*,*)
INFO=”Wireless Client Configuration”
ESSID=”sorgonet.com”
MODE=”Managed”
RATE=”auto”
CHANNEL=”1″
# La clave se pone si es encriptada
KEY=”"
;;

Save and Exit.
What does it mean:
INFO put whatever you want
ESSID is the ID for the wireless which is defined you the Access Point you connect to.
MODE Managed is to use it like a client
RATE auto is the speed
KEY is used for encripted connections the password comes here (we don’t use it)

Now must create this file:
emacs /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
MODE=managed
ESSID=”sorgonet.com”
RATE=auto
TXPOWER=auto
KEY=”" # Only for encrypted connections
BOOTPROTO=static
IPADDR=10.0.0.2
NETMASK=255.0.0.0
ONBOOT=yes
GATEWAY=10.0.0.1
Save and Exit

Now its time to reboot
reboot

login again as root and to check it type iwconfig and ifconfig:

[root@localhost root]# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

eth1 IEEE 802.11-DS ESSID:”sorgonet.com” Nickname:”localhost.localdomain”
Mode:Managed Frequency:2.422GHz Access Point: 44:44:44:44:44:44
Bit Rate:2Mb/s Tx-Power=15 dBm Sensitivity:1/3
Retry min limit:8 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0/92 Signal level:134/153 Noise level:134/153
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

[root@localhost root]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:20:AF:5A:5A:1D
inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:127 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:12347 (12.0 Kb) TX bytes:12349 (12.0 Kb)
Interrupt:5 Base address:0×220

eth1 Link encap:Ethernet HWaddr 00:50:C2:01:97:19
inet addr:10.0.0.2 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:4 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:512 (512.0 b)
Interrupt:11 Base address:0×100

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

[root@localhost root]#

Now we can install also wavemon to see the signal strength

wget -c ftp://rpmfind.net/linux/contrib/libc6/i386/wavemon-0.3.3-1.i386.rpm
rpm -Uvh wavemon-0.3.3-1.i386.rpm
wavemon to run it (but we have first to be connected to an Access Point to recieve data.

route add default gw 10.0.0.1 dev eth1

Installing a Linux Access Point (wireless card in Master mode)

The PC is:
Pentium I 75Mhz
HD= 4.3Gb
RAM= 64Mb
VGA= S3 Trio
Ethernet= ISA 3Com c509
Wireless= Conceptronic Airbridge 11iDT (PCI)
CDROM 44x
First: Enter the BIOS setup utility and choose:
No floppy disk, Boot from CDROM and Halt on NO Errors. That’s because once all intalled, we won’t connect a keyboard nor a VGA card an do not wish to have Keyboard Not Found errors.

Then Insert first Red Hat 8.0 CD and select linux text.
Welcome to Red Hat linux, CD found, Media test, SKIP.
Welcome to Red Hat linux press OK.
Select Language, we choose English.
Select keyboard type: es (english)
Mouse Selection: no mouse OK
Installation type: Custom
Hard Disk Partition Configuration: Select Disk Druid
Delete all existing partitions and create one ext3 / and other swap
The hard disk is 4110Mb we choose:
3900Mb ext3 as /
The remaining space SWAP 211Mb
press OK.
Boot Loader Config: Choose GRUB.
Boot Loader additional parameters: just press OK (we dont need it)
Password for GRUB write one if you want.
Default boot loader configuration: Red Hat Linux /dev/hda1 OK.
Boot Loader install choose to install on MBR.
Firewall Configuration: None and OK.
Additional language to use on this system: English (English) OK.
Time zone: British Standard Time
Root Password: enter the password on both textbox and OK.
Add users: Add a user with his own password. OK.
Authentification Config: The Defaults are:
* Shadow passwords
* MD5 passwords
OK
Packages selection: We have 4Gb of disk space so, we installed more than we need.
* Administration tools
* Development Tools
* Editors
* FTP Servers
* Kernel Development
* Network Servers
* Server Configuration tools
* System Tools
* Text Based Internet
* Web Server
Total: 1183 Mb.
OK
A complete system log will be created. Press OK.

Now its time to wait… installation is copying files to your hard disk.
Change to CD disk 2 when requested.
Create a boot disk, since we have not floopy disk we don’t create it.
Congratulations, press OK
The CD-ROM will be ejected, remove it, the sistem will reboot.
We only used CD 1 and 2 of Red Hat linux.
The system will boot, and kudzu detects our ethernet card, we press Configure
Do you Like to setup networking? YES
Configure TCP/IP
IP adress 192.168.0.69
Netmask: 255.255.255.0
Default Gateway (IP): 192.168.0.1
Primary Nameserver: 195.235.113.3
OK

The login screen appears, login as user: root and your password.

Type setup and go to System Services

Unselect:
isdn
lpd
sendmail

and Select:
httpd
vsftpd

and quit, now reboot

This driver can be found here
http://hostap.epitest.fi/
The latest version can be downloaded: hostap-2002-09-12.tar.gz

wget -c http://hostap.epitest.fi/releases/hostap-2002-09-12.tar.gz
tar -zxvf hostap-2002-09-12.tar.gz
cd hostap-2002-09-12
now check for wireless-tools
rpm -qa |grep ‘wireless-tools’
it says that redhat 8.0 comes with lastest version wireless-tools-25-1 and it’s installed on our system. To check for newer versions, go to www.rpmfind.net and search for wireless.

cd /usr/src/
ln -s linux-2.4 linux
cd linux/configs
Here the .config files remains.
cp kernel-2.4.18-i586.config ../.config
cd /root/hostap-2002-09-12
make pccard
make install_pccard

chmod 644 /etc/pcmcia/config.opts
edit /etc/pcmcia/config.opts and add this lines at bottom:

card “Conceptronic Wireless”
version “802.11″, “11Mbps Wireless LAN Card”
bind “hostap_cs”

We can install bridge-utils package and this can be downloaded from:
http://bridge.sourceforge.net/bridge-utils/bridge-utils-0.9.6-1.i386.rpm
and also comes on Red Hat 8.0 CDs.

cd /root
wget -c http://bridge.sourceforge.net/bridge-utils/bridge-utils-0.9.6-1.i386.rpm
rpm -Uvh bridge-utils-0.9.6-1.i386.rpm
cd /etc/sysconfig/network-scripts/

emacs ifcfg-eth0
Leave only this lines:
DEVICE=eth0
IPADDR=192.168.0.69
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
GATEWAY=192.168.0.1

Save and exit

emacs /etc/sysconfig/network-scripts/ifcfg-wlan0
Leave only this lines

DEVICE=wlan0
MODE=Master
ESSID=”sorgonet.com”
RATE=auto
TXPOWER=auto
KEY=”"
BOOTPROTO=static
ONBOOT=yes
/usr/bin/prism2_param wlan0 host_decrypt 1
IPADDR=10.0.0.1
NETMASK=255.0.0.0
NETWORK=10.0.0.0

Save and exit.

To Share the internet connection add this lines to rc.local:

emacs /etc/rc.d/rc.local

#Activate ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
#Delete rules
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -F INPUT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -F OUTPUT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -F FORWARD
/sbin/iptables -t nat -F
#Apply new rules
/sbin/iptables -A FORWARD -i wlan0 -o eth0 -m state –state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
/sbin/iptables -A FORWARD -j LOG
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Save and exit.

To install a DHCP server to assign IP address to clients follow the steps:
You can found the package on redhat 8.0 CDs dhcp-3.0pl1-9.i386.rpm
rpm -Uvh dhcp-3.0pl1-9.i386.rpm
setup
select System Services, and check DCHPD to run it automatically when system boots.

emacs /etc/dhcpd.conf

Put this lines:

option routers 10.0.0.1;
option domain-name-servers 195.235.113.3, 195.235.96.90;
subnet 10.0.0.0 netmask 255.0.0.0 {
range 10.0.0.100 10.0.0.250;
}
ddns-update-style ad-hoc;

Save and exit.

reboot

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Leave a Comment