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.
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
If you got 0% packet loss. You are ready to connect to your Ethernet port through SSH using either one commands below:
ssh email@example.com <--- Eth0
ssh firstname.lastname@example.org <--- 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:
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:
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.
ping -c4 -I <interface name> 220.127.116.11
4. Go to the interfaces files with the following commands below, and check out that you have the following configuration:
- Interface eth0:
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:
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:
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:
Copy the lines, paste them below and uncomment them to set your static IP address: