{"id":86,"date":"2016-04-09T19:05:09","date_gmt":"2016-04-09T18:05:09","guid":{"rendered":"http:\/\/eoghan.me.uk\/notes\/?p=86"},"modified":"2021-10-15T11:43:26","modified_gmt":"2021-10-15T10:43:26","slug":"rpi-wifi-wpa-supplicant","status":"publish","type":"post","link":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/","title":{"rendered":"Setting up RPi WiFi using WPA Supplicant"},"content":{"rendered":"<p><span style=\"background-color: #ffff00;\"><strong>NOTE<\/strong>: This section may be redundant if you have set up your WiFi connection in the Raspberry Pi&#8217;s GUI.<\/span><\/p>\n<p>When I set up my Raspberry Pi&#8217;s WiFi, I used some well written notes on configuring WiFi with the wpa_supplicant file <a href=\"https:\/\/gist.github.com\/eduardschaeli\/4734786\">provided by Eduard Sch\u00e4li<\/a>.<\/p>\n<h2>WiFi adapter or built-in<\/h2>\n<p>With the Raspberry Pi 2 Model B I started with, I used an <a href=\"http:\/\/uk.rs-online.com\/web\/p\/wireless-adapters\/7603621\/\">Edimax 2.4 GHz USB 2.0 (EW-7811UN)<\/a> WiFi adapter.<\/p>\n<p>But the Raspberry Pi 3 now <a href=\"https:\/\/www.raspberrypi.org\/magpi\/raspberry-pi-3-specs-benchmarks\/\">comes with built-in wireless<\/a>.<\/p>\n<p><!--more-->[Note: I had trouble trying to set up the newer <a href=\"http:\/\/uk.rs-online.com\/web\/p\/wireless-adapters\/8651397\/\">Edimax 2.4\/5 GHz USB 2.0 (EW-7811UTC)<\/a> &#8211; it seems to need an extra driver, but after trying some suggestions online I gave up and went back to my EW-7811UN]<\/p>\n<h2>Setting up WiFi<\/h2>\n<p>[Tips on connecting to <a href=\"#eduroam\">eduroam<\/a> below]<\/p>\n<h3>Auto WiFi<\/h3>\n<p>Firstly set the Pi to automatically use the WiFi interface. Using the RPi&#8217;s Terminal, edit the <em>\/etc\/network\/interfaces<\/em> file:<\/p>\n<pre class=\"lang:sh decode:true\">sudo nano \/etc\/network\/interfaces\n<\/pre>\n<p>Above the line mentioning &#8216;wlan0&#8217;, add &#8216;<strong>auto wlan0<\/strong>&#8216;. And, if you need to make sure your WiFi doesn&#8217;t go to sleep, add &#8216;<strong>wireless-power off<\/strong>&#8216; below the &#8216;iface wlan0&#8217; line.<\/p>\n<p>So the wlan0 section of my file looks like this:<\/p>\n<pre class=\"lang:sh decode:true \">auto wlan0\nallow-hotplug wlan0\niface wlan0 inet manual\n    wireless-power off\n    wpa-conf \/etc\/wpa_supplicant\/wpa_supplicant.conf\n<\/pre>\n<p>Ctrl-X to exit nano, type &#8216;y&#8217;, and press Enter to save your changes.<\/p>\n<h3>WPA_Supplicant file<\/h3>\n<p>Now edit the <em>\/etc\/wpa_supplicant\/wpa_supplicant.conf<\/em> file:<\/p>\n<pre class=\"lang:sh decode:true \">sudo nano \/etc\/wpa_supplicant\/wpa_supplicant.conf\n<\/pre>\n<p>And added the following section to the bottom of the file, substituting your SSID and Password:<\/p>\n<pre class=\"lang:sh decode:true \">network={\n  ssid=\"Enter Your SSID\"\n  psk=\"Enter Your WiFi Password\"\n}\n<\/pre>\n<p>Ctrl-X to exit nano, type &#8216;y&#8217;, and press Enter to save your changes.<\/p>\n<h3>Reboot<\/h3>\n<p>Reboot your Pi.<\/p>\n<pre class=\"lang:sh decode:true \">sudo shutdown -r\n<\/pre>\n<p>If you boot into the GUI, hopefully the Network menu at the right end of the menubar shows a WiFi signal. Hovering your mouse over the Network menu should show you that &#8216;wlan0&#8217; is associated with your WiFi network, and show you which IP address it is using.<\/p>\n<p>From the command line (or Terminal in the GUI) you can find more information by using the command:<\/p>\n<pre class=\"lang:sh decode:true \">ifconfig -a\n<\/pre>\n<p>Check that an entry for &#8216;wlan0&#8217; is listed, and shows its IP address in the &#8216;inet addr&#8217; section.<\/p>\n<h3>If &#8216;wlan0&#8217; is not listed &#8211; Drivers<\/h3>\n<p>Check which WiFi adapter you are using.<\/p>\n<p>The older Edimax WiFi adapter I had (EW-7811UN) was plug-n-play, but the newer adpter (EW-7811UTC) didn&#8217;t seem to work straight off. Some threads suggest changes in Raspian version &#8220;Jessie&#8221; may be stopping it(?).<\/p>\n<p>To check your verison of the kernal-release I had installed, use Terminal command:<\/p>\n<pre class=\"lang:sh decode:true \">aname -r\n<\/pre>\n<p>My version was 4.1.21-v7+<\/p>\n<p>I&#8217;ll revert to EW-7811UN, and have another go at getting EW-7811UTC to work later (any suggestions welcome).<br \/>\n<a name=\"hostname\"><\/a><\/p>\n<h2>Setting a hostname<\/h2>\n<p>Keith on <a href=\"https:\/\/www.youtube.com\/channel\/UCrEDjSfc6sqBfUaShIrs6xQ\">Keith&#8217;s Pi Tutorials<\/a> suggested setting the Hostname of your Pi, so you don&#8217;t need to use its IP address to log in.<\/p>\n<ol>\n<li>Open the Raspberry Pi Configuration menu.<\/li>\n<li>Switch to the &#8216;System&#8217; tab.<\/li>\n<li>Enter a new &#8216;Hostname&#8217; (e.g. teamtrack for my climbing counter)<\/li>\n<li>Reboot the Pi<\/li>\n<li>You can now log in over SSH without the IP address, e.g. by typing:\n<pre class=\"lang:default decode:true \">ssh pi@teamtrack.local<\/pre>\n<\/li>\n<\/ol>\n<h2>Disabling Power Saving<\/h2>\n<p>A few people have noted that the Edimax\u00a0EW-7811UN WiFi adapter I&#8217;ve been using has a power saving mode, and can drop its connection. To make sure you don&#8217;t get a break in communication, you can disable power saving. I followed MrEngman&#8217;s suggestions on:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?t=61665\">Edimax Wifi adapter seems to go to sleep if not used<\/a><\/li>\n<\/ul>\n<ol>\n<li>Edit\/create the following <i>8192cu.conf<\/i> file:\n<pre class=\"lang:default decode:true \">sudo nano \/etc\/modprobe.d\/8192cu.conf<\/pre>\n<\/li>\n<li>Add the following line of code, then save the file with Ctrl-X, Y, Enter:\n<pre class=\"lang:default decode:true\"># Disable power management\noptions 8192cu rtw_power_mgnt=0 rtw_enusbss=0<\/pre>\n<\/li>\n<li>Reboot the Pi<\/li>\n<\/ol>\n<p><a name=\"eduroam\"><\/a><\/p>\n<h2>Eduroam<\/h2>\n<p>To get the Pi to connect to Edinburgh University&#8217;s Eduroam network, I consulted their <a href=\"http:\/\/www.ed.ac.uk\/information-services\/computing\/desktop-personal\/wireless-networking\/wlan-eduroam\/eduroam-generic\">Generic settings for eduroam secure wireless access<\/a> page. I used the Root certificate &#8216;QuoVadisOVRootCertificate.crt.pem (Base64)&#8217; from their\u00a0<a href=\"http:\/\/www.ed.ac.uk\/information-services\/computing\/desktop-personal\/wireless-networking\/wlan-root-ca\">Installing the wireless root certificates<\/a> page.<\/p>\n<ol>\n<li>On the Pi, download the Base64 certificate to <em>\/etc\/ssl\/certs<\/em>:\n<pre class=\"lang:sh decode:true\">cd \/etc\/ssl\/certs\/\nsudo wget https:\/\/vpnreg.ucs.ed.ac.uk\/eduroam\/certs\/QuoVadisOVRootCertificate.crt.pem\n<\/pre>\n<\/li>\n<li>Edit the <em>\/etc\/wpa_supplicant\/wpa_supplicant.conf<\/em> file\n<pre class=\"lang:sh decode:true \">sudo nano \/etc\/wpa_supplicant\/wpa_supplicant.conf\n<\/pre>\n<\/li>\n<li>Add a new &#8216;network&#8217; section to the end of the file, substituting your &#8216;identity&#8217; and &#8216;password&#8217;:\n<pre class=\"lang:sh decode:true\">network={\n  ssid=\"eduroam\"\n  scan_ssid=0\n  key_mgmt=WPA-EAP\n  pairwise=CCMP\n  group=CCMP TKIP\n  eap=PEAP\n  ca_cert=\"\/etc\/ssl\/certs\/QuoVadisOVRootCertificate.crt.pem\"\n  identity=\"UUN@ed.ac.uk\"\n  subject_match=\"radius01.is.ed.ac.uk\"\n  phase2=\"auth=MS-CHAPv2\"\n  password=\"Wireless Service Password\"\n}\n<\/pre>\n<\/li>\n<li>Ctrl-X to exit nano, type &#8216;y&#8217;, and press Enter to save your changes.<\/li>\n<li>Reboot the Pi, and hopefully it will connect to Eduroam.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>NOTE: This section may be redundant if you have set up your WiFi connection in the Raspberry Pi&#8217;s GUI. When I set up my Raspberry Pi&#8217;s WiFi, I used some well written notes on configuring WiFi with the wpa_supplicant file provided by Eduard Sch\u00e4li. WiFi adapter or built-in With the Raspberry Pi 2 Model B [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Setting up RPi WiFi using WPA Supplicant - Eoghan&#039;s Notes<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Setting up RPi WiFi using WPA Supplicant - Eoghan&#039;s Notes\" \/>\n<meta property=\"og:description\" content=\"NOTE: This section may be redundant if you have set up your WiFi connection in the Raspberry Pi&#8217;s GUI. When I set up my Raspberry Pi&#8217;s WiFi, I used some well written notes on configuring WiFi with the wpa_supplicant file provided by Eduard Sch\u00e4li. WiFi adapter or built-in With the Raspberry Pi 2 Model B [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/\" \/>\n<meta property=\"og:site_name\" content=\"Eoghan&#039;s Notes\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-09T18:05:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-15T10:43:26+00:00\" \/>\n<meta name=\"author\" content=\"Eoghan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Eoghan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/\",\"name\":\"Setting up RPi WiFi using WPA Supplicant - Eoghan&#039;s Notes\",\"isPartOf\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#website\"},\"datePublished\":\"2016-04-09T18:05:09+00:00\",\"dateModified\":\"2021-10-15T10:43:26+00:00\",\"author\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800\"},\"breadcrumb\":{\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eoghan.me.uk\/notes\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Setting up RPi WiFi using WPA Supplicant\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#website\",\"url\":\"https:\/\/eoghan.me.uk\/notes\/\",\"name\":\"Eoghan&#039;s Notes\",\"description\":\"The odd note that might come in handy someday\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eoghan.me.uk\/notes\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800\",\"name\":\"Eoghan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g\",\"caption\":\"Eoghan\"},\"url\":\"https:\/\/eoghan.me.uk\/notes\/author\/eoghan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Setting up RPi WiFi using WPA Supplicant - Eoghan&#039;s Notes","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/","og_locale":"en_GB","og_type":"article","og_title":"Setting up RPi WiFi using WPA Supplicant - Eoghan&#039;s Notes","og_description":"NOTE: This section may be redundant if you have set up your WiFi connection in the Raspberry Pi&#8217;s GUI. When I set up my Raspberry Pi&#8217;s WiFi, I used some well written notes on configuring WiFi with the wpa_supplicant file provided by Eduard Sch\u00e4li. WiFi adapter or built-in With the Raspberry Pi 2 Model B [&hellip;]","og_url":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/","og_site_name":"Eoghan&#039;s Notes","article_published_time":"2016-04-09T18:05:09+00:00","article_modified_time":"2021-10-15T10:43:26+00:00","author":"Eoghan","twitter_misc":{"Written by":"Eoghan","Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/","url":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/","name":"Setting up RPi WiFi using WPA Supplicant - Eoghan&#039;s Notes","isPartOf":{"@id":"https:\/\/eoghan.me.uk\/notes\/#website"},"datePublished":"2016-04-09T18:05:09+00:00","dateModified":"2021-10-15T10:43:26+00:00","author":{"@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800"},"breadcrumb":{"@id":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/eoghan.me.uk\/notes\/2016\/04\/09\/rpi-wifi-wpa-supplicant\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eoghan.me.uk\/notes\/"},{"@type":"ListItem","position":2,"name":"Setting up RPi WiFi using WPA Supplicant"}]},{"@type":"WebSite","@id":"https:\/\/eoghan.me.uk\/notes\/#website","url":"https:\/\/eoghan.me.uk\/notes\/","name":"Eoghan&#039;s Notes","description":"The odd note that might come in handy someday","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eoghan.me.uk\/notes\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/8d580b9cc431078e942962f5df92e800","name":"Eoghan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/eoghan.me.uk\/notes\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/248edf410b45769042d524cee3cce559fa8db50415efb82f79ea8a2d138b15cf?s=96&d=mm&r=g","caption":"Eoghan"},"url":"https:\/\/eoghan.me.uk\/notes\/author\/eoghan\/"}]}},"_links":{"self":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":48,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"predecessor-version":[{"id":491,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/posts\/86\/revisions\/491"}],"wp:attachment":[{"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eoghan.me.uk\/notes\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}