0

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)

enter image description here

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.

enter image description here

enter image description here

I followed the steps in the video exactly, but I am confused about what I am doing wrong. Any help will be appreciated. Thanks

8
  • the picture of your windows output of ipconfig inconveniently stops before any information about the wifi - and then whatever the pictures of ctwifi are, you end up with two ipv4 addresses on two different subnets Jan 14, 2020 at 4:53
  • 1
    First DO NOT post pictures of text - post text.
    – Milliways
    Jan 14, 2020 at 5:23
  • 1
    Why are you using Ad-Hoc? By definition there is no hierarchy on an Ad-Hoc network so there is no place to put a DHCP server, because no server can be guaranteed to be present. You should ask a question about what you ACTUALLY want to do, rather than about your assumed solution.
    – Milliways
    Jan 14, 2020 at 5:27
  • Just to make things more difficult for yourself you are using multiple subnets.
    – Milliways
    Jan 14, 2020 at 5:28
  • If tired, you can install dnsmasq.
    – M. Rostami
    Jan 14, 2020 at 11:06

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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