Enable port

Enable port 1:

Automatic port enabling for TwinCAT Functions

Ports that are required for TwinCAT Functions are automatically enabled once the TwinCAT Functions have been installed.

This step shows how to enable a TCP port. As an example, an incoming connection is created for TCP port 502, which is required for Modbus/TCP communication.

Enable a port as follows:

1. Enter the command doas ee /etc/pf.conf on the console.
The pf.conf configuration file is opened.
2. Create the pass in quick proto tcp to port 502 keep state rule to enable TCP port 502.
3. Press [Esc] and save the changes.
4. Enter the command doas pfctl -f /etc/pf.conf to reload the rules. The firewall must be activated for this.
You have successfully enabled a port. Use the command doas pfctl -f /etc/pf.conf to enable the rules immediately. Otherwise, the rule takes effect after the next firewall restart.