Changing WiFi Settings on Raspberry Pi when away from home

If you set up your Pi at home with a WiFi dongle (in a robot say) and you take it off to a Raspberry Jam event (or into school to show your teacher) you soon find out that you can’t talk to your Pi using the WiFi at the venue.

There are many routes to go down at this point – the most popular being:

  • Use a mobile phone as a WiFi hotspot with home WiFi settings
  • Use a spare WiFi router with same home WiFi settings

The best way however, to avoid interference with other attendees would be to enter the venue WiFI settings into your Pi.  However this is very difficult unless you have another Linux machine that can read/write your SD card as a Windows machine can’t do that.

One method I’ve come up with is to add a few lines of code at the end of your /etc/network/interfaces file  :

auto eth0:1
iface eth0:1 inet static
address 169.254.64.64
netmask 255.255.0.0
 

and then use this command via LX Terminal

sudo apt-get purge ifplugd

And then re-boot.

What this then does is that it allows you to just plug an ethernet cat5 cable between a Windows laptop/netbook and your Pi when you get to the venue/school.

You can then remote into your Pi (using your normal methods) and change your WiFi settings to match up with the venue (Normally just simply  editing /etc/wpa_supplicant/wpa_supplicant.conf and putting the venues WiFi name and password in)

Or if your Pi isn’t a robot and stays on the desk next to you, you can then just carry one using it without having to do anything else 🙂

 

You may also like...

5 Responses

  1. Ken says:

    My approach was to put the config file in the boot partition and then call it from /etc/network/interfaces. I have several different configs for the places I go (library, school, home), and you can just rename the file on a laptop then and boot the Pi.

    I haven’t tried it yet, but wicd-curses looks like a good comand-line alternative: http://www.raspyfi.com/wi-fi-on-raspberry-pi-a-simple-guide/

    • cymplecy says:

      Yeah :). I’ve done that one in the past. the problem I had with it was when it didn’t work and then I was up creek without a paddle. And of course it happened in front of expectant kids 🙁
      This method should work under any scenario and can be used alongside your approach as a backup 🙂

  2. cymplecy says:

    Thank you. I should hopefully get that little bug sorted out over the weekend 🙂

  3. Giorgos K says:

    i tried it but now it does not ssh while connected with a router on ethernet, we just add all these>>>
    auto eth0:1
    iface eth0:1 inet static
    address 169.254.64.64
    netmask 255.255.0.0
    without deleting enything else inside /etc/network/interfaces?correct?
    should i restore my old interfaces and try again?Thanks

    • cymplecy says:

      This is my own complete /etc/network/interfaces
      auto lo
      auto eth0
      iface lo inet loopback
      iface eth0 inet dhcp

      allow-hotplug wlan0
      iface wlan0 inet manual
      wpa-roam boot/etccopy/wpa_supplicant/wpa_supplicant.conf
      iface default inet dhcp

      auto eth0:1
      iface eth0:1 inet static
      address 169.254.64.64
      netmask 255.255.0.0

      This gives me a router assigned DHCP address when plugged into LAN using CAT5 cable
      and gives me
      169.254.64.64 when plugged direct into my Windows laptop
      (Also has wifi as well)

      What is your /etc/network/interfaces ?

      Simon

Leave a Reply

Your email address will not be published. Required fields are marked *