7 Replies Latest reply on Nov 16, 2014 9:53 PM by mmi

    How to set a Static IP

    TimGTech

      How do I configure the WiFi on the Edison to have a static IP instead of DHCP?

       

      Thanks!!

        • 1. Re: How to set a Static IP
          David_J_Hunt

          Hi Tim,

             You need to edit the /etc/wpa_supplicant/wpa_cli-actions.sh file. Go to line 48 which has a udhcpc command. comment this out, and add a new line to manually set the IP. The section of the file should then look like:

           

          if [ "$CMD" = "CONNECTED" ]; then

              kill_daemon udhcpc /var/run/udhcpc-$IFNAME.pid

          #   udhcpc -i $IFNAME -p /var/run/udhcpc-$IFNAME.pid -S

              ifconfig $IFNAME 192.168.200.200 netmask 255.255.255.0

          fi

           

           

          If you then reboot, the wifi interface should then have your new manual IP address.

           

          Regards,

          Dave.

          1 of 1 people found this helpful
          • 2. Re: How to set a Static IP
            mmi

            Hi David,

             

            thanks!

             

            I did so but then the Edison misses the gateway to internet.

            I added the route command for the gateway::

             

             

            if [ "$CMD" = "CONNECTED" ]; then

                kill_daemon udhcpc /var/run/udhcpc-$IFNAME.pid

            #   udhcpc -i $IFNAME -p /var/run/udhcpc-$IFNAME.pid -S

                ifconfig $IFNAME 192.168.200.200 netmask 255.255.255.0

                route add default gw 192.168.200.1

            fi

             

             

            Regards, Manfred

            • 3. Re: How to set a Static IP
              TimGTech

              Thanks, I will give it a shot and let you know if it works.

              • 4. Re: How to set a Static IP
                TimGTech

                SUCCESS!

                 

                Thank you both very much!  I now have a static IP and can ping to and from.  And a gateway too!

                • 5. Re: How to set a Static IP
                  DimitriM

                  Actually, this cannot work. The Wifi connection must be set to become persistent. I set it as described

                   

                  if [ "$CMD" = "CONNECTED" ]; then

                      kill_daemon udhcpc /var/run/udhcpc-$IFNAME.pid

                  #   udhcpc -i $IFNAME -p /var/run/udhcpc-$IFNAME.pid -S

                      ifconfig $IFNAME 192.168.200.200 netmask 255.255.255.0

                      route add default gw 192.168.200.1

                  fi

                   

                  When I reboot, I check the IP with "ip a". Indeed, I get 192.168.200.200. Fine so far. When I check my Wifi connection with "wpa_cli status", I can see my network's name from the previous session and everything seems fine except "id=0". However, after reboot, I don't have the Wifi connection. Ping google.com does not work. And if I connect (configure_edison --wifi etc) and get a random IP address like 192.168.0.101 and "id=3". Then, I can ping and do other stuff.

                  • 6. Re: How to set a Static IP
                    DimitriM

                    Apparently, "systemctl enable wpa_supplicant" to make Edison connect to Wifi automatically after reboot does not work with this static IP setup.

                    See discussion here: https://communities.intel.com/message/256657#256657

                     

                    Interestingly, Wifi is on and the remore debug with Eclipse is possible without root login. Giving needed protection for proprietary code on Edison.

                    • 7. Re: How to set a Static IP
                      mmi

                      Definitely it worked and as you can see, not only for me.

                      Maybe something has changed with a newer Yocto release and you get Problems now?

                      I can't say it because i switched to ubilinux some weeks ago.