Static IP (All Raspbian versions)Next I gave the Pi a static IP address. There are two ways to do this, the best way is to use address reservation in your router, doing it this way makes things easier if you have to change the IP address or router in the future, but if that's not possible then you can set one in the Pi itself.The process differs depending on which version of Raspbian you're using, but first you'll need some info about your network...
The important values from this command are inet addr (your current IP, mine is 192.168.0.23) and Mask (the subnet, again mine is 255.255.255.0), Note your values down and then type...
Note down the Gateway, which is 192.168.0.1 on mine. Now will be a good time to log into your routers web configuration page, so open a web browser and type the Gateway address into the address field, you will probably need to log in. You should know what the username and password are, if not they may be written on the base of the router, or just google them.Within the routers web configuration you're looking for DHCP settings. You'll need to reduce the amount of IP addresses available to the dhcp server, on some routers you can only adjust the lower value, or vice-versa, and some you can adjust both. I normally have around 100 addresses available for static IP's by either changing the lower value to 100 (192.168.0.100) or the higher value to 155 (192.168.0.155), choose one depending on what your router allows.Don't worry if any existing devices have IP's in the static range, they'll still work and will be allocated new IP's when renewing their leases. Static IP (Raspbian Wheezy only) Enter this into the terminal...
Which opens the nano text editor with this information.Use the cursor keys to move around.
Make your settings look like mine below, but substitute your values for address, netmask, network, broadcast and gateway. You'll probably find that as you've already got a connection through ethernet, the values will already be correct. All you will have to do is change dhcp for static and choose an IP address, as I can only change the lower value for the DHCP server I chose 192.168.0.20 for the static address.
Once you're happy with what you've set up, save the file with CTRL + O then press enter, then exit with CTRL + X, then reboot to start using the new IP address.
Static IP (Raspbian Jessie only)Enter this into the terminal...
Which opens the nano editor with this text...
Add this to the top using your values, but beware, on some systems copy and pasting gives strange results... FYI static ip_address= is the IP you want to use, static routers= is the Gateway value you found earlier and static domain_name_servers= is usually the same as Gateway unless you have a separate DNS server on your network, if you do then why are you reading this guide?
Once you're happy with what you've set up, save the file with CTRL + O then press enter, then exit with CTRL + X, then reboot to start using the IP address.