Pyads connection from server to client over VPN

58 views Asked by At

I have been struggling for some days now with how to set up the connection from a server with a public IP to a Beckhoff PLC behind a Teltonika RUT955 over 4G with a public IP. I have made a VPN connection from the server to the Teltonika router and shared all the local machines behind the Teltonika router so that I can access the PLC from the server. If I do a ping from the server to the PLC I get a response and also if I do a ping from a laptop behind the Teltonika router back to the server I get a response. So I would guess I did something wrong with setting up the route in the Python script.

See below what I wrote in the Python script. (I have changed the IPs a bit so that not the whole world knows the IPs). The server has its own public static IP from the ISP.

Also good to know is that this Python script was working when both the server and Beckhoff PLC were in the same local network.

Python code:

    SENDER_AMS = '68.35.87.3.1.1'  # Server IP + 1.1 (This was 192.168.1.180)
    REMOTE_AMS = '192.168.1.100.1.1'  # PLC IP + 1.1 (This was 192.168.1.100.1.1)
    PLC_IP = '192.168.1.100'          # PLC IP same as above without 1.1
    PLC_USERNAME = 'Administrator'
    PLC_PASSWORD = '12345' #
    ROUTE_NAME = 'SERVER'     # Name of route created in Beckhoff
    HOSTNAME = '68.35.87.3'        # Server IP
    pyads.set_local_address(SENDER_AMS)

I am also a bit searching for what I need to fill in at the Add Route Dialog. Every time I try to fill in this window it gives me a different error. I think I don't need to add a new route because the Python script is doing this for me, or am I wrong in this? If I need to add the route how do I fill in this route window?

Beckhoff routes and route window

0

There are 0 answers