Fixed IP for Raspberry PI

Two comman ways to make a connection with Raspberry PI.

1. LAN port physical network cable
2. Wifi connection

For LAN/ Ethernet type connection we can set a fixed ip for ease of access. If you were to use a router then a fixed ip can be reserved at router configuration page. Router will assign the same ip referring to device MAC address.

Sample DHCP IP Reservation

IP can be reserved for connection type 1 or 2.

Fixed IP for Wired connection without router

How if we need fixed ip conenction for device direct connection without router or DHCP server. Well we can configure at raspberry pi device itself as below;

Connect to Raspberry PI using SSH (need to establish connection using default auto ip config type. Can get the ip as in explained here

In the terminal type as below;

sudo nano /etc/dhcpcd.conf

Remove ‘#’ at following line and set your preferred IP address

#Example static IP configuration:
interface eth0
static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

Done. Press Ctrl+X then type ‘Y’ and enter.

Sample configuration

Reboot Raspberry PI. Your fixed ip for LAN port should be working now. Make sure provide a fixed ip to your PC LAN port as well.

Leave a Reply

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

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.