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 |
# 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 1.1.1.1
[zeoip0]
id=1
dst=1.1.1.1 |
[zeoip0]
id=1
dst=1.1.1.1
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 |
# /usr/local/bin/eoip /etc/eoip.cfg
Add IP address to your eoip interface
# /sbin/ifconfig zeoip0 10.254.254.2 netmask 255.255.255.252 up |
# /sbin/ifconfig zeoip0 10.254.254.2 netmask 255.255.255.252 up
And optionally add routes (if you have any)
# route add -net 10.2.0.0/16 gw 10.254.254.1 |
# route add -net 10.2.0.0/16 gw 10.254.254.1
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:10.254.254.2 Bcast:10.254.254.3 Mask:255.255.255.252
inet6 addr: fe80::5425:d9ff:fe80:6b79/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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 |
# ifconfig
zeoip0 Link encap:Ethernet HWaddr 5B:25:C9:44:6A:79
inet addr:10.254.254.2 Bcast:10.254.254.3 Mask:255.255.255.252
inet6 addr: fe80::5425:d9ff:fe80:6b79/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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.