i am trying to get a network redundancy (like Bonding in X20 PLC) for X90 PLC.
i am switching the IP address between the ETH port and the PWL port (defined as ethernet port), the switching work fine, but, the problem is that i am using OPC UA over the network, when i change between the ports the OPC UA client (Unexpert is losing the communication - attaching a picture). is there a way to overcome this problem and keep the OPC UA working when changing the ports? thank you.
As far as I know is that when you change the IP adres the network stack resets and every TCP connection is dropped. So this naturally results that OPCUA loses its connection.
So from the application you should build a automatic reconnect.
yes’ i expected the OPCUA to reconnect to the correct address. do you have any practical advice how to restart the OPC_UA server or reconnect?
The OPCUA server should be directly reachable again nothing to restart.
But you are changing IP around..
So doing the following ?
START:
- ETH2 : 192.168.1.1
- ETH3 : 172.168.10.1 ( Something random but not in the subnet range of the other ETH interface)
Change in 2 steps:
- Set ETH2 to 189.23.2.1 ( Something random but not in the range of the ETH3 is currently in)
- Set ETH3 to 192.168.1.1
When you PING from your PC you should see that only temporary the connection is lost and then the reply should be back.
like i said the switch is working fine and i have ping . the problem is with the OPC UA which for some reason does not reconnect after the change ( no meter what i do except for PLC restart)
yes something like what you describe.
you can see in the image i attached it is not reconnecting.
Just a wild guess:
In which “mode” are you connecting? Do you have any “security” enabled / enforced?
To my knowledge the OPC-UA server generates certificates for a secure connection - which includes the IP … so if you change the IP, the certificates becomes invalid and UAExpert would refuse to connect … The message BadCommunicationError while OpenSecureChannel could point in that direction, too.
CHH
I guess in UaExpert you have to manually reset the connection.
Like already mentioned, I do believe there is a unique fingerprint of each interface connected to the server certificate, which you have to accept.
For the PLC you can use an automatic detection of loss of network to initiate a UA_Disconnect followed by an immediate UA_Connect.
i do not change the IP address , i just alternate between the physical ports, so initially the ETH port has the correct IP, and if a disconnection is seen then i switch the IP between the ports so now the PLK port has the correct IP.
how can i reset the connection from Unexpert?
UA disconnect and UA connect are client functions, if i connect to PLC then maybe it is possible but if i go directly to SCADA system i am not sure this is possible.
currently no security features, in the future i will need to implement security also.
any more ideas? this is not working for me.
Hi,
which Automation Studio and Automation Runtime versions do you use? In what cycle time your code is running?
I’m asking because I made a small test, and I can’t reproduce the behavior described.
Of course, I’m not even near to your setup:
Unfortunately I haven’t a X90 controller, so I made my test with a X20CP3585, and I used AS 4.12 and AR M4.93 (there’s no special reason behind why I used those versions, those were the versions already available directly in my test project setup).
What I tried:
- configured 2 IP adresses out of different subnets (on IF2: 192.168.168.90/24, on IF3.ETH: 192.168.178.90/24, where the network 192.168.168.0/24 is reachable via my notebooks configuration, while all other 192.168.x.0/24 aren’t)
- connected both interfaces permanently to my switch (a TP-link desktop switch, nothing special)
- made some test code that follows this switching process:
- set IF2 interface to a temporary 3rd IP address (in my test: 192.168.0.1/24)
- set IF3 to the IF2’s origin IP address
- set IF2 to the IF3’s origin IP address
- … and having a OPC UA connection running in parallel the whole time (with worst possible security settings → anonymous access allowed, no security at all … I don’t wanted to disturb the core test)
And, after some breakdown of ANSL and also OPCUA communication while switching the IP addresses (what was expectable), the OPC UA connection came back automatically… re-establishing the OPC UA link took some seconds more then with ANSL, but both connections were up and running without any further action from my side.
Here’s a video where I switch the IP addresses like described above, and doing also a switch-back (videos aren’t directly supported by the forum software, so I have to upload it as zip → contains a mp4 video of the switching process).
Video:
SwitchIpTest.zip (9.8 MB)
And here’s my very ugly test code - ugly, because of just copy&pasting 6 times the same function block call with just changing 2 parameters … this is no good programming at all, that’s clear, but enough for doing a quick test I think
AS4 task:
SwtchIps.zip (1.8 KB)
As additional information, he’re 2 screenshots of my 2 interface settings in the project:
Of course I’m not sure if some of this information is useful, but it confirms that it should be possible… at least in general, maybe some more testing is needed using the same AS / AR versions, making some network traces with wireshark (to see what happens on the network level), knowing more details about your network setup (are routers involved, or smart switches, are things changing if unplugging the cables and re-plug them) and so on.
Nevertheless I hope it helps a bit.
Best regards!
Thank you for your answer, I already found the problem today, it was the order of the switching according to the way I am going if2->if3 of if3 ->if2. Thank you again for the detail solution I will go over it maybe it will give me new information.