Hi,
Just sharing the steps I took to get the wired interface going on my PI.
I’m new to OpenHAB, but not so new to Linux and PI’s. Liking what I see (gave up with OpenRemote).
Raspberry Pi 3, Model B:
# cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
# uname -a
Linux MyHostname 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
In my setup, I don’t wish to use the built-in wifi as the PI is powered via Power Over Ethernet (PoE) HAT but rather the wired connection. I had a little bother getting it going. I don’t know why and I can only dream of knowing 1% of the Linux stuff the people who put OpenHabian distros together, but it is my understanding that with Raspbian (Debian) Stretch, the /etc/network/interfaces
file is almost redundant and essentially replaced by /etc/dhcpcd.conf
. To get dhcpcd
running, I commented out all the lines, except one, in the distro-supplied version of /etc/network/interfaces
so it now looks:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
#allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
On service networking restart
, the eth0
interface was assigned a DHCP address.
Further, I want a static IP address, so I modified /etc/dhcpcd.conf
thus:
# Example static IP configuration:
interface eth0
static ip_address=192.168.0.5/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
Where:
192.168.0.5 is an ip address outside of my DHCP range - i.e. an address that won’t be assigned by the DHCP server (router).
If you are hooked up to a router supplied by your ISP, such as a Zyxel or NetGear, the chances are:
192.168.0.1 (or similar) is the IP of your router and thus DHCP and domain name server (DNS).
You can check it on a Windows computer:
Start > Run > cmd > OK
C:\Users\John > ipconfig /all
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) Centrino(R) Ultimate-N 6300 AGN
Physical Address. . . . . . . . . : 3C-A9-F4-21-EB-3C
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.0.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : 09 March 2018 11:52:34
Lease Expires . . . . . . . . . . : 11 March 2018 11:52:35
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Default Gateway = static routers
DNS Servers = static domain_name_servers
TIP: There seems to be a lot of confusion around Raspberry PI networking. dhcpcd stands for Dynamic Host Configuration Protocol CLIENT Daemon, whereas dhcpd stands for Dynamic Host Configuration Daemon. Typically, PI’s, desktops, laptops, phones etc all have a DHCP client that connects to a DHCP server to get their IP address. In most home networks, the DHCP server is performed by one’s router.
I also disabled the wireless totally by modifying /boot/config.txt
, documented here, adding the lines:
# Disable WiFi Interface (wlan0)
dtoverlay=pi3-disable-wifi
and rebooting.
This may cause issues with something else down the line but for now, I have it working the way I want.
HTH