5. WIFI Networks

WiFi Networks

Let's say that I want my Raspberry Pi to connect to wifi networks both at home and at school. wpa_supplicant.conf allows multiple network blocks in the same file so it's simply a matter of adding information for each network the pi needs access to. Navigate to /etc/wpa_supplicant/ and then hit ls to see wpa_supplicant.conf. We want to open that file in Nano: sudo nano wpa_supplicant.conf. It should look something like this:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
   ssid="SCHOOL_WIFINETWORKNAME"
   psk="SCHOOL_WIFINETWORKPASSWORD"
}

network={
   ssid="HOME_WIFINETWORKNAME"
   psk="HOME_WIFINETWORKPASSWORD"
}

Procedure

  1. Configure the above example for your needs and then save the changes
  2. Reboot your pi (sudo reboot now) and log back in
  3. Use ping to see if you are actually connected to the internet: ping wikipedia.org

If you see something like this in the terminal everything is working:

PING wikipedia.org (198.35.26.96): 56 data bytes
64 bytes from 198.35.26.96: icmp_seq=0 ttl=52 time=16.948 ms
64 bytes from 198.35.26.96: icmp_seq=1 ttl=52 time=17.714 ms
64 bytes from 198.35.26.96: icmp_seq=2 ttl=52 time=16.952 ms

Assignment

In order to get credit for this assignment, you must:

  1. pick a website to ping from the terminal on your Raspberry Pi from your home wifi network
  2. email me a screenshot of the results of your ping command (hint: it should look vaguely like the ping example above) prior to the beginning of Friday's class