title: How to connect raspberry to WEP encrypted and dhcp enabled Ad-Hoc network
body: <p>I have Three Rasbperry Pi3 and I have configured 2 of them as dhcp enabled ad-hoc network server they are working fine and I can connect to them using Windows PC and Linux PC as well as from Mobile. The dhcp also assigns the 'Laptop, PC and Mobile' the dynamic IP within specified range but when I try to connect from other Raspberry Pi with wpa_supplicant it can't connect to Raspberry Pi hosting ad-hoc network. I am using WEP encryption. My Raspberry Pi are equiped with internal wifi card.</p>
  
  <h2>Network Model</h2>
  
  <p><strong>#1</strong> Raspberry Pi3 with dhcp enabled ad-hoc</p>
  
  <p><strong>#2</strong> Raspberry Pi3 with dhcp enabled ad-hoc </p>
  
  <p><strong>#3</strong> Raspberry Pi3 is a moving node with managed network mode wpa_supplicant configurations which will connect to the either of those Raspberry Pi's based on which one has good signal strength and quality.</p>
  
  <blockquote>
    <h1>#1 Raspberry Pi with dhcp enabled ad-hoc</h1>
  </blockquote>
  
  <p>I have the following </p>
  
  <h1>interface configuration</h1>
  
  <p>my /etc/network/interfaces file looks like this</p>
  
  <pre><code>auto wlan0
  iface wlan0 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        wireless-channel 1
        wireless-essid Node1
        wireless-key 6172736869
        wireless-mode ad-hoc
  </code></pre>
  
  <h1>dhcp configuration</h1>
  
  <p>and my Configuration for <strong>/etc/dhcp/dhcpd.conf</strong> is</p>
  
  <pre><code>    ddns-update-style interim;
      default-lease-time 600;
      max-lease-time 7200;
      authoritative;
      log-facility local7;
      subnet 192.168.1.0 netmask 255.255.255.0 {
             range 192.168.1.5 192.168.1.150;
      }
  </code></pre>
  
  <blockquote>
    <h1>#2 Raspberry Pi with dhcp enabled ad-hoc</h1>
  </blockquote>
  
  <p>I have the following </p>
  
  <h1>interface configuration</h1>
  
  <p>my /etc/network/interfaces file looks like this</p>
  
  <pre><code>auto wlan0
  iface wlan0 inet static
        address 192.168.2.1
        netmask 255.255.255.0
        wireless-channel 1
        wireless-essid Node2
        wireless-key 6172736869
        wireless-mode ad-hoc
  </code></pre>
  
  <h1>dhcp configuration</h1>
  
  <p>and my Configuration for <strong>/etc/dhcp/dhcpd.conf</strong> is</p>
  
  <pre><code>    ddns-update-style interim;
      default-lease-time 600;
      max-lease-time 7200;
      authoritative;
      log-facility local7;
      subnet 192.168.2.0 netmask 255.255.255.0 {
             range 192.168.2.5 192.168.2.150;
      }
  </code></pre>
  
  <p>It is working fine. I can connect anything other than raspberry Pi with wpa_supplicant configuration. I have been working on it from almost 12 days and I tried almost every solution regarding WEP connection with wpa_supplicant and still no chance of connection.</p>
  
  <p>I have the following configuration for </p>
  
  <blockquote>
    <h1>#3 Raspberry Pi3 with wpa_supplicant configuration</h1>
  </blockquote>
  
  <h1>wpa_supplicant configuration</h1>
  
  <p>my /etc/wpa_supplicant/wpa_supplicant.conf looks like this</p>
  
  <pre><code>    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
      update_config=1
      country=GB
  
      network={
               ssid="IoT-Lab"
               psk="12323233"
               key_mgmt=WPA-PSK
      }
  
  
      network={
              ssid="Node1"
              wep_key0="6172736869"
              #wep_key0=6172736869
              key_mgmt=NONE
      }
  </code></pre>
  
  <p>When I connect to the Node1 it doesn't establish connection but create the the entry in wpa_supplicant.</p>
  
  <p>Then read about removing the <strong>wep_key0</strong> quotes and I did that but didn't work
  I also read about a lots of tweaks to play with but nothing worked and did each of them but nothing seems to be work. </p>
  
  <h1>interface configuration</h1>
  
  <pre><code># interfaces(5) file used by ifup(8) and ifdown(8)
  
  # Please note that this file is written to be used with dhcpcd
  # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
  
  # Include files from /etc/network/interfaces.d:
  source-directory /etc/network/interfaces.d
  
  auto lo
  iface lo inet loopback
  
  iface eth0 inet manual
  
  allow-hotplug wlan0
  iface wlan0 inet manual
      wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  </code></pre>
  
  <p>I also check with interface configuration for wlan0 from manual to <strong>dhcp</strong> and but it doesn't work. I'll be thankful if you help me out. </p>