{"id":1296,"date":"2016-06-24T11:36:23","date_gmt":"2016-06-24T11:36:23","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1296"},"modified":"2016-06-24T11:37:53","modified_gmt":"2016-06-24T11:37:53","slug":"how-to-set-a-static-ip-address-on-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/how-to-set-a-static-ip-address-on-a-raspberry-pi\/","title":{"rendered":"How to Set a Static IP Address on a Raspberry Pi"},"content":{"rendered":"<p>The examples given here are for modifying the wlan0 interface.\u00a0 Replace wlan0 with the interface you are configuring. i.e. (eth0,wlan1)<\/p>\n<p><strong>Method 1<\/strong><\/p>\n<p>This was the typical way to add a static IP address to a Pi, if you have issues with this, then try Method 2.<\/p>\n<pre>sudo vi \/etc\/network\/interfaces<\/pre>\n<p>In the file it is pretty easy to see which lines control which interface, find the lines that control wlan0 (or the interface your configuring) and change\/add to look like below.<\/p>\n<pre>iface wlan0 inet static\r\naddress 192.168.42.109\r\nnetmask 255.255.255.0\r\ngateway 192.168.42.1<\/pre>\n<p>Save the file, reboot, and the Pi should come up with the new static IP.<\/p>\n<p><strong>Method 2<\/strong><\/p>\n<p>It looks like on the newer versions of Raspbian, the above method does not work anymore, so now you have to edit the following file<\/p>\n<pre>sudo vi \/etc\/dhcpcd.conf<\/pre>\n<p>and add the following lines.<\/p>\n<pre>interface wlan0\r\nstatic ip_address=192.168.42.109\/24\r\nstatic routers=192.168.42.1\r\nstatic domain_name_servers=192.168.42.1<\/pre>\n<p>If you just need to assign a static IP address, to the device, because it is going to be setup as a hotspot or something, you can get away with the following.<\/p>\n<pre>interface wlan0\r\nstatic ip_address=192.168.42.1\/24\r\n<\/pre>\n<p>If you run into issues with it not assigning the address, check the \/etc\/network\/interfaces file and make sure that the line that starts with &#8220;iface wlan0&#8221; says manual at the end and not static.\u00a0 If it says &#8220;iface wlan0 inet static&#8221;, change it to &#8220;iface wlan0 inet manual&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The examples given here are for modifying the wlan0 interface.\u00a0 Replace wlan0 with the interface you are configuring. i.e. (eth0,wlan1) Method 1 This was the typical way to add a static IP address to a Pi, if you have issues &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/how-to-set-a-static-ip-address-on-a-raspberry-pi\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,21,91],"tags":[7,128,105,92,287,50],"class_list":["post-1296","post","type-post","status-publish","format-standard","hentry","category-linux","category-networking","category-raspberry-pi","tag-linux-2","tag-networking-2","tag-pi","tag-raspberry-pi-2","tag-rpi","tag-static-ip"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=1296"}],"version-history":[{"count":8,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1296\/revisions"}],"predecessor-version":[{"id":1304,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1296\/revisions\/1304"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}