TCP communication doesn't work under VPN

5 views (last 30 days)
Deja vu
Deja vu on 5 Nov 2024
Answered: sidik on 5 Nov 2024
Hi
I'm using Simulink and TCP communication to transfer data from one computer to another. Both models of sender and receiver run under Simulink Desktop Real-TIme so I use Packet Input/Output block to configure TCP. When both computers are under same LAN, TCP communication works fine. I can receive data transfered by the sender computer. But when I use a VPN on the receiver computer, I cannot receive data any more. VPN acutally makes both computers still under the same LAN. I can ping the sender computer successfully.
When using VPN, I have three IPs. IP of sender computer (IP A), IP of VPN (IP B) and IP of receiver computer (IP C). How can I model and configure in Simulink to make TCP communication work again? Thank you!
  2 Comments
Deja vu
Deja vu on 5 Nov 2024
To Sumukh:
No. Actually I have two models running on two computers. One model uses Packet Input and the other uses Packet Output.

Sign in to comment.

Answers (1)

sidik
sidik on 5 Nov 2024
hello @Sumukh
I would like to ask why you would want to use a VPN when communicating over a local network. What specific goals do you aim to achieve with a VPN?
It's important to note that when using a VPN, the IP address used by Simulink for TCP communication might cause issues. Simulink could attempt to forward packets to an improperly configured address for the VPN tunnel. Here are some steps to resolve this issue:
1. Check the configuration of the Packet Input and Packet Output blocks in Simulink to ensure they use the IP address that is accessible via the VPN.
2. Verify the firewall settings to allow TCP traffic on the relevant ports for both computers.
3. If necessary, add static routes to ensure that traffic is directed through the VPN interface. You can execute the following command:
```
route add <IP_C> mask 255.255.255.255 <IP_B>
```
- `<IP_C>` is the receiver address.
- `<IP_B>` is the IP address of the VPN interface.
4. Review the VPN settings to ensure it is not blocking TCP traffic between the two addresses.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!