Posts: 33
Joined: Wed Sep 19, 2012 9:56 pm

How do I get a static IP

Thu Sep 27, 2012 3:58 am


My PC's have static IP's and so must the Pi which has shipped dynamic in the config (DHCP)

need to change the config

first struggeling to get into the root - password unknown to me..

found out to change password with: sudo passwd root and entering my own password. note: some wrote that root originally had none, but it was impossible to enter no password at login.

Then tried to run MC to find/edit the config - BUT WHAAAT - MC NOT INSTALLED BY DEFAULT (see my other post about getting installed this)

Ok - into the graphical if with startx and consulting Debbian manual. The config is in in folder /etc/network and file interfaces

iface eth0 inet dhcp
iface eth0 inet static
and add below
dns-domain monty

needless to say that You must know what IP subnet and DNS server You are having

User avatar
Posts: 185
Joined: Mon Feb 20, 2012 1:48 pm
Location: Southampton, UK
Contact: Website

Re: How do I get a static IP

Thu Sep 27, 2012 8:00 am

Have a looksee here - ... e_manually

Only address, netmask and gateway are required. You also probably want to be careful to set an IP that your dhcp server won't dish out to someone else automatically (anyone know if modern ones are smart enough not to have that problem?).

A small gotcha I found is that if you move the pi between networks where the router, acting as a dns server, has a different IP you'll have to also edit /etc/resolv.conf

Posts: 29
Joined: Sun Aug 19, 2012 8:47 am

Re: How do I get a static IP

Thu Sep 27, 2012 3:48 pm

To view your current route/gateway, you can use

netstat –nr

Now you can edit the file using

nano /etc/network/interfaces

Look for the line called “iface eth0 inet dhcp” to “iface eth0 static” and add the info from netstat to keep the current IP, and the result could be like this, assuming your router is and you want your static IP to be

# The loopback interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static

When all this info is in place, press Control+x, y to save and enter to exit.

Then type

/etc/init.d/networking restart

Return to “Troubleshooting”