raspberry pi installation without keyboard / mouse and hostapd access point configuration

As my home gateway I am using Raspberry PI Model B Raspberry PI Model B, which serves as gateway between internal home network and internet. I configured it to have three network interfaces, it comes with one RJ-45, I turned one usb port using USB to RJ45 another one, and second USB port is used for wireless adapter as I use it at same time as wireless access point.

Recently memory card inside it died and I had to rebuild all stuff with new card, and luckily ( at least one good thing ) same day Raspbian Jessie was released so it saved my time to do upgrade to it. If you want to download Respbian Jessie, go at this link download raspbian I will not go here in details how to transfer image to card, but tl;dr, you will need to dd it

First annoying thing when it comes to Raspberry PI and using it in my opinion is that you have to have keyboard and HDMI cable in order to connect it to see screen and proceed with configuration. I find it really bad, so I was started looking around ( at this stage I already dd-ed image to card! ) how to avoid this. You will need to do two things in order to boot Raspbian directly and connect to it via SSH without connecting to it directly.

#mkdir a
#mount /dev/sdb1 a 

Edit this file and add there ip address you want it bring up on boot. In my case I have inside my home network IP addresses from 192.168.11.X segment, so in my case I had below ( assuming my other machine had address from same network )

cat cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait ip=192.168.11.115

Important: Ensure in above file, that ip=x.x.x.x is in same line as rest of options in cmdline.txt file, if you have new line – it will fail during boot and ip will not be up.
Unmount first partition, and mount second

 # mount /dev/sdb2 a

On this partition,edit /usr/bin/raspbi-config and change

INTERACTIVE=True

to

INTERACTIVE=False

this will ensure that there will not be interactive menu when RPI starts, it will proceed with booting, with this you will get chance to connect via ssh to machine, and you can run raspbi-config ( do not forget to revert Interactive=True ) later.

From this point, you should have access to system, connect using default user pi and password raspberry

Now, I needed to configure Edimax EW-7811un Edimax EW-7811un – Edimax web site to turn my raspberry pi into access point for wireless network. This card needs small hacking.

First, get driver from Edimax web, here is link Edimax EW-7811un driver

You will need to build driver, the whole process is listed below

#mkdir /home/edimax
#cd /home/edimax

#wget www.edimax.com/edimax/mw/cufiles/files/download/Driver_Utility/transfer/Wireless/NIC/EW-7811Un/EW-7811Un_Linux_driver_v1.0.0.5.zip
#unzip EW-7811Un_Linux_driver_v1.0.0.5.zip
#cd EW-7811Un_Linux_driver_v1.0.0.5/
#unzip EW-7811Un_USB_linux_v4.0.2_9000.20130911.zip
#cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/wpa_supplicant_hostapd
#tar -xaf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz
#cd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812/wpa_supplicant
#make; make install

Next you will need to edit /etc/init.d/hostapd and change binary path to DAEMON_SBIN=/usr/local/bin/hostapd

configure /etc/hostapd/hostapd.conf to something like

#cat /etc/hostapd/hostapd.conf 
interface=wlan0
ssid=
channel=1
wmm_enabled=0
wpa=1
hw_mode=g
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0 
wpa_passphrase=

configure /etc/network/interfaces

#cat /etc/network/interfaces, in my case I have
auto lo

iface lo inet loopback
iface eth0 inet static
	address 192.168.XX.XXX
	netmask 255.255.255.240

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
	address 10.10.XX.XX
	netmask 255.255.255.0

I also configured dhcpd server to serve ip addresses to devices on wlan

# aptitute install isc-dhcp-server
# cat /etc/dhcp/dhcpd.conf

cat /etc/dhcp/dhcpd.conf 
option domain-name "elvirhome.local";
option domain-name-servers 10.10.10.1;

subnet 10.10.10.0 netmask 255.255.255.0 {
  range 10.10.10.2 10.10.10.10;
  option routers 10.10.10.1;
}

#cat /etc/default/isc-dhcp-server
INTERFACES="wlan0"

I also configured bind for my internal network, I used instructions from Debian bind9 configuration with addition of some local tweaks, but instructions at this link are good to make you running bind in matter of minutes!

