Raspberry Pi

How to configure a Raspberry Pi with a Static IP

sudo nano /etc/dhcpcd.conf

Scroll to the bottom of the file and add the following lines:

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

#Remove these and reboot to return to dynamic IP
interface eth0
static ip_address=192.168.11.101/24
static routers=192.168.11.1
static domain_name_servers=192.168.1.1

Save the file: Ctrl+O, then Enter
Exit the nano editor: Ctrl+X
Reboot the computer

sudo reboot

Notes:
The subnet mask is written in CIDR notation at the end of the static IP address.
‘static routers=’ is the default gateway
‘static domain_name_servers=’ can be followed by multiple IP addresses, with each address separated from the previous by a single space ‘ ‘.

By admin on January 19, 2017 | Raspberry Pi | A comment?

Raspberry Pi dropping WiFi when ethernet plugged in

I do love my Raspberry Pi! That’s Pi, as in very small computer, not pie as in desert. (I’m diabetic, so please don’t tempt me.) I use these little devices for all kinds of projects.

I’ve recently started using them to test an internal network with a series of routers, with each Pi on a different network. (192.168.11.0/24, 192.168.22.0/24… you get the picture.) To test these, I set static IP addressed on the ethernet connections and then access them with ssh via their dynamic WiFi IPs.

To configure the devices, I would first log in using ssh to the wlan0 interface, configure /etc/network/interfaces with the desired static IP, then plug in the ethernet cable. The problem with this was that as soon as I plugged in the cable, my WiFi connection would drop, causing me to lose all contact with the Pi.

#sudo ifplugd eth0 --kill
By admin on January 13, 2017 | Raspberry Pi | A comment?