7 Replies Latest reply on Mar 22, 2016 10:16 AM by PabloM_Intel

    How to make an ad-hoc network

    BrechtW

      I'm using a Intel® Centrino® Advanced-N 6205 to create an ad-hoc network on a Intel Galileo Gen 2. (Question is at the end)

       

      First list all network related stuff:

      ifconfig -a

      enp0s20f6 Link encap:Ethernet  HWaddr 98:4F:EE:05:29:52
                UP BROADCAST MULTICAST  MTU:1500  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:0 (0.0 B)  TX bytes:1092 (1.0 KiB)
                Interrupt:51 Base address:0x8000
      
      
      enp0s20f6:avahi Link encap:Ethernet  HWaddr 98:4F:EE:05:29:52
                inet addr:169.254.196.186  Bcast:169.254.255.255  Mask:255.255.0.0
                UP BROADCAST MULTICAST  MTU:1500  Metric:1
                Interrupt:51 Base address:0x8000
      
      
      lo        Link encap:Local Loopback
                inet addr:127.0.0.1  Mask:255.0.0.0
                inet6 addr: ::1/128 Scope:Host
                UP LOOPBACK RUNNING  MTU:65536  Metric:1
                RX packets:720 errors:0 dropped:0 overruns:0 frame:0
                TX packets:720 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:52480 (51.2 KiB)  TX bytes:52480 (51.2 KiB)
      
      
      wlp1s0    Link encap:Ethernet  HWaddr 44:85:D3:01:B4:07
                BROADCAST MULTICAST  MTU:1500  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
      
      

       

      We will need the wlp1s0

       

      Check which card you are using:

      lspci -k | grep -A 3 -i "network"

       

      01:00.0 Network controller: Intel Corporation Centrino Advanced-N 6235
              Subsystem: Intel Corporation Centrino Advanced-N 6235 AGN
              Kernel driver in use: iwlwifi
              Kernel modules: iwlwifi
      
      

       

      My Intel® Centrino® Advanced-N 6205 card was software blocked, so:

      rfkill list

      0: hci0: bluetooth
              Soft blocked: yes
              Hard blocked: no
      1: phy0: wlan
              Soft blocked: yes
              Hard blocked: no
      
      

       

      rfkill unblock wlan

      [  817.137644] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
      root@galileo:~# [  817.153309] iwlwifi 0000:01:00.0: Radio type=0x1-0x0-0x1
      [  817.612344] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
      [  817.627839] iwlwifi 0000:01:00.0: Radio type=0x1-0x0-0x1
      [  817.905499] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
      [  817.919048] wlp1s0: Trigger new scan to find an IBSS to join
      [  817.983868] iwlwifi 0000:01:00.0: failed to remove IBSS station 00:00:00:00:0             0:00
      
      

       

      root@galileo:~# ifconfig wlp1s0 down

      root@galileo:~# iwconfig wlp1s0 mode ad-hoc

      root@galileo:~# iwconfig wlp1s0 essid GalileoNetwork

      root@galileo:~# iwconfig wlp1s0 channel 10

      root@galileo:~# ifconfig wlp1s0 192.168.1.2 netmask 255.255.255.0 up

      [  867.448653] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
      [  867.462518] iwlwifi 0000:01:00.0: Radio type=0x1-0x0-0x1
      [  867.749821] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
      [  867.767091] wlp1s0: Trigger new scan to find an IBSS to join
      root@galileo:~# [  872.945639] wlp1s0: Trigger new scan to find an IBSS to join
      [  874.789468] wlp1s0: Creating new IBSS network, BSSID ba:dc:66:9a:d1:68
      [  874.800888] iwlwifi 0000:01:00.0: Unable to find TIM Element in beacon
      [  874.808718] iwlwifi 0000:01:00.0: Unable to find TIM Element in beacon
      [  874.821901] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0: link becomes ready
      
      

       

      This should be visible.

      GalileoNetwork.PNG

      I made this small script called startup.sh:

       

      #!/bin/sh
      ifconfig wlp1s0 down
      rfkill unblock wlan
      iwconfig wlp1s0 mode ad-hoc
      iwconfig wlp1s0 essid GalileoNetwork
      iwconfig wlp1s0 channel 10
      ifconfig wlp1s0 192.168.1.2 netmask 255.255.255.0 up
      
      

       

      I made it executable with:

      chmod +x startup.sh

       

      The problem is I can't connect to it with Putty.

       

      My static IP addresss is 192.168.1.12 and the gateway is 192.168.1.0. I set the SSH port to 22.

        • 1. Re: How to make an ad-hoc network
          PabloM_Intel

          Hi BrechtW,

           

          We are now investigating your case, as soon as we have an answer we will post it here.

           

          Regards,

          Pablo

          • 2. Re: How to make an ad-hoc network
            BrechtW

            I ran my script and I got this output:

             

            root@galileo:/media/card# /media/card/startup.sh
            [  168.114236] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
            [  168.140364] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
            [  168.580402] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
            [  168.596029] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
            [  168.841045] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
            [  168.907676] iwlwifi 0000:01:00.0: failed to remove IBSS station 00:00:00:00:00:00
            Error for wireless request "Set Frequency" (8B04) :
                SET failed on device wlp1s0 ; Device or resource busy.
            
            

             

            Runing it a second time:

             

            root@galileo:/media/card# /media/card/startup.sh
            [  293.728291] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
            [  293.744041] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
            [  294.007921] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
            root@galileo:/media/card# [  299.330347] wlp1s0: Trigger new scan to find an IBSS to join
            [  301.071273] wlp1s0: Creating new IBSS network, BSSID 26:64:0a:44:1f:0d
            [  301.082238] iwlwifi 0000:01:00.0: Unable to find TIM Element in beacon
            [  301.093085] iwlwifi 0000:01:00.0: Unable to find TIM Element in beacon
            [  301.103344] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0: link becomes ready
            
            

             

            I stil can't connect.

            GalileoNetwork2.png

            It says Windows can't make connection with this network.

             

            Edit:

            te

            root@galileo:/media/card# route -n
            Kernel IP routing table
            Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
            169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 enp0s20f6
            192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlp1s0
            
            • 3. Re: How to make an ad-hoc network
              PabloM_Intel

              Hi BrechtW,

               

              We first try it with the uClibc image, which you can get from here https://software.intel.com/en-us/iot/hardware/galileo/downloads, and we got a successful connection. We then try with the eglibc image, the same you’re using right now, and also got a connection. I would suggest you to try with the uClibc image and see if that works. I’m not sure why you’re not getting the same results with the IoT image, it would be a good idea to see your results with a different one.

               

              Regards,

              Pablo

              • 4. Re: How to make an ad-hoc network
                BrechtW

                On which OS and version did you test this? I just found out an ad hoc network does not work like other wifi-network on Windows 10.

                 

                I will get back to you soon.

                 

                Edit: It was a windows 10 issue. I thought a ad hoc network was just like any other wifi network to connect to, which isn't true (on Windows 8.1 and 10).

                 

                Starting with Windows 8.1, Microsoft reduced support for Adhoc Wifi networks.  As a result, Windows 8.1 does not detect or display Adhoc networks in the list of available wireless networks (also known as the "wireless network picker").  Windows 10 behavior is slightly different, as it does detect and display available Adhoc networks, but when attempting to connect, it fails with a "Cannot Connect to Network" error.

                 

                I followed this tutorial.

                Replace GalileoNetwork with the SSID of your network by using Ctrl-F and finding and replacing each instance. You can then copy and paste each line into the command line window

                 

                >netsh wlan show networks

                 

                ***Go to "Network and Sharing Center"

                - Click "Set up a new connection or network"

                - Double click "Manually connect to a wireless network"

                - Enter the SSID of the adhoc network (as shown by "netsh wlan show networks") into the "Network name" field

                - Configure security settings accordingly

                - Uncheck "Start this connection automatically" (important)

                - Click "Next", then "Close"

                 

                ***Windows 8.1 command

                >netsh wlan set profileparameter GalileoNetwork connectiontype=ibss

                 

                ***Windows 10 command

                >netsh wlan set profileparameter GalileoNetwork connectiontype=ibss connectionmode=manual

                 

                >netsh wlan connect GalileoNetwork


                ***Disconnect

                >netsh wlan disconnect GalileoNetwork

                 

                ***This is to delete the profile

                >netsh wlan delete profile GalileoNetwork

                 

                Edit2: If you have a USB Wi-Fi dongle laying around, use this to connect. The "normal" Wi-Fi card connects to the Galileo, the dongle to the "regular" internet. This way you still have internet acces with the dongle.

                >netsh wlan connect name=GalileoNetwork ssid=GalileoNetwork interface=Wi-Fi

                • 5. Re: How to make an ad-hoc network
                  BrechtW

                  I want to execute the startup.sh at startup. I followed this.

                   

                  I don't think it worked. When I execute it manually I still have to try a few times. How do I make sure the network is setup at startup (maybe try a few times until the link is ready?).

                   

                  root@galileo:/media/card# /media/card/startup.sh
                  [  196.637275] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
                  [  196.656255] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
                  [  197.100661] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
                  [  197.116332] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
                  [  197.361010] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
                  root@galileo:/media/card# /media/card/startup.sh
                  [  205.287791] iwlwifi 0000:01:00.0: L1 Disabled; Enabling L0S
                  [  205.303407] iwlwifi 0000:01:00.0: Radio type=0x2-0x1-0x0
                  [  205.564464] IPv6: ADDRCONF(NETDEV_UP): wlp1s0: link is not ready
                  root@galileo:/media/card# [  210.721939] wlp1s0: Trigger new scan to find an IBSS to join
                  [  212.597684] wlp1s0: Creating new IBSS network, BSSID 4a:a8:a6:9d:f0:2d
                  [  212.611257] iwlwifi 0000:01:00.0: Unable to find TIM Element in beacon
                  [  212.619151] iwlwifi 0000:01:00.0: Unable to find TIM Element in beacon
                  [  212.632352] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0: link becomes ready
                  
                  • 6. Re: How to make an ad-hoc network
                    FGT

                    BrechtW wrote:

                     

                    I want to execute the startup.sh at startup. I followed this.

                     

                    I don't think it worked. When I execute it manually I still have to try a few times. How do I make sure the network is setup at startup (maybe try a few times until the link is ready?).

                     

                    Yes. Were you able to make the script to automatically detect it?  My suggestion is:

                    a) Check the script is working correctly, i.e. you do not have to manually try until the network is running, the script does it for you

                    b) Include the script in the startup process so it executes at boot time.

                     

                    Fernando.

                    • 7. Re: How to make an ad-hoc network
                      PabloM_Intel

                      Hi BrechtW,

                       

                      Did you follow FGT instructions? Were you able to execute the file at startup?

                       

                      Regards,

                      Pablo