Ignoring of required ethernet interface by NetUtil

Hi there,
I’m using openHAB 2 on a machine with two ethernet interfaces eth0 and eth1. eth0 for internet access, eth1 for a local openHAB test bench. I updated openHAB 2 from 2.0.0~20161027004427 to 2.0.0~20161102033223 and now I get the following error:

[WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring ETH1-IP-ADDRESS

Is there a way to define the default interface?

Thanks to you all!

Let me guess, you are using the Homematic binding, right?
Besides Sonos, this is the only one that uses this class and it was actually code from the Homematic binding that was moved to NetUtil - the only difference to before is that you know get this warning, but functionality should be identical to before.

The Homematic binding supports setting a dedicated callback host and port, so you should have the possibility to select the ip address that you want.

Nonetheless, I wonder whether it makes sense to offer a configuration possibility in the framework for the “preferred local interface” as we will have similar code in many bindings (besides Homematic, there is now also Sonos and Chromecast doing similar things). @maggu2810, what’s your opinion on that?

You are right. I didn’t thought the Homematic binding was causing the problem, but I actually wasn’t able to connect to the CCU2 because of the ignored eth1 ip address. My MQTT sensors are consistently sending values which I’m able to persist, everything from Homematic is dead. Following the NetUtil warning I get the messages:

2016-11-02 12:37:06.540 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring XXX
2016-11-02 12:37:21.454 [INFO ] [ternal.communicator.client.RpcClient] - Interface 'WIRED' on gateway 'ccu' not available, disabling support
2016-11-02 12:37:21.472 [INFO ] [ternal.communicator.client.RpcClient] - Interface 'CUXD' on gateway 'ccu' not available, disabling support
2016-11-02 12:37:21.475 [INFO ] [ternal.communicator.HomematicGateway] - HmGatewayInfo[id=CCU,type=CCU2,firmware=2.21.10,address=XXX,wired=false,hmip=true,cuxd=false]
2016-11-02 12:37:21.475 [INFO ] [ternal.communicator.HomematicGateway] - Used Homematic transfer modes: RF:BIN_RPC, HMIP:XML_RPC
2016-11-02 12:37:51.514 [WARN ] [ternal.communicator.HomematicGateway] - Read timed out
java.net.SocketTimeoutException: Read timed out                                 
        at java.net.SocketInputStream.socketRead0(Native Method)[:1.8.0_111]    
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)[:1.8.0_111]
        at java.net.SocketInputStream.read(SocketInputStream.java:170)[:1.8.0_111]
        at java.net.SocketInputStream.read(SocketInputStream.java:141)[:1.8.0_111]
        at org.openhab.binding.homematic.internal.communicator.message.BinRpcMessage.<init>(BinRpcMessage.java:75)[199:org.openhab.binding.homematic:2.0.0.201611011523]
...

The callback host is already set in homematic.cfg, I didn’t alter this after the update.

This happens during the startup process with beta4:

2016-11-02 12:56:37.572 [WARN ] [.internal.misc.LocalNetworkInterface] - Found multiple local interfaces! Replacing ETH0-IP-ADDRESS with ETH1-IP-ADDRESS

I don’t see such behavior with the snapshot.

Hm, the code in question is this. NetUtil should only be called if no callback host is set.
Can you check that your config is really correct? @gerrieg Are any issues regarding this known to you?

Ok, I defined the callback host through homematic.cfg with callback.host=…, which seems to be outdated. Is there any use of homematic.cfg anymore? Is it still required to enable HomematicIP hardware through homematic.cfg?
When I set callbackHost in the bridge definition in the *.things file my system is working again.

Thanks!

Hi Kai, I don’t know.
It will not break anything to add a mechanism to setup a default interface but I don’t know if the framework should take care of. If my Sonos boxes are in another network then my ChromeCast devices I would like to configure the interface per binding.

I just stumbled upon this thread as I have the same error message in my log right now. Also using Homematic binding.
After setting the callback.host var in .things file openHAB was able to connect to CCU2 again. Even though the netUtil warn messages remains in the logfile.

The problem started once I installed Docker on my debian server which then created some additional NICs. Would be good to be able to “bind” openhab to a certain NIC as a global setting. But I could also imagine the need to bind to different interfaces per binding depending on the network topology and separation openHAB lives in.

I’ve come across this using the voicerss TTS service and the squeezebox bindings. I have multiple NIC’s and using TTS it passes the wrong ip address of the file to stream.
Seeing that 10 bindings use NetUtil.getLocalIpv4HostAddress() and many don’t provide the interface configuration I’m surprised there aren’t more issues being reported.
Is this something that is going to be configurable in the ESH framwork or should I raise the issue with the binding maintainers?

You are fuly right, this is a missing feature in ESH that is definitely needed. I had it in the back of my mind since a while and now eventually entered an issue for it. Would you be interested in looking into its implementation?

