There's plenty out there on setting up an ad-hoc network on your RPi, (Mine's an A, I believe.) but almost none on how to do it when you're using Raspbian Jessie. As such, I'm having a bit of trouble getting things working.

I've altered my /etc/network/interfaces to read

auto lo
iface lo inet loopback

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet manual
    wireless-channel 1
    wireless-essid PiNet
    wireless-mode ad-hoc

#allow-hotplug wlan0
#iface wlan0 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

To get a static IP, I altered my /etc/dhcpcd.conf by adding

interface wlan0
static ip_address=

to the bottom of the file.

I also installed isc-dhcp-server and changed my /etc/default/isc-dhcp-server by adding wlan0 to INTERFACES=''

Finally, I changed my /etc/dhcp/dhcpd.conf by...

  • changing ddns-update-style none; to ddns-update-style interim;
  • uncommenting authoritative;
  • and adding subnet netmask { range } to the bottom of the file.

It creates an open network PiNet, but my computer can't connect to it.

Is there anything obvious that I've missed?

  • You do it exactly the same way you always did. What you can't do is setup an ad-hoc network AND use dhcpcd to manage networks.
    – Milliways
    Jan 11 '17 at 23:00
  • @Milliways Not sure how else I'd do it. Anyway, as it turns out, I found a solution that I like much better than what I was trying for. Not sure if it's more elegant or will cause issues for me in the future. Lets me SSH in just fine though!
    – CoilKid
    Jan 12 '17 at 0:24

After a bit of digging around, I found this. You can basically follow all the instructions, except ignore the bits about configuring network address translation and iptables. It won't create an ad-hoc network per se, but, if you're just trying to SSH into a RPi-based-device when you're in the middle of a field like I was, this should work well.


  • install hostapd and dnsmasq on your RPi

  • change your /etc/network/interfaces file to read something like:

    auto lo
    iface lo inet loopback
    iface eth0 inet dhcp
    allow-hotplug wlan0
    iface wlan0 init static
     wireless-mode ad-hoc
    #allow-hotplug wlan0
    #iface wlan 0 inet manual
    #    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  • open your dnsmasq config file (/etc/dnsmasq.conf) and uncomment #dhcp-range=,,12h

  • create a hostapd config file (sudo nano /etc/hostapd/hostapd.conf) and enter something to the effect of


(Obviously change the ssid and passphrase, and you might have to find the correct driver for your wifi adapter. The guide suggested that you can leave off the driver= line if you're using a RPi 3, I don't know if that's true.)

  • Make sure hostapd knows about the config file. Open /etc/default/hostapd and replace #DAEMON_CONF="" with DAEMON_CONF="/etc/hostapd/hostapd.conf". Open /etc/init.d/hostapd and replace DAEMON_CONF= for DAEMON_CONF=/etc/hostapd/hostapd.conf.

  • Reboot your RPi, connect to it with your favourite device and SSH away!

  • You are doing things incorrectly. You need to set your ip address in /etc/network/interfaces and NOT in /etc/dhcpcd.conf. You are attempting to provide the dhcp server with dhcpd while also using a dhcp client (dhcpcd). You should not be using a dhcp client on the same interface when you yourself are the server. The only reason this works now is because you're not an authoritative dhcp server thus you do not deny the ip requested by dhcpcd.
    – Hydranix
    Jan 12 '17 at 1:03
  • Also this is not an ad-hoc network. This is an access point.
    – Hydranix
    Jan 12 '17 at 1:11
  • @Hydranix Fair points to both, but I tried to set the static IP from interfaces. Didn't work. It only seems to have a static IP when I do it from dhcpcd. As to the other one... True, but it works better than what I wanted. I only wanted a way to SSH into a rover I'm building when I'm not near my LAN. If I did it right, it should do just that. And it's password protected!
    – CoilKid
    Jan 12 '17 at 1:48
  • @Hydranix Whoops, that's why it wouldn't work. I had a typo! Thanks for making me double check that. Got it working with just interfaces edit. I'll correct that in my answer now. Anything else you noticed?
    – CoilKid
    Jan 12 '17 at 2:02
  • wireless-mode ad-hoc should be wireless-mode Master
    – Hydranix
    Jan 12 '17 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.