TCP communication doesn't work under VPN

66 次查看(过去 30 天)
Deja vu
Deja vu 2024-11-5,3:31
回答: sidik 2024-11-5,14:06
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 个评论
Deja vu
Deja vu 2024-11-5,10:23
To Sumukh:
No. Actually I have two models running on two computers. One model uses Packet Input and the other uses Packet Output.

请先登录,再进行评论。

回答(1 个)

sidik
sidik 2024-11-5,14:06
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.

类别

Help CenterFile Exchange 中查找有关 Model Preparation for Real-Time Simulation 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by