I am trying to set up an ad-hoc network of Pis (not connected to the Internet). I am able to ping and ssh among the Pis by changing the /etc/network/interfaces file by adding the lines to each Pi by setting a static IP address:
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-channel 1
wireless-essid CTWifi
wireless-mode ad-hoc
Now I am trying to set up a DHCP server so IP addresses are dynamically allocated when they connect to the ad hoc network. I was following this video: https://www.youtube.com/watch?v=5BkfztZ0pOE and was able to connect to the ad hoc network from my Windows laptop.
However, I am not able to ping or ssh the Pis from my laptop. It seems that there is no IP address allocated to my laptop so I assume that the DHCP server is not working.
no IP address when connected to ad-hoc network
I added the following lines to the /etc/dhcp/dhcpd.conf file to set configure the DHCP subnet configuration:
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.254;
option domain-name-servers 8.8.8.8;
option domain-name "CTWifi";
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}
I also uncommented the following lines in the /etc/default/isc-dhcp-server file to start the DHCP server:
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
DHCPDv4_PID=/var/run/dhcpd.pid
INTERFACESv4="wlan0"
When I connect to the network, my computer does not have an IP address designated to it, so I assumed the DHCP server is not working
When I attempt to the ping the Pis, it seems to keep the old IP address from the previous connection (192.168.0.6 , my own Wifi connection)
The settings are configured to have the IP address automatically allocated by the DHCP server, but it is not working, so I tried to set it manually, but it still keeps the old IP address and the manually set one.
I followed the steps in the video exactly, but I am confused about what I am doing wrong. Any help will be appreciated. Thanks
1 Answer 1
Based on the detail you added in Comments (which should be edited into your Question)
I want to connect this standalone network to a laptop or mobile phone intermittently to capture data the system gathers over time (the system takes photos)
You would be better to set up an Access Point
The default setup for an Access Point includes a DHCP server and allows easy access from virtually any computer system. I use this when travelling.
An Ad-Hoc network, by contrast, requires ALL systems to be in Ad-Hoc mode, and I doubt any phone can do this.
dnsmasq
.