Difference between revisions of "Setup Raspberry Pi with Static IP Address"

From Double Jump Electric Wiki
Jump to navigation Jump to search
(Created page with "# Flash the Raspberry Pi with [https://www.balena.io/etcher/][etcher]. # On the SD Card in the root directory of the boot partition, create an empty file called **ssh** or **s...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
# Flash the Raspberry Pi with [https://www.balena.io/etcher/][etcher].
+
Flash the Raspberry Pi with [https://www.balena.io/etcher/ etcher].
# On the SD Card in the root directory of the boot partition, create an empty file called **ssh** or **ssh.txt**
+
 
# On the SD Card in the etc directory of the  
+
On the SD Card in the root directory of the boot partition, create an empty file called **ssh** or **ssh.txt**
# Log into the Pi via SSH and expand the filesystem with:
+
 
 +
On the SD Card in the etc directory of the rootfs boot partition, open the dhcpcd.conf file with root permissions.
 +
 
 +
Add the following lines to the bottom of the file. (This example assumes your ip address is 192.168.1.2, and your gateway is 192.168.1.3.)
 +
 
 +
<source>
 +
interface eth0
 +
static ip_address=192.168.1.2/24
 +
static routers=192.168.1.3
 +
</source>
 +
 
 +
Log into the Pi via SSH and expand the filesystem with: <code>raspi-config --expand-rootfs </code>
 +
 
 +
 
 +
Once you can log into the Pi remotely via SSH, see the notes on [http://wiki.doublejumpelectric.com/index.php?title=Internet_Sharing_with_a_Raspberry_Pi internet sharing] so that you can update the Pi with the latest packages.
 +
 
 +
 
 +
== Resources ==
 +
# [https://www.raspberrypi.org/forums/viewtopic.php?t=144839#p1462633 Enabling SSH]
 +
# [https://pimylifeup.com/raspberry-pi-static-ip-address/ Configuring the Pi SD Card with a Static IP]
 +
# [https://www.raspberrypi.org/forums/viewtopic.php?t=195836#p1225554 Expanding the File System]

Latest revision as of 13:28, 2 June 2021

Flash the Raspberry Pi with etcher.

On the SD Card in the root directory of the boot partition, create an empty file called **ssh** or **ssh.txt**

On the SD Card in the etc directory of the rootfs boot partition, open the dhcpcd.conf file with root permissions.

Add the following lines to the bottom of the file. (This example assumes your ip address is 192.168.1.2, and your gateway is 192.168.1.3.)

interface eth0
static ip_address=192.168.1.2/24
static routers=192.168.1.3

Log into the Pi via SSH and expand the filesystem with: raspi-config --expand-rootfs


Once you can log into the Pi remotely via SSH, see the notes on internet sharing so that you can update the Pi with the latest packages.


Resources

  1. Enabling SSH
  2. Configuring the Pi SD Card with a Static IP
  3. Expanding the File System