Unable to get OH listening on the eth0 (ipv4) interface

  • Platform information:
    • Hardware: RPi 3 B+
    • OS: Openhabian
    • Java Runtime Environment: zulu-embedded-8-armhf
    • openHAB version: 2.3.0-1

Hi there,

I’m unable to access OH via my browser, because OH is not providing a service on my eth0 ipv4 interface (ipv6 looks fine from netstat but I’m not able to test it yet). I’ve read a few similar posts, but none of those methods seem to work (see config changes. OH service restarted every time. It was working a week ago and I think it may have not worked after installing mosquitto.

Any ideas?

Ports
[00:11:58] openhabian@openHABianPi:~$ sudo netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:9001 0.0.0.0:* LISTEN 463/node
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 829/smbd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 540/sshd
tcp 0 0 0.0.0.0:1883 0.0.0.0:* LISTEN 386/mosquitto
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 829/smbd
tcp 0 0 192.168.2.1:22 192.168.4.1:47826 ESTABLISHED 29123/sshd: openhab
tcp 0 0 192.168.2.1:9001 192.168.1.105:59570 ESTABLISHED 463/node
tcp6 0 0 :::139 :::* LISTEN 829/smbd
tcp6 0 0 127.0.0.1:38865 :::* LISTEN 652/java
tcp6 0 0 :::22 :::* LISTEN 540/sshd
tcp6 0 0 :::9080 :::* LISTEN 652/java
tcp6 0 0 :::1883 :::* LISTEN 386/mosquitto
tcp6 0 0 :::445 :::* LISTEN 829/smbd
tcp6 0 0 :::9443 :::* LISTEN 652/java
tcp6 0 0 127.0.0.1:8101 :::* LISTEN 652/java
tcp6 0 0 192.168.2.1:42234 52.205.252.169:9553 TIME_WAIT -
tcp6 0 0 127.0.0.1:37382 127.0.0.1:46475 TIME_WAIT -

Configs
[00:19:20] openhabian@openHABianPi:~$ cat /etc/default/openhab2
# openHAB 2 service options

#########################
## PORTS
## The ports openHAB will bind its HTTP/HTTPS web server to.

OPENHAB_HTTP_PORT=9080
OPENHAB_HTTPS_PORT=9443

#########################
## HTTP(S) LISTEN ADDRESS
##  The listen address used by the HTTP(S) server.
##  0.0.0.0 (default) allows a connection from any location
##  127.0.0.1 only allows the local machine to connect

OPENHAB_HTTP_ADDRESS=0.0.0.0

and

[00:19:30] openhabian@openHABianPi:~$ tail /etc/openhab2/services/runtime.cfg
# This setting allows to switch between a "simple" and an "advanced" mode for item management.
# In simple mode (autoLinks=true), links and their according items are automatically created for new Things.
# In advanced mode (autoLinks=false), the user has the full control about which items channels are linked to.
# Existing links will remain untouched. (default is true)
#
#org.eclipse.smarthome.links:autoLinks=false
  
org.eclipse.smarthome.network:primaryAddress=192.168.2.1/24
org.eclipse.smarthome.network:broadcastAddress=192.168.2.255
org.eclipse.smarthome.core.net.NetUtil:primaryAddress=192.168.2.0/24
[00:23:44] openhabian@openHABianPi:~$

that’s not true

You have OH2 listening on both IPv4 & IPv6.
These 2 entries:

tcp6 0 0 :::9080 :::* LISTEN 652/java
tcp6 0 0 :::9443 :::* LISTEN 652/java

hide a dualstack IPv4+IPv6 socket behind the listening IPv6 address.

just to be sure: post the output of:

sudo cat /proc/sys/net/ipv6/bindv6only

(it should be 0)

Something else is wrong with your OH2 setup.

Any log entries in openhab.log?

what is the output of

sudo systemctl status openhab2.service

After going through the viewing steps below and restarting the service, I retried the web pages on both 9080 and 9443 and both work!

Thanks for your advice Dim.

=====

You’re right, it is.

[07:14:59] openhabian@openHABianPi:~$ sudo cat /proc/sys/net/ipv6/bindv6only
0

Here’s the last 20 entries after a restart.

[07:25:48] openhabian@openHABianPi:~$ tail -n 20 -f /var/log/openhab2/openhab.log
2018-06-19 07:10:34.850 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:0220:gwb8d7af2b3e31:65555' to inbox.
2018-06-19 07:23:23.817 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2018-06-19 07:23:35.029 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Stopped Paper UI
2018-06-19 07:23:35.065 [INFO ] [panel.internal.HABPanelDashboardTile] - Stopped HABPanel
2018-06-19 07:23:35.085 [INFO ] [er.internal.HomeBuilderDashboardTile] - Stopped Home Builder
2018-06-19 07:23:35.112 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard
2018-06-19 07:23:52.293 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder
2018-06-19 07:23:54.703 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.2.1:9080
2018-06-19 07:23:54.709 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.2.1:9443
2018-06-19 07:23:58.568 [WARN ] [iscovery.TradfriDiscoveryParticipant] - Discovered Tradfri gateway doesn't have an IP address: [ServiceInfoImpl@26265326 name: 'gw-b8d7af2b3e31._coap._udp.local.' address: '(null):0' status: 'DNS: JmDNS-IP-1 [/192.168.2.1] state: probing 1 task: null', has NO data, empty]
2018-06-19 07:24:04.111 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-06-19 07:24:06.384 [INFO ] [ternal.dhcp.DHCPPacketListenerServer] - DHCP request packet listener online
2018-06-19 07:24:07.453 [WARN ] [radfri.handler.TradfriGatewayHandler] - Gateway with old firmware - please consider upgrading to the latest version.
2018-06-19 07:24:09.720 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-06-19 07:24:09.897 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-06-19 07:24:10.059 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-06-19 07:24:13.569 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:0220:gwb8d7af2b3e31:65554' to inbox.
2018-06-19 07:24:13.578 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:0220:gwb8d7af2b3e31:65553' to inbox.
2018-06-19 07:24:13.613 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:0820:gwb8d7af2b3e31:65552' to inbox.
2018-06-19 07:24:13.632 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'tradfri:0220:gwb8d7af2b3e31:65555' to inbox.

Going back further to when I was having problems…

There are a lot of these entries about 6 hours ago

2018-06-17 01:14:02.568 [WARN ] [e.californium.scandium.DTLSConnector] - Could not send datagram
java.io.IOException: Network is unreachable (sendto failed)
        at java.net.PlainDatagramSocketImpl.send(Native Method) ~[?:?]
        at java.net.DatagramSocket.send(DatagramSocket.java:693) [?:?]
        at org.eclipse.californium.scandium.DTLSConnector.sendFlight(DTLSConnector.java:1285) [200:org.eclipse.californium.scandium:1.0.6]
        at org.eclipse.californium.scandium.DTLSConnector.handleTimeout(DTLSConnector.java:1312) [200:org.eclipse.californium.scandium:1.0.6]
        at org.eclipse.californium.scandium.DTLSConnector.access$500(DTLSConnector.java:105) [200:org.eclipse.californium.scandium:1.0.6]
        at org.eclipse.californium.scandium.DTLSConnector$RetransmitTask.run(DTLSConnector.java:1424) [200:org.eclipse.californium.scandium:1.0.6]
        at java.util.TimerThread.mainLoop(Timer.java:555) [?:?]
        at java.util.TimerThread.run(Timer.java:505) [?:?]
2018-06-17 01:14:06.572 [WARN ] [e.californium.scandium.DTLSConnector] - Could not send datagram
java.io.IOException: Network is unreachable (sendto failed)
        at java.net.PlainDatagramSocketImpl.send(Native Method) ~[?:?]
        at java.net.DatagramSocket.send(DatagramSocket.java:693) [?:?]
        at org.eclipse.californium.scandium.DTLSConnector.sendFlight(DTLSConnector.java:1285) [200:org.eclipse.californium.scandium:1.0.6]
        at org.eclipse.californium.scandium.DTLSConnector.handleTimeout(DTLSConnector.java:1312) [200:org.eclipse.californium.scandium:1.0.6]
        at org.eclipse.californium.scandium.DTLSConnector.access$500(DTLSConnector.java:105) [200:org.eclipse.californium.scandium:1.0.6]
        at org.eclipse.californium.scandium.DTLSConnector$RetransmitTask.run(DTLSConnector.java:1424) [200:org.eclipse.californium.scandium:1.0.6]
        at java.util.TimerThread.mainLoop(Timer.java:555) [?:?]
        at java.util.TimerThread.run(Timer.java:505) [?:?]
[07:24:00] openhabian@openHABianPi:~$ sudo systemctl status openhab2.service
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-06-19 07:23:42 BST; 26s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 9908 ExecStop=/usr/share/openhab2/runtime/bin/karaf stop (code=exited, status=0/SUCCESS)
 Main PID: 10074 (java)
   CGroup: /system.slice/openhab2.service
           ├─10074 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenha
           ├─10342 ping -w 5 -c 1 192.168.1.78
           └─10364 ping -w 5 -c 1 192.168.1.84

Jun 19 07:23:42 openHABianPi systemd[1]: Started openHAB 2 - empowering the smart home.
lines 1-13/13 (END)
1 Like