I wish I could, but I’m not a developer.

I also had the “Multiple Interfaces Found” problem. in my case it is because Docker starts up before Openhab and creates an interface.

My solution/workaround is to ensure that systemd fires up OpenHab before Docker.

Easily done by inserting a “Before” directive into the openhab2.service unit file.

My edited version below.

Note that this may not survive updates to openhab2 in the future and you may need to manually add it again until openhab2 allows specific network interfaces to be bound

$ more /usr/lib/systemd/system/openhab2.service

[Unit]
Description=openHAB 2 - empowering the smart home
Documentation=http://docs.openhab.org
Documentation=https://community.openhab.org
Wants=network-online.target
Before=docker.socket
After=network-online.target

[Service]
EnvironmentFile=/etc/default/openhab2
User=openhab
Group=openhab
WorkingDirectory=/usr/share/openhab2
#PermissionsStartOnly=true
#ExecStartPre=/usr/share/openhab/bin/setpermissions.sh
ExecStart=/usr/share/openhab2/start.sh server
ExecStop=/usr/share/openhab2/runtime/bin/stop

Shutdown delay in seconds, before process is tried to be killed with KILL (if configured)

TimeoutStopSec=120
Restart=on-failure

[Install]
WantedBy=multi-user.target

FTR, we are close to having that feature implemented. I would expect it to be available in openHAB within the next 2 weeks.

I’m using openhabian and have two network interfaces configured: the standard eth0 interface and also one which has VLAN tagging activated (called “eth0.10@eth0”, i.e. VLAN tag 10). I want to use eth0 for openHAB. Unfortunately, openHAB defaults to eth0.10@eth0 and I cannot find a way to change this behavior.

PaperUI correctly presents me subnets from both interfaces under Configuration -> System – if I select the IP address that corresponds to eth0, click “Save” and then restart openHAB, the log still shows:
[WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring <eth0 IP>
:confused:

It seems as if the “Primary Address” is not taken into account when starting openHAB. Has anyone observed a similar behavior?

I’m using 2.2.0-SNAPSHOT 1028 with the Exec, Milight, Network and Samsung binding (if that matters).

Hi Alex,

could you please give a little more details on what you are doing and what goes wrong, please? What part of openHAB do you expect to bind to the IP address by setting it in PaperUI? This setting is solely for framework code or bindings that want to provide the current IP address to a service, such as for the Sonos binding it uses the IP to create a callback address.

It is not meant to bind the webserver to this IP address.

So when do you get the message [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring <eth0 IP>? There must be a bindign or something that wants to obtain the IP address…

Also, if you save and restart openHAB, is the saved Subnet still shown in PaperUI or does it show a different one?

Regards,

Stefan

I’m testing out the new changes, and am having issues.
I’ve set primary address in network settings in Paper Ui to the proper subnet, but any device openhab is trying to connect with over the network is throwing an error:

Netmask '32' is out of bounds (1-31)
java.lang.IllegalArgumentException: Netmask '32' is out of bounds (1-31)

The following OpenHAB 2 bindings are getting this error:
org.openhab.ui.dashboard
org.openhab.binding.squeezebox
org.openhab.binding.kodi

@g_g_rich Do you still have this problem? For me it was related to OpenVPN’s tun0 network device. Ifconfig showed a subnet mask of 255.255.255.255 which is the same as /32.
I was able to fix my problems with the instructions in this post.
Now I have a valid subnet mask of 255.255.255.0 or /24, all problems are gone and OpenVPN is still working.:slightly_smiling_face:

Thanks for the tip Matthias.
I did change the subnet mask but now shows the error.

[WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Invalid address '192.168.0.8/24', will use first interface instead.

I have the same error but not using homematic, neither Sonos or chromecast. I do run OH in docker though. The error is

[WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 10.0.1.105

Same issue with my setup. No Docker, but two NIC’s (one for openHAB and one for other network stuff). Since this is an old issue (already dating back to 2016), I’m curious what the current status of the ESH framework implementation is. Especially since there seemed to be some potentially debatable choice between framework and binding implementation.

Not sure if this could cause issues or is just a warning to ignore…
UPDATE: After closer inspection of the openhab.log it turns out openHAB is actually binding to the wrong interface (which is meant for other purposes of the server). I certainly would like to specifiy the interface openHAB uses.

For the record, I have no Sonos, Chromecast, Homekit bindings. At the moment only Hue, Astro, Ntp, Mqtt1, Http1 and Solaredge as I am in the process of building the system.

Well, just do it! In Paper UI -> Configuration -> System -> Network Settings, you can choose the subnet which should be used for callbacks to the openHAB instance:

The warning that @rswennen sees only occurs, if nothing is set by the user, so openHAB does a best guess and simply uses the first local interface.

2 Likes