People:Mathias Neerup:SDU FrobitPro PC Wifi Setup

From FroboMind [www.frobomind.org]
Jump to: navigation, search


1. Login in using default login Several times duing this tutorial, you might see the following line:

[sudo] password for <username>:

Just enter the users password

2. Uninstall ubuntu's network-manager

sudo apt-get autoremove --purge network-manager network-manager-gnome


3. Add following line to /etc/udev/rules.d/90-network-driver.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="2001", ATTR{idProduct}=="3c20", RUN="/etc/RT2800USB.sh"

This will run the script /etc/RT2800USB.sh when the usb-dongle is connected

4. Open /etc/RT2800USB.sh

sudo nano /etc/RT2800USB.sh

Add:

#!/bin/sh
modprobe rt2800usb
echo  2001 3c20 > /sys/bus/usb/drivers/rt2800usb/new_id

5. Make the file executable

sudo chmod +x /etc/RT2800USB.sh

5. Reboot

sudo reboot

Connect to existing network
1. Open /etc/network/interfaces

sudo nano /etc/network/interfaces

Append the following lines:

  auto eth0
    iface eth0 inet dhcp
  auto wlan0
    iface wlan0 inet dhcp
       wpa-ssid YOUR-SSID-HERE
       wpa-psk YOUR-PASSWORD-HERE

An example

  auto eth0
    iface eth0 inet dhcp
  auto wlan0
    iface wlan0 inet dhcp
       wpa-ssid Look when IP
       wpa-psk p4ssW0rd

If you later on decide to use ethernet, eth0 is ready for connection. Save the file using ctrl+o, enter, then ctrl+x If you didn't open the file using sudo, you will get permission error. Close file without saving(ctrl+x) and write sudo !! (!! is the last command executed)

2. Reboot the FrobitPro using:

sudo reboot

3. When it's up again, you should now be on the network.


Setup an access point(ad hoc)

1. Plug in ethernet cable. You need to install a package(hostapd) - (incase you don't have internet available on the Frobit, but your connected using ssh, you can download the packages on your computer and transfer them to the Frobyte using scp)

2. Install hostapd

sudo apt-get install hostapd isc-dhcp-server -y 

3. Uninstall ubuntu's network-manager

sudo apt-get autoremove --purge network-manager network-manager-gnome


4. Open /etc/network/interfaces

sudo nano /etc/network/interfaces

Append the following lines:

     auto wlan0
     iface wlan0 inet static
       address 10.0.0.10
       netmask 255.255.255.0
  

You can change range and ip. 10.0.0.10 will now be the ip of the FrobitPro. Save the file using ctrl+o, enter, then ctrl+x If you didn't open the file using sudo, you will get permission error. Close file without saving(ctrl+x) and write sudo !! (!! is the last command executed)

5. Open /etc/hostapd/hostapd.conf

sudo nano /etc/hostapd/hostapd.conf

Add following:

interface=wlan0
driver=nl80211
ssid=<ssid goes here>
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=<password up in this>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

As an example:

interface=wlan0
driver=nl80211
ssid=FrobitPro01
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Bl4ckR0bot
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Save the file using ctrl+o, enter, then ctrl+x 6. Tell hostapd to use the configuration just created.

sudo nano /etc/default/hostapd

It looks like this:

# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
#DAEMON_CONF=""
# Additional daemon options to be appended to hostapd command:-
#       -d   show more debug messages (-dd for even more)
#       -K   include key data in debug messages
#       -t   include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

Remove uncomment at DAEMON_CONF="" and change it to DAEMON_CONF="/etc/hostapd/hostapd.conf"

It should now look like this:

# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
DAEMON_CONF="/etc/hostapd/hostapd.conf"
# Additional daemon options to be appended to hostapd command:-
#       -d   show more debug messages (-dd for even more)
#       -K   include key data in debug messages
#       -t   include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

7. Now reboot the FrobitPro. When it's up again, the network should be available(try to search from another computer to make sure)

sudo reboot

8. The last thing is to setup a DHCP server, so you laptop will get an ip. In case you don't want that, you can just assign a static ip to your interface on your laptop.
Clear the default configuration file using following line:

sudo su -c "echo \"\" > /etc/dhcp/dhcpd.conf"

9. Open /etc/dhcp/dhcpd.conf

sudo nano /etc/dhcp/dhcpd.conf

10. Add the following:

  subnet 10.0.0.0 netmask 255.255.255.0 {
    range 10.0.0.2 10.0.0.255;
    option broadcast-address 10.0.0.255;
    option routers 10.0.0.1;
    interface wlan0;
  }

11. Reboot. When up you should be able to connect and get an ip.

sudo reboot

12. To login(from your own laptop):

ssh robot@10.0.0.10 <- username (at) host

The following commands can be useful to debug: iwlist wlan0 scan <-shows network information(ESSID etc.) iwconfig <- shows information about the wireless connection
ifconfig <- shows information about your interfaces(also wlan0, your netcard)
sudo tail -f /var/log/syslog <- Shows errors, if any.
sudo dhclient -v -i wlan0 <- In case you don't get an ip, you can request one