Skip to main content
Raspberry Pi

Raspberry Pi Setting a Static IP Address

By November 20, 2013September 12th, 2022No Comments

If you will be using your Pi as a server you will most likely want a static IP address, an address that does not change. Otherwise you m ay not know the current address of the server to connect to. If you are using Raspbian then setting the IP address is similar to setting a static address in Ubuntu. There is just the one network interface file that you will find in /etc/network/interfaces.

During the install DHCP will be configured for you network connection but we can change this a latterly to a static IP address. To do this we would edit the /etc/network/interfaces and change the entry for the NIC to static from dhcp.

Once changed to static we must, of course configure the address information:

iface eth0 inet static
    address 192.168.10.3
    netmask 255.255.255.0
    gateway 192.168.10.1
    dns-search example.com
    dns-nameservers 8.8.8.8 8.8.4.4

Note: that we will now configure the DNS information in each network stanza to allow for different DNS servers based on different types of connections, ie LAN, wireless and 3G. This is preferred over setting single entries in the /etc/resolv.conf