Static IP Address on Raspberry Pi (Raspbian)

No doubt this is done to death, so no fluff.

  1. Modify the dhcpcd (DHCP client) configuration file: sudo nano /etc/dhcpcd.conf

  2. If your router is your DNS server, point domain_name_servers to the router’s IP address as shown below. I’ve pointed mine to the Raspberry Pi.

  3. Append values like this, depending on your setup, to /etc/dhcpcd.conf file:

# This will be different if your Pi is connecting via wifi. I'm on ethernet.
interface eth0
# This is the IP address of the Raspberry Pi.
static ip_address=
# IP address of the default gateway. AKA the internal IP address of your router.
static routers=
# DNS server to use. Normally the IP address of your router. I'm using my Raspberry Pi for DNS.
static domain_name_servers=
  1. Restart the DHCP client service or restart the Pi altogether:
# New way
sudo systemctl restart dhcpcd

Now see the IP address:

ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000     link/ether 33:44:55:66:ee:dd brd ff:ff:ff:ff:ff:ff     inet brd scope global eth0        valid_lft forever preferred_lft forever

This is a preview of Clap Button, a new feedback and analytics tools for Hydejack, built by yours truly. You can try it out on localhost for free, but it will be removed (together with this message) when building with JEKYLL_ENV=production. To use Clap Button on your site, get a subscription
and set clap_button: true in your config file.

© 2021. All rights reserved.