How To Find Your B&R PLC in a network with Python

Hello community,

There are often reports in the community of problems finding a B&R PLC in the network to connect with AS.

Unfortunately, for security reasons, searching via AS Online Settings (SNMP) and Ping (ICMP) is also becoming increasingly difficult.

There are already several posts dedicated to this topic:

I would like to add another (rather nerdy) option, provided that PVI (also required for AS) and Python are installed.

Nerdy because you have to use the command line.

create an empty folder and change to it:

md findplc
cd findplc

To install external Python modules, it is always a good idea to use a ā€˜virtual environment’.

py -m venv venv
venv\Scripts\activate
py -m pip install --upgrade pip
pip install pvipy

if everything went fine you should be able to execute a scan command: Anslscan <network address>

where <network> is an IP4 network address specification.
For example, the following address specifications are equivalent: 192.168.1.0/24 and 192.168.1.0/255.255.255.0

e.g.

Anslscan 192.168.1.0/24

could output this

256 hosts were checked.
Target: 1A4000.00, AR: I4.93, IP:192.168.1.68, Status:RUN
Target: 1A4000.00, AR: V6.00, IP:192.168.188, Status:RUN
2 targets found

(As this command performs a port scan via a further IP address range, the system administrator may notice this unpleasantly.)

There are two more commands available:

Inascan <network address>

which works similar but is intended for old Automation Runtime < 4.X using INA2000 protocol.

and

Snmpscan

which uses PVI’s SNMP line.

If your sysadmin blocks you or if your PC goes up in flames don’t blame me.

Project Sources are hosted here.

15 Likes