Skip to content

Hospitable IT

hospitable: characterised by or betokening warmth and generosity toward guests or strangers

Menu

Home

How to

About

Home

How to

Configuring a Static IP and Static Routes on a Raspberry Pi running Raspbian Jessie using the CLI

August 20, 2017 by Kirin Asahi 0 comments on "Configuring a Static IP and Static Routes on a Raspberry Pi running Raspbian Jessie using the CLI"

Since the release of Raspbian Jessie a few things have changed regarding configuration of the network stack from the CLI. I got stuck on this today and it took me a while to sort out so I figured it was worth a quick post.

Previous to Raspbian Jessie, network parameters could be adjusted by editing /etc/network/interfaces. This functionality has now been moved to /etc/dhcpcd.conf, the reasons why are beyond the scope of this post.

To enter a static IP, fire up your favourite text editor and open /etc/dhcpcd.conf

The syntax is as per below

nohook lookup-hostname
interface eth0
static ip_address=192.168.0.1/24
static routers=192.168.0.254
static domain_name_servers=8.8.8.8

To add a persistent static route, create or edit the following file

/lib/dhcpcd/dhcpcd-hooks/40-route

and use the following syntax

ip route add 192.168.100.0/24 via 192.168.0.2

Enjoy!

Posted in: How to

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Post navigation

Previous Previous post: DCI using VXLAN with MP-BGP EVPN and Ingress Replication on a Nexus 9K

Next Next post: Changing the Master Key on a Palo Alto Firewall Active/Passive HA pair

Primary Sidebar

Search for: Search

Recent Articles

Handling the Captive Network Assistant for a closed network with a redirect using Apache and Bind

Upgrading the on premise version of Azure Multi-Factor Authentication Server

PRTG Sensor for Cisco Call Manager Services

Unable to access SFTP server error when configuring a backup for Cisco Unified CCX 10.6.1

PRTG Monitor for DFS – Work In Progress

Made in Tasmania