Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

communicate with ctrlX COREvirtual Teaser

How to communicate between a ctrlX COREvirtual and other applications

CodeShepherd
Community Moderator
Community Moderator
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 COREvirtualcommunicate 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 devicecommunicating 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 settingsctrlX 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 COREvirtualcommunicating 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 settingsctrlX 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 ruleWindows 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-REDctrlX 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 forwardingcommunicating 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 settingsctrlX 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-REDtwo 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 portproxycommunicating 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-REDctrlX 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 bridgecommunicating 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 bridgedWindows 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-REDctrlX 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 Comment
nickH
Community Moderator
Community Moderator

Thanks for this great tutorial. Helped me a lot 🙂 

Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist