EtherCat/README.md

1.5 KiB

|\        /|
| \______/ |
| ,,,,,,,, |
| |||||||| |
| |||||||| |
| ¯¯¯¯¯¯¯¯ |
|__________|
  \-    -/

EtherCat

A simple tool written in C that connects a Linux tap interface to stdin and stdout

How to build

  • Prerequisites: Linux, C compiler
    • Might be easily portable to other systems that support tap interfaces, Idk.
  • Run ./build.sh
  • Install by copying to /usr/local/bin or just leave it where it is

How to use

Run as root:

ip tuntap add mode tap user USERNAME group GROUPNAME name tapN
ip link set tapN up

Run as user: ethercat tapN

Simple network tunnel:

Be warned: This will behave as if you had both sides connected with a (slow and less reliable) cable. This is more of a bridge than a regular VPN. If you bridge both sides to a real NIC and you have DHCP servers on both networks, you will end up with two DHCP servers on the same network.

  • Set up a bridge between a physical NIC and the tap interface on one or both sides
  • Connect a port between the hosts, for example using SSH port forwarding
  • Make two FIFOs on both hosts (mkfifo)
  • Use netcat to connect the FIFOs between the hosts through the forwarded port
    • nc -l 10000 < fifo1 > fifo2 (with some implementations apparently nc -l -p ... -_- )
    • nc localhost 10000 < fifo1 > fifo2
  • Start an instance of EtherCat with the other ends of the FIFOs on both hosts
    • ./ethercat tapN < fifo2 > fifo1

Copyright 2025 Interzero Product Cycle GmbH, see LICENSE.md