# coreMQTT Demo (Mutual Authentication) on Windows not work

**URL:** <https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617>\
**Category:** AWS\
**Created:** [June 5, 2024, 11:42am UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617 "2024-06-05T11:42:57Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [June 6, 2024, 12:45pm UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/21 "2024-06-06T12:45:32Z")

</div>

@daofx123

I have tested your demo config and was able to run the demo. Please find the logs, :

```auto
0 0 [None] FreeRTOS_AddEndPoint: MAC: 11-41 IPv4: 10.10.10.200

The following network interfaces are available:

Interface 1 - rpcap://\Device\NPF_{BE1AF62A-A518-484E-9EB7-7BD7095DCCD0}
              (Network adapter 'Microsoft' on local host)

Interface 2 - rpcap://\Device\NPF_{1F8B9C8C-BE0F-4B12-9E17-DFD972793CF6}
              (Network adapter 'Microsoft' on local host)

Interface 3 - rpcap://\Device\NPF_{3EB30C62-3C4C-427F-BB21-AA53A28E68C1}
              (Network adapter 'Microsoft' on local host)

Interface 4 - rpcap://\Device\NPF_{4BC20A74-15F0-49D0-BE6D-DBA3A76247FF}
              (Network adapter 'Oracle' on local host)

Interface 5 - rpcap://\Device\NPF_{44BB3D52-A65F-45DB-83BC-3022AA9B623D}
              (Network adapter 'Microsoft' on local host)

Interface 6 - rpcap://\Device\NPF_{64BAC72F-15DD-42EF-95AD-832FC91E3D6B}
              (Network adapter 'Realtek USB NIC' on local host)

Interface 7 - rpcap://\Device\NPF_{3919812B-DC0E-4F33-B5F0-A501573E1C6A}
              (Network adapter 'TAP-Windows Adapter V9' on local host)

The interface that will be opened is set by "configNETWORK_INTERFACE_TO_USE", which
should be defined in FreeRTOSConfig.h
Attempting to open interface number 6.
Successfully opened interface number 6.
DHCP-socket[11-41]: DHCP Socket Create
1 1201 [IP-Task] prvCreateDHCPSocket[11-41]: open, user count 1
vDHCP_RATimerReload: 250
2 1203 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:570] ---------STARTING DEMO---------

3 1203 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:576] Waiting for the network link up event...
4 1471 [MAC_ISR] Bounced back by WinPCAP interface: 00:11:11:11:11:41
vDHCPProcess: offer 192.168.0.101 for MAC address 11-41
5 1831 [IP-Task] vDHCPProcess: offer 192.168.0.101 for MAC address 11-41

IP Address: 192.168.0.101
6 1831 [IP-Task] Subnet Mask: 255.255.255.0
Gateway Address: 192.168.0.1
7 1831 [IP-Task] DNS Server Address: 192.168.0.1

prvCloseDHCPSocket[11-41]: closed, user count 0
8 1831 [IP-Task] vDHCP_RATimerReload: 21600000
[INFO] [MqttMutualAuth] [prvConnectToServerWithBackoffRetries:741] 9 2203 [DemoTask] Creating a TLS connection to a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com:8883.

10 2231 [IP-Task] ipARP_REPLY from 192.168.0.1 to 192.168.0.101 end-point 192.168.0.101
DNS_ReadReply returns -11
11 7203 [DemoTask] prvIncreaseDNS4Index: from 0 to 0
DNS[0x4B0F]: The answer to 'a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com' (44.239.31.83) will be stored
12 7291 [DemoTask] FreeRTOS_connect: 43565 to 44.239.31.83:8883
[INFO] [SocketsWrapper] [TCP_Sockets_Connect:189] 13 7491 [DemoTask] Established TCP connection with a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com.
14 9011 [DemoTask] [INFO] [MbedtlsTransport] [tlsHandshake:613] (Network connection 0199FE2C) TLS handshake successful.
15 9011 [DemoTask] [INFO] [MbedtlsTransport] [TLS_FreeRTOS_Connect:784] (Network connection 0199FE2C) Connection to a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com established.
16 9011 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:596] Creating an MQTT connection to a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com.

17 9831 [DemoTask] [INFO] [MqttMutualAuth] [prvCreateMQTTConnectionWithBroker:862] An MQTT connection is established with a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com.
18 9831 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTSubscribeWithBackoffRetries:923] Attempt to subscribe to the MQTT topic fish_iot/example/topic.

19 10371 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTSubscribeWithBackoffRetries:930] SUBSCRIBE sent for topic fish_iot/example/topic to broker.

20 10411 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessResponse:1072] Subscribed to the topic fish_iot/example/topic with maximum QoS 1.

21 12411 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:610] Publish to the MQTT topic fish_iot/example/topic.

22 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTDemoTask:616] Attempt to receive publish message from broker.

23 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessResponse:1053] PUBACK received for packet Id 2.

24 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessIncomingPublish:1108] Incoming QoS : 1

25 12991 [DemoTask] [INFO] [MqttMutualAuth] [prvMQTTProcessIncomingPublish:1119]
Incoming Publish Topic Name: fish_iot/example/topic matches subscribed topic.
Incoming Publish Message : Hello World!

```

This is [the commit](https://github.com/FreeRTOS/FreeRTOS/commit/6b513cb1a2c6c1a02cd5a9d867c978644f7130ea) with which I have run the tests.

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [June 6, 2024, 12:48pm UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/22 "2024-06-06T12:48:34Z")

</div>

I have tested with FreeRTOS 202212.01 as well. Though the TCP connection is succeeding, the TLS handshake was failing, hence used the version that has MbedTLS 3.5.1.

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [June 6, 2024, 12:54pm UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/23 "2024-06-06T12:54:25Z")

</div>

> [@daofx123](#):
>
> ```auto
> PS C:\Users\ASUS> Test-NetConnection -computername a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com -port 8883 ComputerName : a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com
> RemoteAddress : 2620:108:700f::22d7:2366
> RemotePort : 8883
> InterfaceAlias : 以太网
> SourceAddress : 2001:da8:1002:6001::3:4a2b
> TcpTestSucceeded : True
> 
> ```

This is strange - you are able to reach the AWS IoT Broker from your host but not from the TCP stack. Just to confirm that it is not something IP4 specific, can you run the following -

```auto
Test-Connection -targetname <your_broker_endpoint> -tcpport 8883 -Detailed -ipv4

```

Do you have the Wireshark capture for the TCP demo? Also, does the Wireshark capture for the MQTT demo still the same (i.e. no SYNACK)?

---

<div class="post-metadata">

**Author:** ![daofx123](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/daofx123/32/4671_2.png) [@daofx123](https://forums.freertos.org/u/daofx123)\
**Post date:** [June 6, 2024, 1:00pm UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/24 "2024-06-06T13:00:34Z")

</div>

Okay, thank you very much for the help you’ve provided. I will test using the version of FreeRTOS you mentioned.

---

<div class="post-metadata">

**Author:** ![daofx123](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/daofx123/32/4671_2.png) [@daofx123](https://forums.freertos.org/u/daofx123)\
**Post date:** [June 6, 2024, 1:01pm UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/25 "2024-06-06T13:01:05Z")

</div>

The Wireshark capture for the MQTT demo is still same.

---

<div class="post-metadata">

**Author:** ![daofx123](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/daofx123/32/4671_2.png) [@daofx123](https://forums.freertos.org/u/daofx123)\
**Post date:** [June 7, 2024, 1:07am UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/26 "2024-06-07T01:07:40Z")

</div>

I have rerun the demo in the version you mentioned, but the same issue persists. I’d like to know if there are any other settings you’ve made, or could it be a problem with the Windows version? I am running this demo on a Windows 11 system without a actual physical device, are there any additional settings that need to be configured?

---

<div class="post-metadata">

**Author:** ![daofx123](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/daofx123/32/4671_2.png) [@daofx123](https://forums.freertos.org/u/daofx123)\
**Post date:** [June 7, 2024, 1:41am UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/27 "2024-06-07T01:41:30Z")

</div>

Sorry, I misunderstood your question. When I run the command, the output is as follow.

```auto
 Target: a2vtd9m5hzbrcl-ats.iot.us-west-2.amazonaws.com

  Id Source Address Port Latency Connected Status  
                                                           (ms)
  -- ------ ------- ---- ------- --------- ------
   1 FISH 50.112.218.33 8883 182 True Success

```

And the TCP demo I don’t know how to set to confirm if my area able to reach any server. Do you have some suggestions?

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [June 7, 2024, 4:15am UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/28 "2024-06-07T04:15:57Z")

</div>

@daofx123

Im running it on Windows 10. Built the demo on Microsoft Visual Studio Community 2022 (64-bit) - Version 17.9.5.

> I am running this demo on a Windows 11 system without a actual physical device, are there any additional settings that need to be configured?

Other than installing winpcap and having a wired internet connection to the PC, no other changes have been made.

---

<div class="post-metadata">

**Author:** ![daofx123](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/daofx123/32/4671_2.png) [@daofx123](https://forums.freertos.org/u/daofx123)\
**Post date:** [June 7, 2024, 4:18am UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/29 "2024-06-07T04:18:47Z")

</div>

Thank you very much, I have resolved this issue. The reason was simply that there were some problems with the network I was connected to; after rerouting through the router, the connection was successful.

---

<div class="post-metadata">

**Author:** ![tony-josi-aws](https://avatars.discourse-cdn.com/v4/letter/t/a6a055/32.png) [@tony-josi-aws](https://forums.freertos.org/u/tony-josi-aws)\
**Post date:** [June 7, 2024, 6:10am UTC](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617/30 "2024-06-07T06:10:02Z")

</div>

@daofx123 Thanks for reporting back.

[Previous page](https://forums.freertos.org/t/coremqtt-demo-mutual-authentication-on-windows-not-work/20617.md?page=1)
