Zipit Linux Setup

From eLinux.org
Jump to: navigation, search

Configuring Linux to be an Ad-Hoc Networking Node

    1. Click System->Administration->Networking 2. Click on "Wireless Connection", click Properties. 3. Check "This device is configured", set the rest of the options as follows: Wireless Settings
  • ESSID: zipnet
  • WEP key: [blank]
   Configuration Settings
  • Configuration: Static IP address
  • IP address: 10.0.1.9
  • Subnet mask: 255.255.255.0
  • Gateway address: 10.0.1.9

Media:gnomeadhoc.png

   4. Click OK.
   5. Click on "Wireless connection" again, click the "Activate" button.
   6. Change "Default gateway device" to "ath0" or "wlan0" (whichever)
   7. Click OK.

Putting back your network settings

    1. Go back to Networking, deactivate "Wireless connection", set the default gateway device back to eth0. 2. Reboot if you find that your internet/ethernet connection isn't working right away.

Configuring Linux to be a Wireless Network Bridge

This configuration allows you to bridge a wired ethernet connection with a wireless connection, essentially allowing a single WiFi card to act as an access point. (In reality, it's an ad-hoc network that is also bridging a network, but your ZipIt can't tell the difference.) This is really useful with a ZipIt because it'll let you share your internet connection with the device without a wireless access point.

Please note: The following instructions assume your wireless device to be called ath0. This will be the case if your device uses the Mad Wifi drivers. If it doesn't, then it's device name is probably wlan0. If unsure, identify your wireless device name by running iwconfig, and then make the corresponding replacements in the instructions below. Also note: If you've just installed BURN3, make sure you've put back your network settings as described in the section above this.

  1. Disable your firewall. In Ubuntu with Firestarter installed, it can be done with the command:
sudo /etc/init.d/firestarter --stop

If you don't disable your firewall, the NAT forwarding gets messed up or something.

2. Enable your wireless card. Type the following commands in a terminal:

sudo -s
ifconfig ath0 up
iwconfig ath0 mode Master
iwconfig ath0 channel 6
iwconfig ath0 essid zipnet key 0102030405
exit


3. Bridge your wireless to wired network. Firstly, you need to install bridge-utils. In Ubuntu/Debian, simply type into a terminal:

sudo apt-get install bridge-utils

Now, find out what your router's IP address is. Run the command: route

You should get output something like the following:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.1.0        *               255.255.255.0   U     0      0        0 eth1
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
(I don't know how to format to differentiate from a command to run)

192.168.1.1 is then the gateway for me to use as its the default.

We need to create the network bridge with a gateway IP that's on a different IP range than the one that your router is on, and with a different IP address. To be on the safe-side, we'll use 192.168.16.1 as our bridge's IP address. Type in the following commands:

   brctl addbr br0
   brctl addif br0 ath0
   ifconfig br0 inet 192.168.16.1 broadcast 192.168.16.255 netmask \
     255.255.255.0 up


4. Install and setup DHCPD In Ubuntu/Debian, install dhcpd by typing into a terminal:

sudo apt-get install dhcpd
(Ubuntu may say its gone and selected dhcp instead. This is fine.)

Now, edit one of the dhcp configuration files with:

sudo nano /etc/conf.d/dhcp

... and change the line IFACE="" to: IFACE="eth0 eth1 br0" (the eth1 part might be useless)

Next, edit you dhcpd.conf file with:

sudo nano /etc/dhcpd.conf

... and add lines that look something like this:

subnet 192.168.16.0 netmask 255.255.255.0 {

   range 192.168.16.2 192.168.16.255;
   option routers 192.168.16.1;
}

subnet 192.168.0.0 netmask 255.255.255.0 {

   range 192.168.0.3 192.168.0.255;
   option routers 192.168.0.1;
}

Replace 192.168.0.0 with an entry that corresponds to your own wired ethernet network, replace the "range" line with another corresponding line, and replace 192.168.0.1 with the IP address of your router.

Finally, run the DHCP server with:

sudo dhcpd


5. Enable IP masquerading. In a terminal window, type:

sudo -s
echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
exit


Note, in the above: Replace eth0 with ppp0 if you're not behind a router... eth0 should go out to the internet (eth0 is hooked up to my router)

6. Test it out On your ZipIt, type:

iwlist eth0 scan

... and make sure that your wireless network is present.

If it is, then on your ZipIt, type:

iwconfig eth0 essid zipnet key 0102030405
udhcpc


Now, your ZipIt should retrieve an IP address (there might be some errors in there, but they probably won't affect you, see Step 4 of OpenZipIt Linux Install for more details)

Test out your connection by typing on your ZipIt:

ping 192.168.16.1

then:

ping www.google.com

Disabling the network bridge:

In Ubuntu/Debian, simply execute the following commands in a terminal:

sudo -s
brctl delif br0 ath0
ifconfig br0 down
brctl delbr br0
ifconfig ath0 down
iptables -t nat -F
exit


Again, if your wireless card's device name is wlan0 instead of ath0, please make the replacement in the above lines accordingly.