After this, start isc-dhcp-server,bind and hostapd services

#systemctl start isc-dhcp-server.service ; systemctl start hostapd.service; systemctl start bind9 

I have custom iptables firewall rules script, obviously you will need to write your custom to allow traffic from internal network to outside network.That would be nice homework!I might publish mine… but will need to edit it and make readable
At this stage,services should be up and running and if you try to connect from your phone, you will see wireless network with ID specified above,authenticate with password you specified, if all is ok, then connection to outside world via raspberry pi should work like a charm.

Advertisements

#edimax-ew-7811un, #hostapd, #linux, #raspberry-pi, #wirelles-connection

Raspberry pi

My Raspberry Pi oder was delivered couple days ago.I ordered model B and plan to connect it to NAS ( still did not decided what kind of NAS to buy … any proposal? ) and have backup system.

#arm-raspberry-pi

Kindle Fire

Wanted to order $subject, but was stopped with (important) message below :(, so outside USA we will need to wait some time.Hopefully Amazon will fix this soon.From pictures and descriptions at Amazon seems it is nice device and definitely is on my wish-list and will buy it as soon as embargo for us outside of USA is removed 🙂

Important Message

The following items cannot be shipped to the addresses you selected. (Learn more.) You may either change the shipping addresses or remove the items by clicking Delete.

Kindle Fire, Full Color 7″ Multi-touch Display, Wi-Fi is not currently available to ship to the selected non-US address. To shop for Kindles available to ship to you, please visit the non-US Kindle product page.
Marware C.E.O. Hybrid for Kindle Fire Cover, Black cannot be shipped to the selected address.

#kindle-fire-amazon

My amazon experience

I bought an Kindle 3 for myself last December, and I am very happy user of it. This is my second Kindle 3.

So called “first” Kindle 3 had some screen defect which started to appear couple months after I received it. I knew it was under warranty, but I was little suspicious how it works when it comes to big companies as Amazon, as some people are complaining about slow customer response provided by big companies.

My personal experiences with Amazon customer support are extremely positive, I called them, said that my Kindle 3 has some screen defect, they gave me instructions how to sent it back, and within 3 working days I got new one.

So Amazon++ … great job

Why I wrote this post? I just want to give small praise to Amazon and their ( in my case ) excellent customer service

#kindle-amazon-customer-support

New hardware for my home network

All my working day is related to Linux/Unix, as my hobby I work again with Unix/Linux and my apartment is in some way like an lab/server room.
At my home, for testing purposes I have 9 machines ( ok, 8, the 9th is my wife’s laptop, but she is not aware that I am running nfs/samba share on it 😉 ).

Someone will say, using physical machines is not really the best approach, they are consuming to much power, they are noisy and I agree with that. In my case except home gateway, all of them are powered off and I am using them only when need to run some tests for some of stuff I am working on.

I have different OS-es, but mostly RHEL, CentOS, Debian, and OpenBSD. And yes, I do not have any Windows installation.

And if you think now, have you ever Elvir heard for virtualization, yes I am 🙂 I am using very extensively XEN/KVM.

I need advices from you, for small/portable storage. Experiences? Links? Anybody?

Thanks

PS: The newest machine I got is as below:

System Information
Manufacturer: IBM
Product Name: -[84804AG]-
Version: IBM CORPORATION

  1. lspci

00:00.0 Host bridge: Intel Corporation 82845 845 [Brookdale] Chipset Host Bridge (rev 11)
00:01.0 PCI bridge: Intel Corporation 82845 845 [Brookdale] Chipset AGP Bridge (rev 11)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 82)
00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 02)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC’97 Audio Controller (rev 02)
02:03.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5702X Gigabit Ethernet (rev 02)
02:04.0 VGA compatible controller: ATI Technologies Inc Rage XL (rev 27)
02:05.0 SCSI storage controller: Adaptec AIC-7892P U160/m (rev 02)
02:09.0 Network controller: AVM GmbH Fritz!PCI v2.0 ISDN (rev 02)
02:0a.0 Serial controller: Integrated Technology Express, Inc. IT8874F PCI Dual Serial Port Controller (rev 01