11/12/2024

How to communicate between a ctrlX COREvirtual and other applications

Content

This expert guide shows how to configure the ctrlX COREvirtual and your network to communicate to external applications via TCP using Node-RED. This can be adapted to different IP based protocols. 

communicate with ctrlX COREvirtual

Requirements

  • Know how about network architecture and communication
  • ctrlX WORKS (1.18.1) installed on host PC
  • ctrlX CORE - Node-RED app (1.18.0) installed on control
  • No active VPN on host operating system

 

Use cases

  1. ctrlX COREvirtual in port forwarding mode communicating to a device on the network
    1. ctrlX COREvirtual in port forwarding mode communicating to ctrlX COREvirtual in network adapter mode
  2. Two ctrlX COREvirtual in port forwarding mode communicating to each other
  3. ctrlX COREvirtual network adapter mode communicating with network device
    1. Two ctrlX CORE in network adapter mode communicating to each other
    2. Two external Network devices communicating to each other

 

Explanation

1 ctrlX COREvirtual in port forwarding mode communicating to a device on the network

  • For sending a request from ctrlX COREvirtual to a server on a network device
    communicating ctrlX COREvirtual to external device

    • start ctrlX COREvirtual in port forwarding mode and set IP (e.g. 192.168.2.2) to a different subnet as the real network device e.g. ctrlX CORE (e.g. 192.168.1.1) connected to your PC, so data is routed correctly via the standard gateway in ctrlX COREvirtual
      ctrlX CORE WebUI IPv4 settings
    • Choose a port you like to communicate over e.g. 1111 and use IP of your network device e.g. 192.168.1.1

  • For sending a request from a network device to a server ctrlX COREvirtual
    communicating external device to ctrlX COREvirtual

    • enter in ctrlX WORKS in the ctrlX COREvirtual port forwarding settings one additional port you like to communicate over e.g. "8022:22,8443:443,8740:11740,4840:4840,2222:2222"
      ctrlX WORKS ctrlX COREvirtual port forwarding settings
    • Add an inbound rule to your Windows firewall for chosen port to let the data path through
      Windows firewall inbound rule
    • Use chosen port e.g. 2222 and IP address of the network adapter of your PC  the network device is connected to e.g. 192.168.1.87
  • Start communication in both directions:
    ctrlX COREvirtual connected via TCP in Node-RED

1.1 ctrlX COREvirtual in port forwarding mode communicating to ctrlX COREvirtual in network adapter mode

See use case 1 "ctrlX COREvirtual in port forwarding mode communicating to a device on the network"

2 Two ctrlX COREvirtual in port forwarding mode communicating to each other

communicating using QEMU port forwarding

  • Enter in ctrlX WORKS in one ctrlX COREvirtual port forwarding settings one additional port you like to communicate over e.g. "8022:22,8443:443,8740:11740,4840:4840,2222:2222"
    ctrlX WORKS ctrlX COREvirtual port forwarding settings
  • The other one needs completely different ports e.g. add a one in front of all standard ports and add one additional for communication e.g. "18022:22,18443:443,18740:11740,14840:4840,1111:1111"
  • Use on both sides an IP of one of a active network adapter of your host operating system for communication e.g. 192.168.0.120, so the data is rooted via the standard gateway
  • Start communication in both directions:
    two ctrlX COREvirtual connected via TCP in Node-RED

3 ctrlX COREvirtual network adapter mode communicating with network device

At least two ways are possible:

  1. Forwarding ports in Windows netsh portproxy:
    communicating using Windows netsh portproxy

    • start ctrlX COREvirtual in network adapter mode and set IP (e.g. 192.168.2.2) to a different subnet as the real network device e.g. ctrlX CORE (e.g. 192.168.1.1) connected to your PC. Beware that the IP of the Windows network adapter the ctrlX CORE is connected to needs to be adjusted accordingly e.g. 192.168.2.3, to be able to communicate again.
    • Choose ports to communicate to virtual control e.g. 2222 and to real control e.g. 1111
    • Use command line tool to setup host operating system (see example code batch file attached)
      • Add an inbound rule to your Windows firewall for chosen ports to let the data path through 
        netsh advfirewall firewall add rule name=portproxy-2222 dir=in action=allow protocol=TCP localport=2222​
        netsh advfirewall firewall add rule name=portproxy-1111 dir=in action=allow protocol=TCP localport=1111
      • Add forwarding rule to Windows portproxy interface that gets all packages coming from the IP of the Windows network adapter the real ctrlX CORE is connected to and forward it to the ctrlX COREvituals IP
        netsh interface portproxy add v4tov4 listenaddress=192.168.1.3 listenport=2222 connectaddress=192.168.2.2 connectport=2222
      • Add forwarding rule to Windows portproxy interface that gets all packages coming from the IP of the Windows network adapter the ctrlX COREvirtuals is connected to and forward it to the real ctrlX CORE IP

        netsh interface portproxy add v4tov4 listenaddress=192.168.2.3 listenport=1111 connectaddress=192.168.1.1 connectport=1111
    • Start communication in both directions:
      ctrlX COREvirtual and ctrlX CORE forwarded via TCP in Node-RED

  2. Bridging Windows network adapters (could be restricted by network administrator):
    communicating using network adapter bridge

    • Start ctrlX COREvirtual in network adapter mode and set IP (e.g. 192.168.1.2) to the same subnet as the real ctrlX CORE (e.g. 192.168.1.1) connected to your PC
    • Bridge in your Windows network connections, the virtual network adapter with the real one, so data is routed between both correctly
      Windows network connections bridged
    • To get access to the devices again enter a IPv4 address to the network bridge in the same subnet as your devices e.g. 192.168.1.3
    • Start communication in both directions:
      ctrlX COREvirtual and ctrlX CORE connected via TCP in Node-RED


3.1 Two ctrlX CORE in network adapter mode communicating to each other

See use case 3 "ctrlX COREvirtual network adapter mode communicating with network device"

3.2 Two external Network devices communicating to each other

See use case 3 "ctrlX COREvirtual network adapter mode communicating with network device"

Related information

1
Example data Case 1.zip
1.16KB
Example data Case 2.zip
1.15KB
Example data Case 3 (forwarded).zip
2.17KB
Example data Case 3 (bridged).zip
1.15KB

Latest published/updated articles

Types
How-to
Categories
Controls
IOT