Ethernet_over_EtherCATΒΆ

EoE setup on a Raspberry Pi

// The Router, to access the internet or WAN is at 192.168.1.1
// Windows PC:
// Ethernet2 192.168.1.30 / 255.255.255.0 / 192.168.1.1
// with CMD-prompt run as administrator
// add a route so Windows knows to route packets through the raspberry

route add -p 172.16.1.0 mask 255.255.255.0 192.168.1.40

// Raspberry Pi:
// Runtime used was CODESYS Control for Raspberry Pi SL V4.0.0.0, EtherCat 3.5.16.40
// eth0 192.168.1.40 / 255.255.255.0 / 192.168.1.1
// tap0 172.16.1.1 / 255.255.255.0

// EtherCAT-Slave:
// Important that the "Standard-gateway" is the tap0 of the Raspberry Pi
// EoE settings: 172.16.1.20 / 255.255.255.0 / 172.16.1.1
// to add the tap0 to the raspberry, use the following commands:

sudo /sbin/ip tuntap add tap0 mode tap
sudo /sbin/ip link set tap0 up
sudo /sbin/ip addr add 172.16.1.1/24 dev tap0
sudo nano /etc/sysctl.conf

// add this line if it is not already there:

net.ipv4.ip_forward=1

// Save the file
// Reboot the pi, perhaps with

sudo reboot now

// Now to test it:
// from windows PC ping the Ethercat slave

ping 172.16.1.20