Open outbound udp port

Hi, I installed HA OS on virtualbox with windows 10 as host.
The probllem is using knx.
I configured it on configuration.yaml as

knx:
  tunneling:
      host: "192.168.178.XX0"
#      port: 3671
#      local_ip: "192.168.178.XX5"
#      route_back: true

(tried also with last tree row uncommented)

On host I have knx virtual that talks correctly to HA server via UDP (seen with procmon).
It seems that knx stack didn’t succeed to reply to knx virtual.

nmap -p 3671 -sU -v 192.168.178.XX0

says 3671/udp state closed
On core log I got
WARNING (MainThread) [xknx.log] Sending telegram failed. No active communication channel.

Am I right saying that the problem lies on HA OS with 3671 udp port closed?
How can I open it?

The default installation of ha OS uses alpine linux. Is there a firewall enabled in this installation? (awall?)

Knx Virtual can’t.
See NAT section Connect KNX Virtual to ETS – KNX Association

I forgot to say that I configured virtualbox as bridged (not NAT)…

No, 3671 is the port used by the tunneling server to listen for incoming connections. Outgoing use a random port, just like for everything else.

Yes. The tunneling server is the one to reply. You can’t connect to HA, but HA has to initiate a connection. Also SearchReqests will not be answered by HA.

Does HAOS run docker in network=host mode?

I’d not complicate stuff with VMs, but just install HA core locally for such a test system and work my way up from there.

Another possible block is Windows. The Knx stack used in HA is hardly tested on Windows.

You can also set loglevel of xknx to debug to get more information.

Thanks for your infos!!!
log says:

xknx.knx] Sending: <KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="CONNECT_REQUEST" Reserve="0" TotalLength="26" />
 body="<ConnectRequest control_endpoint="<HPAI 0.0.0.0:0 />" data_endpoint="<HPAI 0.0.0.0:0 />" request_type="ConnectRequestType.TUNNEL_CONNECTION" />" />
[xknx.log] Error: KNX bus did not respond in time (1.0 secs) to request of type 'Connect'
[xknx.log] Could not establish connection to KNX/IP interface. CommunicationError: ConnectRequest failed. Status code: None
[xknx.log] Closing transport.

is correct 0.0.0.0? What’s HPAI?

Only if you use route_back

That’s just knx for IP and Port.

I configured HA with righ ip (i think).
Using procmon on windows (host) I got those entries:


	ETS5N.exe	2148	UDP Send	MyServer:51036 -> MyServer:3671	SUCCESS	Length: 16, seqnum: 0, connid: 0
	KV.exe		5696	UDP Receive	MyServer:3671 -> MyServer:51036	SUCCESS	Length: 16, seqnum: 0, connid: 0
	KV.exe		5696	UDP Send	MyServer:3671 -> MyServer:51035	SUCCESS	Length: 8, seqnum: 0, connid: 0
	ETS5N.exe	2148	UDP Receive	MyServer:51035 -> MyServer:3671	SUCCESS	Length: 8, seqnum: 0, connid: 0
	KV.exe		5696	UDP Receive	MyServer.fritz.box:3671 -> homeassistant.fritz.box:53407	SUCCESS	Length: 26, seqnum: 0, connid: 0
	KV.exe		5696	UDP Receive	MyServer.fritz.box:3671 -> homeassistant.fritz.box:44825	SUCCESS	Length: 26, seqnum: 0, connid: 0

the first 4 rows are ETS5 and KV (knx virtual) chatting. KV is listening on port 3671.
The last 2 rows seems that kv is receiving a datagram from HA, but fails to respond.
xknx logs seems correct… It send a datagram correctly, but fails to get an answer.

[xknx.knx] Sending: <KNXIPFrame <KNXIPHeader HeaderLength="6" ProtocolVersion="16" KNXIPServiceType="CONNECT_REQUEST" Reserve="0" TotalLength="26" />
 body="<ConnectRequest control_endpoint="<HPAI 0.0.0.0:0 />" data_endpoint="<HPAI 0.0.0.0:0 />" request_type="ConnectRequestType.TUNNEL_CONNECTION" />" />
[xknx.log] Error: KNX bus did not respond in time (1.0 secs) to request of type 'Connect'
[xknx.log] Could not establish connection to KNX/IP interface. CommunicationError: ConnectRequest failed. Status code: None
[xknx.log] Closing transport.

So it seems that the faulty part is KV!!

That’s what the knx.org article is saying.
If you send HPAI all 0 you are requesting it to use route back (NAT mode) - this is not supported by Knx Virtual.

Try to install both on the same machine and don’t enable route_back. Maybe you’re more lucky then.

How can I install on same machine if HA runs on linux and KNX virtual (KV) on windows?

I tried a programmatic approach… I set up an UDP proxy on windows host (where KV is running) and set HA to use the proxy UDP port.
KV seems not to respond to this (local) port.
With ETS5 UDP flow is as follow:

ETS5N.exe	9364	UDP Send	MyPc:54525 -> 224.0.23.12:3671	Length: 22, seqnum: 0, connid: 0	SUCCESS
KV.exe		3192	UDP Receive	224.0.23.12:3671 -> MyPc:54525	Length: 22, seqnum: 0, connid: 0	SUCCESS
ETS5N.exe	9364	UDP Send	MyPc:54525 -> 224.0.23.12:3671	Length: 14, seqnum: 0, connid: 0	SUCCESS
KV.exe		3192	UDP Receive	224.0.23.12:3671 -> MyPc:54525	Length: 14, seqnum: 0, connid: 0	SUCCESS
KV.exe		3192	UDP Send	MyPc:3671 -> MyPc:54525	Length: 78, seqnum: 0, connid: 0	SUCCESS
ETS5N.exe	9364	UDP Receive	MyPc:54525 -> MyPc:3671	Length: 78, seqnum: 0, connid: 0	SUCCESS

ETS5 send 22 bytes to KV, then sends 14 bytes. After this second datagram KV sends 78 bytes to ETS5

HA is doind like this

python.exe	4612	UDP Receive	MyPc.fritz.box:36711 -> homeassistant.fritz.box:41318	Length: 26, seqnum: 0, connid: 0	SUCCESS
python.exe	4612	UDP Send	MyPc:36711 -> 224.0.23.12:3671	Length: 26, seqnum: 0, connid: 0	SUCCESS
KV.exe		3192	UDP Receive	224.0.23.12:3671 -> MyPc:36711	Length: 26, seqnum: 0, connid: 0	SUCCESS

So UDP proxy receives 26 bytes from HA. It forwards to KV. KV reads the data but it didn’t answer.

Any idea on this behavior?

HA runs on Python, not Linux.
Xknx can be run on Windows Python. No idea about HA.

No that’s just guesswork. Use HA xknx.knx logger, ETS Busmonitor or Wireshark to listen to actual KNX Frames, not just data size.

Noob feelings!!! Thanks Matthias!
Why this info isn’t present on HA windows page?!?!?!

I installed HA in windows (no virtual machine, no docker), xknx is working

knx:
  tunneling:
    host: "127.0.0.1"  
  light:
    - name: "Kitchen"
      address: "1/1/10"
      state_address: "1/4/10"

On previous installations (virtualbox) the light switch was automatically added to the “home” page, for some reason not now :frowning:
Adding it manually did the trick!! The ligh in KNX virtual is named ch1 HAKNX|644x500