A solution would be to configure a DHCP static lease, if your router allows it. I like this solution because:
- I can set all of my connected devices' IP address and DNS configuration in a unique place.
- The Raspberry Pi won't get a taken IP address
- I can bring my Raspberry Pi to a friend's place without reconfigure it
- I can have multiple OS on the Raspberry Pi without configure them
- I can reinstall the OS without reconfigure it
To configure a DHCP static lease:
- In a terminal on the Raspi, run the
ifconfig
command to know its MAC address (HWaddr XX:XX:XX:XX:XX:XX). - Open your favorite browser and enter your router's IP address. Probably 192.168.0.1 or 192.168.1.1.
- Look for the DHCP static lease option. In the example here, the "DCHP Reservation" button.
- Enter the MAC address you picked up in the first pointstep and associate it with the IP address you want to. Click here to see an example of the web interface.
- Restart the RPi to make it get the IP address you just set up.