Monday, May 18, 2015

HostAPd Installation and Configuration

The version of HostAPd available in the Raspbian repositories is not compatible with the Edimax USB Wifi adapter. So, I have to download the network driver for the RTL8188CUS chipset, compile it, and then install HostAPd. After that, I have to configure HostAPd to use WEP encryption. WEP (Wired Equivalent Privacy) encryption is not very secure, as it can be easily broken into, but the router that I have is older and only supports WEP, so that is what I have to use. Commands used to compile, install, and configure HostAPd:

1. Go to http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true and download the Linux driver.
2. Unzip the file and navigate to the ~/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/hostapd.
3. Run a make and then a make install.
4. sudo nano /etc/hostapd/hostapd.conf # hostapd configuration file
5. interface=wlan0
    driver=rtl871xdrv
    ssid=Pi-AP
    hw_mode=b
    channel=1
    macaddr_acl=0
    auth_algs=1
    wep_default_key=0
    wep_key0=PASSWORD
6. sudo nano /etc/default/hostapd
7. DAEMON_CONF="/etc/hostapd/hostapd.conf" # Decides which configuration file to use
8. sudo nano update-rc.d hostapd enable # Starts the hostapd service when the Raspberry Pi boots up
9. sudo nano update-rc.d isc-dhcp-server enable # Starts the isc-dhcp-server when the Raspberry Pi boots up

Sunday, May 3, 2015

DHCP Server

DHCP is an acronym for Dynamic Host Configuration Protocol. A DHCP server automatically assigns IP addresses to devices that attempt to connect to a network. Commands used to install a DHCP server:

sudo apt-get install isc-dhcp-server # installs the DHCP server
sudo nano /etc/dhcp/dhcpd.conf # Edit this file

# Comment out these two sections on lines 13-14:
# option domain-name "example.org";
# option domain-name-servers ns1.example.org, ns2.example.org;

# Remove the comment from line 21:
authoritative;

# Add this segment at the end of the file:
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.80 192.168.1.90;
  option broadcast-address 192.168.1.255;
  option routers 192.168.1.1;
  default-lease-time 600;
  max-lease-time 7200;
  option domain-name "Pi-AP";
  option domain-name-servers 8.8.8.8, 8.8.4.4;
}
# Save the file

sudo nano /etc/default/isc-dhcp-server # Edit this file
INTERFACES="wlan0"
# Save the file


sudo nano /etc/network/interfaces # Edit this file
iface wlan0 inet static # Changed from iface wlan0 inet dhcp
  address 192.168.1.1
  netmask 255.255.255.0
# iface default inet dhcp # Comment out this line