How to check Ethernet Configuration
Setup your Raspberry PLC Ethernet network
6 May, 2021 by
How to check Ethernet Configuration
Boot & Work Corp. S.L., Fernandez Queralt Martinez


Introduction - The Raspberry Ethernet Ports


The industrial Raspberry PLC has two Ethernet ports, eth1 and eth0. The Ethernet port controller is based on W5500 IC and generates the eth1 interface, while the eth0 interface is automatically generated by the Raspberry Pi 4.

In the Raspberry Pi PLC family devices, W5500 IC communicates by the Raspberry Pi 4. In the industrial Raspberry Pi PLC family devices, W5500 IC communicates with the Raspberry Pi 4 via SPI1 bus.

By default, we have a virtual interface with the IP address 10.10.10.20 called eth0:1. Likewise, the eth1 has a virtual interface called eth1:1 with the IP address 10.10.11.20.

In case your Raspberry Pi industrial PLC has some Ethernet troubles, check out the following post.

Raspberry Pi PLC

Related links

How to connect Raspberry PLC to Wi-Fi


Read >>

Basics about Raspberry Pi PLC analog outputs


Read >>

How to find your perfect industrial PLC


Read >>

How to program Raspberry PLC interrupt inputs with Python


Read >>

Raspberry PLC
family products


Read >>

TouchBerry Pi
family products


Read >>

Setup Ethernet Connection - Connecting the Raspberry PLC

 Setup a static IP address in your laptop

In case you cannot connect to your Raspberry Pi based PLC family devices through any Ethernet port, let's do some configurations first:

1. First of all, you have to make sure that you have setup a right static Ethernet IP address which is in the same network as the Raspberry PLC . See how in https://www.industrialshields.com/es_ES/blog/arduino-industrial-1/post/como-cambiar-la-ip-en-windows-y-linux-242

Example: 10.10.10.60 <---- To connect through Raspberry PLC eth0 interface
         10.10.11.60 <---- To connect through Raspberry PLC eth1 interface


2. Connect an Ethernet cable between your laptop and the open source PLC Raspberry Pi, open up a terminal windows in your laptop, and try again :

If the cable is in the eth0 port, then:

ping -c4 10.10.10.20

If the cable is in the eth1 port, then:

ping -c4 10.10.11.20

Raspberry Pi Ethernet Ping


If you got 0% packet loss. You are ready to connect to your Ethernet port through SSH using either one commands below:

ssh pi@10.10.10.20 <--- Eth0
ssh pi@10.10.11.20 <--- Eth1

If you got any other messages from the ping command, let's continue!


 Access through HDMI cable

In case you could not access through SSH, shutdown your Raspberry Pi PLC controller, connect an HDMI cable to a screen, and power it on again. Let's try some options to fix your issues:

The Raspberry PLC credentials are:

user: pi
password: raspberry


3. Open the config.txt file in the boot directory:

sudo nano /boot/config.txt


and check out that there is this configuration for the Ethernet 1:

dtparam=spi=on
dtoverlay=w5500,cs=1,int_pin=6

If you already have the right configuration, exit with Ctrl + X. Otherwise, type the configuration above, reboot with the command below, and try to ping again from a specific interface.

sudo reboot
ping -c4 -I <interface name> 8.8.8.8


4. Go to the interfaces files with the following commands below, and check out that you have the following configuration:

- Interface eth0:

cat /etc/network/interfaces.d/eth0_1

auto eth0:1
allow-hotplug eth0:1
iface eth0:1 inet static
        address 10.10.10.20
        netmask 255.255.255.0
        gateway 10.10.10.1


- Interface eth1:

cat /etc/network/interfaces.d/eth1_1
auto eth1:1
allow-hotplug eth1:1
iface eth1:1 inet static
        address 10.10.11.20
        netmask 255.255.255.0
        gateway 10.10.10.1

You should not edit these files to make sure you can always connect through these IPs. However, if they are not as shown above, set the right configurations and edit the files with the nano editor:

sudo nano /etc/network/interfaces.d/<interface name>

In case you changed something from these files, restart the networking service typing:

sudo systemctl restart networking.service


5. If you still have no connection to the Ethernet port, see the routing table and check out that the following configuration is as shown:

route -n

Raspberry Pi Ethernet Routing Table

If it is not as it should, use "route add" or "route del", to set the right configuration. See how: https://man7.org/linux/man-pages/man8/route.8.html


6. To check out the dhcp configuration and set a static IP, go the next directory /etc/dhcpcd.conf with the following command:

sudo nano /etc/dhcpcd.conf

 Find out the following lines:

Raspberry Pi Static DHCP Configuration


Copy the lines, paste them below and uncomment them to set your static IP address:

For example:

interface eth0
static ip_address=192.168.1.40/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1



How to check Ethernet Configuration
Boot & Work Corp. S.L., Fernandez Queralt Martinez
6 May, 2021
Share this post
Archive

Looking for your ideal PLC?

Take a look at this product comparison with other industrial controllers Arduino-based.

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>

Do you want more information?

Just fill the form!

Tell me more!