Skip to content

Instantly share code, notes, and snippets.

@dantheman213
Created January 10, 2016 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dantheman213/dd18651708f08138b4c8 to your computer and use it in GitHub Desktop.
Save dantheman213/dd18651708f08138b4c8 to your computer and use it in GitHub Desktop.
Raspberry Pi Start ad-hoc mode on Start up
1. sudo apt-get update
2. sudo apt-get install isc-dhcp-server
3. sudo nano /etc/default/isc-dhcp-server
> UPDATE LINE
INTERFACES="wlan0"
4. sudo nano /etc/dhcp/dhcpd.conf
DHCPDARGS=wlan0; #args for the dhcpd daemon -> limit DHCP to the wlan0 interface
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option domain-name "RPi-network";
option routers 10.0.0.1; #default gateway
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.2 10.0.0.20; #IP range to offer
}
5. sudo nano /etc/network/interfaces
# start interfaces upon start of the system
auto lo
# register loopback interface
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
# use manual ip configuration for wlan0 interface and allow hotplug as well
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
6. sudo nano /etc/rc.local
echo "Creating ad-hoc network"
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 key aaaaa11111 #WEP key
iwconfig wlan0 essid RPi #SSID
ifconfig wlan0 10.0.0.200 netmask 255.255.255.0 up
/usr/sbin/dhcpd wlan0
echo "Ad-hoc network created"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment