How do I configure Windows Defender Firewall for MATLAB to communicate with external hardware such as Speedgoat?

How do I configure Windows Defender Firewall to allow a connection between MATLAB (or my MATLAB Compiler-generated standalone application) and my hardware, such as AMD SoC or Speedgoat (Simulink Real-Time)?

 Accepted Answer

To communicate with external hardware such as Speedgoat or AMD SoC boards via Ethernet, MATLAB (or any standalone application generated with MATLAB Compiler) must be allowed to communicate on all network types through Windows Defender Firewall. The steps are as follows:
  • Step 1: Configure the PC Ethernet interface as 'Private'.
  • Step 2: Create general inbound and outbound firewall rules for MATLAB
  • Step 3: Add additional rules if required
Important notes:
  1. Perform the steps below in collaboration with your IT system administrator.
  2. You must repeat the procedure below for every installed version of MATLAB and every standalone application that you intend to use with external hardware. The same applies if you upgrade MATLAB to a newer version at any point in the future.
  3. The steps below may also have to be repeated after any company-wide IT rollouts or Windows Updates, as firewall settings may be reset as part of this.
  4. When allowing access for a standalone app created with MATLAB Compiler, make sure that the application (e.g., "slrt_app.exe") is specified in your firewall rules rather than "matlab.exe".

Step 1: Configure the PC Ethernet Interface as 'Private'

To ensure smooth host-target communication, we recommend configuring the host PC Ethernet interface connected to the hardware as 'Private'. Windows classifies all Ethernet connections as 'Public' by default, which can disrupt communication due to the security restrictions associated with this network type. Additionally, users may lack the necessary permissions to set any firewall rules for 'Public' networks. Refer to our documentation for detailed instructions:

Step 2: Create general inbound and outbound firewall rules for MATLAB

Create one Inbound Rule and one Outbound Rule in the Advanced Windows Defender Firewall settings as follows:
1) Find Windows Defender Firewall with Advanced Security by using the Windows search.
2) Select Inbound Rules and New Rule.
3) For the Rule Type, select Program, and click Next.
4) Select This program path and find the MATLAB release that you are using. Make sure to select matlab.exe from the bin folder (<matlabroot>\bin\matlab.exe):
5) For the Action, select Allow the connection, and click Next.
6) For the Profile, select the Domain, Private, and Public checkboxes. If the 'Public' checkbox is grayed out, you must configure the network interface as 'Private' as per Step 1 above). Click Next
7) For Name, provide a Name for this inbound rule (for example, MATLAB R2020b inbound), and click Finish.
8) Select Outbound Rules and click New Rule.
9) Repeat steps 3 through 7 for the custom outbound rule.
If any of the above options are not available due to IT policy, please contact your IT helpdesk to verify your firewall rules.

Step 3: Add addional rules if required

Depending on the hardware and the communication channels used by the application, additional rules may have to be added to Windows Firewall. Especially on Windows 11 systems, incoming UDP traffic may be incorrectly classified as malicious and blocked, even if a general firewall rule permits incoming communication. To ensure proper connectivity, it may be necessary to create an additional explicit rule to allow incoming UDP traffic.
To use Speedgoat with MATLAB R2020b through R2025b, please follow this MATLAB Answer to add a required third firewall rule to unblock the UDP ports used by the FastDDS/RTPS protocol for host-target communication.
Adding an incoming UDP rule may also be necessary when you have UDP Send blocks in your Simulink model to exchange data between the hardware and the host PC. In that case, unblock the ports as specified in your UDP blocks.

Summary

You should now have a set of at least 2 firewall rules. For Simulink Real-Time & Speedgoat R2020b through R2025b, an additional third UDP inbound rule is mandatory, as shown in the screenshots below. Important: You must have this set of rules for every installed version of MATLAB and every standalone application that you intend to use with external hardware.

Further Troubleshooting

If the above instructions don't help resolve the communication issues with your Speedgoat hardware, refer to the following MATLAB Answers post for further troubleshooting steps:

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!