Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I have Model B and connected via Ethernet and running Raspbmc.

It's taking new IP address whenever I restart it, of course may be because of DHCP, but I want to configure this Raspberry Pi with a static IP address, so that I can use my XBMC remote.

share|improve this question

4 Answers 4

up vote 19 down vote accepted

Per the instructions found here:

  1. In XBMC, go to Programs → Raspbmc settings → Wired network configuration.
  2. Uncheck the Automatic DHCP option.
  3. Provide a static IP address. Make sure the IP address is far away from the IP addresses typically assigned by the router to the networked devices at home. For example, if a router assigns addresses starting from 192.168.0.10, then pick a static IP like 192.168.0.50
  4. Scroll down and check the Update Now option. Raspbmc will take a few seconds to apply the new configuration.
  5. Make sure you can ping the static IP address you assigned. Voila, your Raspbmc now has a fixed IP address!
share|improve this answer
    
Thanks, it did worked !! –  garikapati Oct 18 '12 at 6:07

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 an unique place.

  1. In a terminal on the Raspi, run the ifconfig command to know its MAC address (HWaddr XX:XX:XX:XX:XX:XX).
  2. Open your favorite browser and enter your router's IP address. Probably 192.168.0.1 or 192.168.1.1.
  3. Look for the DHCP static lease option. In the example here, the "DCHP Reservation" button.
  4. Enter the MAC address you picked up in the first point and associate it with the IP address you want to. Click here to see an example of the web interface.
  5. Restart the RPi to make it get the IP address you just set up.
share|improve this answer
2  
This also has the nice side that the DHCP server shouldn't hand that IP to someone else by accident. –  XTL Oct 19 '12 at 9:08
1  
Also, if you taker your Raspberry Pi to a friends place, it can pick up an IP appropriate to that network rather than try to use your home IP address which may not work, and may even stop another device on the network from working. –  Mark Booth Oct 19 '12 at 12:49
    
Another benefit: If you have multiple OS on the device, you don't have to set the IP address on each system. –  Morgan Courbet Jan 7 '13 at 23:23

For those of you (like me) who prefer to do things the manual way, then you can edit the interface file at /etc/network/interfaces:

# DHCP
# ~~~~
# iface eth0 inet dhcp

# Static
# ~~~~~~
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

You will then need to restart the network service...

share|improve this answer
1  
This works on Debian... I'm assuming the process is the same (or similar) on RaspbMC –  Andrew Oct 19 '12 at 12:11
2  
This is why I updated the question, for I would advise this answer on any other distribution. –  Alex Chamberlain Oct 19 '12 at 12:27

Here's a page on setting static IP

http://elinux.org/RPi_Setting_up_a_static_IP_in_Debian

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.