EoIP tunnel on Linux

Ethernet over IP (EoIP) Tunneling is a MikroTik RouterOS protocol (stateless and light ethernet point to point tunnel protocol with 28 bytes static overhead) that creates an Ethernet tunnel between two routers on top of an IP connection. The EoIP tunnel may run over IPIP tunnel, PPTP tunnel or any other connection capable of transporting IP.

To connect Linux with Mikrotik over EoIP tunnel, you’ll need THIS.

The install procedure:

# wget http://www.serveradminblog.com/wp-content/uploads/2016/03/linux-eoip-0.5.tar.gz
# tar -xvzf linux-eoip-0.5.tar.gz
# cd linux-eoip-0.5
# ./configure
# make
# make install

Copy eoip.cfg to /etc dir, change settings inside according to your needs and save the file. If you use dynamic=1 option, take attention that there is no authorization,
and it is not secure. It is not good idea to use this feature with public ip or insecure(not completely under your control, each host) network.

For not lets suppose you need only one tunnel to remote IP address


On Mikrotik create EoIP tunnel with the same ID (1) and set your server’s IP address as remote IP.  Run eoio with

# /usr/local/bin/eoip /etc/eoip.cfg

Add IP address to your eoip interface

# /sbin/ifconfig zeoip0 netmask up

And optionally add routes (if you have any)

# route add -net gw

Add the last few lines inside rc.local to enable tunnel after reboot. The eoip interface can be threaten just like any other interface.

# ifconfig
zeoip0    Link encap:Ethernet  HWaddr 5B:25:C9:44:6A:79  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::5425:d9ff:fe80:6b79/64 Scope:Link
          RX packets:167397 errors:0 dropped:0 overruns:0 frame:0
          TX packets:138861 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:14934574 (14.2 MiB)  TX bytes:12520192 (11.9 MiB)
# ps ax|grep dhcp
5180 ?        Ss     0:02 /usr/sbin/dhcpd eth1 zeoip0
27356 pts/1    S+     0:00 grep dhcp

As you can see, you can run dhcp server on eoip interface. Just open /etc/sysconfig/dhcpd and add DHCPDARGS=”eth1 zeoip0″ inside. Save the file and restart dhcp server.

17 thoughts on “EoIP tunnel on Linux

  1. great post Marinko , however i cant get it to work, n oerrors.

    # /usr/local/bin/eoip /etc/eoip.cfg i use that command and get (removed ip addresses, the command does not return to the shell but i push enter and i get my shell back, is that normal?)

    Creating tunnel: zeoip0 num 0
    Destination for zeoip0: XXXXXXXXX
    [root@wiwan60 ~]# RX thread set to cpu 0
    TX thread(ID 1) set to cpu 1

  2. @dave

    No it is not normal. Do you have zeoip0 after you enter ifconfig ?

    remove permanently of just temp. ?

  3. # /usr/local/bin/eoip /etc/eoip.cfg
    Creating tunnel: zeoip0 num 0
    Destination for zeoip0: *.*.*.*
    ioctl-1: Device or resource busy

  4. I have the next error: Affinity error 22 RX thread set to cpu 0. OS: CentOS 7.0 x86_64 What am I doing wrong?

  5. Thank you for a great post Marinko. I have used it to add EOIP tunnel on OpenWRT router. Best regards and keep up with the good stuff.

  6. First, the location of the file changed to https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/linux-eoip/linux-eoip-0.5.tgz
    so maybe you can update it.

    Second, on what distro is this tested to work? I’ve tried Ubuntu 14.04 32 and 64 bit, Centos 5 32 bit – ./configure fails with an error: “Invalid configuration `i686-pc-linux-‘: machine `i686-pc-linux’ not recognized”.

    On the “issues” page of the linux-eoip project says that could be fixed by running “Try to run bootstrap.sh first”, but that produces following:
    “./bootstrap.sh: line 10: aclocal: command not found”

    any thoughts?

  7. Hi…
    Thanks for note about the link. The latest version is now available on my server.

    On servers I’m using CentOS 6 (64bit) or CentOS 7 and I didn’t notice any problems you mentioned.
    On desktop I’m using Mint 17.3 64bit (which is based on Ubuntu 14.04.x) and the steps shown above works fine.

    For aclocal problem, try to install automake and try again
    # sudo apt-get install automake (on Ubuntu)
    # yum install automake (on RH based distros)

  8. In case anyone has the same issue as dave in the first comment, I resolved it by changing the source code and recompiling.

    When I run /usr/local/bin/eoip it wouldn’t exit unless I pressed enter. That messed up any custom scripting I tried to do to automate the process of bringing up the tunnels.

    I edited eoip.c and changed line 427 from
    ret = daemon(1, 1);
    ret = daemon(0, 0);

    Then I run make clean && make && make install
    and now the eoip drops properly to background without any user interaction.

    I hope this helps someone to avoid scratching their heads trying to figure this one out 🙂

  9. Hi
    I set it up but after running I got error “Affinity error 22”
    please help me what is this error and how can I resolve it?


Leave a Reply

Your email address will not be published. Required fields are marked *