Skip to main content

Enable Passive Mode on FTP Server

info

DeviceOn FTP default setting is active mode. However, FTP runs active mode may fail in cases where the server is behind a router or the server deplyed on Azure/AWS or other cloud's virtual machine. And that will cause DeviceOn initialize failure. To solve this issue, you should change FTP server to passive mode.

Step 1: Edit Configuration File

Open the ftpd-typical.xml on text editor tool that located in

(Windows)
\DeviceOn Path\ftp\res\conf\

(Ubuntu)
/opt/advantech/deviceon/etc/ftpd/

Add the following XML attribute <data-connection> into <nio-listener> and give your passive ports range and external address.

<server >
<listeners>
<nio-listener>
<data-connection idle-timeout="60">
<passive ports="60001-60100" external-address="<YOUR_EXTERNAL_ADDR>" address="0.0.0.0" />
</data-connection>
...
</nio-listener>
...
</listeners>
...
</server>

"60001-60100" means in passive mode, ftp client uses port 60001 to 60100 to transfer data. You could change it to any available ports range. "YOUR_EXTERNAL_ADDR" means in passive mode, ftp client's destination domain name or IP address (domain name recommended). Replace this with a valid domain name or IP address that is accessible from external networks.

Step 2: Restart FTP Service

Restart FTP service to apply setting.

  • Windows

    Stop and start the "FTP Service" via ServerControl tool (in system tray).

  • Ubuntu
    sudo systemctl restart deviceon-ftpd.service

Step 3: Add inbound security rules

Add inbound security rules on your network security group (ex, Azure Network Security Groups and Firewall Rules), make sure blow ports are available.

  • 2121 (command port)
  • 60001-60100 (Passive port)

Step 4: Restart Main Service

Restart DeviceOn service

  • Windows

    stop and start the "Management Service" via ServerControl tool (in system tray).

  • Ubuntu
    sudo systemctl restart deviceon-worker.service
    sudo systemctl restart deviceon-provisioning.service