I used the latest Raspbian image so did not need to install any drivers for the wifi dongle.
You need to check the name of your wifi dongle mine was "wlan0" , this can be done using the command.
Code: Select all
ifconfig
Code: Select all
nano /etc/network/interfaces
Next install the dhcp serverauto lo wlan0
iface lo inet loopback
iface wlan0 inet dhcp
wpa-ssid your-ssid
wpa-psk your-password
iface eth0 inet dhcp
Code: Select all
apt-get install isc-dhcp-server
Code: Select all
nano /etc/default/isc-dhcp-server
Now edit this fileINTERFACES="wlan0"
Code: Select all
nano /etc/dhcp/dhcpd.conf
Change any names/settings to suit your requirements. The hardware address will need changing to match yours, it can be found by running
Code: Select all
ifconfig
Because this file is not created when isc-dhcp-server is installed you need to create it.DDHCPDARGS=wlan0; # to specify to which interface your dhcpd server have to listen
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.255;
option domain-name "DSLR.PI";
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.10;
}
host raspberrypi {
hardware ethernet 80:1f:02:61:0e:b1;
fixed-address 192.168.1.3;
}
Code: Select all
touch /var/lib/dhcp/dhcpd.leases
Code: Select all
nano /etc/rc.local
Hope this helps people.if iwconfig | grep your-ssid
then
echo "Already conneced to wireless network"
else
echo "Setting up wireless hotspot"
ip link set wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 channel 4
iwconfig wlan0 essid 'RasPiDSLR'
iwconfig wlan0 key password
ip addr add 192.168.1.255/16 dev wlan0
ip link set wlan0 up
/usr/sbin/dhcpd wlan0
fi