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.
# wget --no-check-certificate https://linux-eoip.googlecode.com/files/linux-eoip-0.5.tgz
# tar zxvf linux-eoip-0.5.tgz
# cd linux-eoip-0.5
# 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 220.127.116.11
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 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
Add the last few lines inside rc.local to enable tunnel after reboot. The eoip interface can be threaten just like any other interface.
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
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.
Posted in Linux, Server project, Tips & Tricks.
– January 28, 2014
This year started very nice for us…
It seems that Red Hat will try to fight vs Oracle Unbreakable Linux which is very similar to CentOS project. According to press release:
- Red Hat Enterprise Linux will remain the same (for commercial development and deployment),
- CentOS provides a base for community adoption and integration of open source technologies on a Red Hat-based platform (community integration beyond the operating system)
- Fedora will continue to serve as the upstream project on which future Red Hat Enterprise Linux releases are based (mostly untested software for testing and home use).
More info can be found HERE
Posted in CentOS, RedHat.
– January 7, 2014
If you’re migrating from MyISAM to InnoDB or you’re using MySQL 5.5.x or newer (InnoDB default engine) you’ll probably be disappointed with INSERT/UPDATE queries (with InnoDB tables). InnoDB is a transaction-safe, ACID compliant MySQL storage engine and with default settings, the log buffer is written out to the log file at each transaction commit and the flush to disk operation is performed on the log file. This can be very slow (but very safe – every transaction is 100% written to the disk).
Since MyISAM is not an option, we need to tune up our server so it can be used with InnoDB correctly. According to MySQL site, the next couple things should be considered:
- Use OPTIMIZE TABLE statement to reorganize the table and compact any wasted space. Of course this operation won’t help if your database is empty
- Use AUTO_INCREMENT column as the primary key
- If you’re storing variable-length strings or if the column may contain NULL values, use the VARCHAR data type instead of CHAR (smaller tables fit better in the buffer pool and reduce disk I/O)
- Since InnoDB must flush the log to disk at each transaction commit (if that transaction made modifications to the database), attach several queries into a single transaction to reduce the number of flush operations
- In case you’re not building a finance application which can’t afford data loss if a crash occurs, you can set the parameter innodb_flush_log_at_trx_commit parameter to 0. In this case, InnoDB tries to flush the log once per second and not after every transaction (default setting is 1 which mean flush the log after every transaction).
- To reduce the amount of disk I/O used by queries to access InnoDB tables, you can increase the innodb_buffer_pool_size.
- Big disk-bound operations are always expensive. Use DROP TABLE and CREATE TABLE to empty a table, not DELETE FROM….Also TRUNCATE TABLE is much faster then DELETE * FROM…
- innodb_flush_method parameter can also help but you must test yourself to see the right combination for your hardware and your database (possible values: fdatasync, O_DSYNC, O_DIRECT).
- Make your log files big, even as big as the buffer pool and make the log buffer quite large as well
- Disable autocommit during import operation (surround it with SET autocommit and COMMIT statements)
- Temporarily turning off the uniqueness checks during the import session will help.
- Turn off foreign key checks during imports.
- If you often have repeating queries for tables that are not updated frequently, enable the query cache with
query_cache_type = 1
query_cache_size = 10M
- Use the multiple-row INSERT syntax to reduce communication overhead between the client and the server if you need to insert many rows:
INSERT INTO tbl VALUES (1,2), (5,5), ...;
The list above is not the final one. Please check the next link for more details about those parameters. Link
In my case, I won’t change a lot of parameters. The only parameter which I will change is the innodb_flush_log_at_trx_commit = 1.
Before and after performance will be tested with Sysbench (Link). Since reading is not problem right now, I’ll stick with the write operations.
sysbench --num-threads=16 --max-requests=10000 --test=oltp --oltp-table-size=500000 --mysql-socket=/var/lib/mysql/mysql.sock --oltp-test-mode=complex --mysql-user=TEST_USER --mysql-password=TEST_PASSWORD run
OLTP test statistics:
transactions: 10002 (181.90 per sec.)
deadlocks: 442 (8.04 per sec.)
read/write requests: 198436 (3608.90 per sec.)
other operations: 20446 (371.85 per sec.)
Test execution summary:
total time: 54.9852s
total number of events: 10002
total time taken by event execution: 879.1034
approx. 95 percentile: 135.31ms
events (avg/stddev): 625.1250/2.29
execution time (avg/stddev): 54.9440/0.03
Total time: 54.98s
Now, when I change innodb_flush_log_at_trx_commit to 1, I get:
OLTP test statistics:
transactions: 10000 (780.35 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 190000 (14826.69 per sec.)
other operations: 20000 (1560.70 per sec.)
Test execution summary:
total time: 12.8147s
total number of events: 10000
total time taken by event execution: 204.8297
approx. 95 percentile: 44.50ms
events (avg/stddev): 625.0000/19.56
execution time (avg/stddev): 12.8019/0.00
Total time: 12.81s
As you can see, changing innodb_flush_log_at_trx_commit from 0 to 1 increases the write speed but we can lose data in some cases (hardware or power failures, etc). To avoid this problem, use battery backups, UPS, RAID, …
Posted in CentOS, MySQL.
– January 3, 2014
Q. How do I reboot my Linux system?
To reboot your Linux server, you can use commands “reboot” or “shutdown -r now”. For Debian based distros, you must use sudo (in case you’re not logged in as root).
Also, reboot process can be “snoozed” for X minutes with “shutdown -r +X” where X is number of minutes before the reboot happens.
Q. Can I solve problem with simple reboot?
Mostly NO !
In normal working conditions, Linux doesn’t require reboot and rebooting without detailed inspection probably won’t help. The right step to fix something is to check logs, inspect traffic to and from server, check firewall, ping this, traceroute, etc etc.
Rebooting without particularly reason is so Windows.
Posted in Other.
– December 21, 2013
If you’re using MySQL and you prefer yum and rpm, Oracle announced availability of Yum repositories for MySQL database and related products. Initial release is focused on EL6-based distros as well as Fedora 18 and 19 for:
- MySQL Database 5.6
- MySQL Workbench 6.0
- MySQL Connector/ODBC 5.2
For more info, check http://insidemysql.com/announcing-new-yum-repositories-for-mysql/
Posted in MySQL, Other.
– November 19, 2013
The best way to help open source is to donate money… If you’re FreeBSD fun or you just want to help, please donate - http://www.freebsdfoundation.org/donate
Posted in Other.
– November 17, 2013
Image made by Karanbir Singh (https://twitter.com/kbsingh)
Posted in CentOS, Linux.
– November 11, 2013
I suppose you have a couple of clients who believes in Teamviewer only. Teamviewer on Linux works fine but after you install it, you’ll be supprised that the proces is always running in the background (it is build to respawn) which is ok if you’re the client who needs help. The first thing which average sys admin will do is to shut down teamviewer.
To stop teamviewer you can use:
initctl stop teamviewerd
To disable teamviewer on system startup you can use:
teamviewer --daemon disable
More info about the deamon you can find with:
boss init.d # teamviewer --help
teamviewer start TeamViewer user interface (if not running)
teamviewer --help print this help screen
teamviewer --version print version information
teamviewer --info print version, status, id
teamviewer --passwd [PASSWD] set a password (useful when installing remote (ssh)
teamviewer --ziplog create a zip containing all teamviewer logs (useful when contacting support)
teamviewer --daemon status show current status of the TeamViewer daemon
teamviewer --daemon start start TeamViewer daemon
teamviewer --daemon stop stop TeamViewer daemon
teamviewer --daemon restart stop/start TeamViewer daemon
teamviewer --daemon disable disable TeamViewer daemon - don't start daemon on system startup
teamviewer --daemon enable enable TeamViewer daemon - start daemon on system startup (default)
Posted in Other, Tips & Tricks.
– October 21, 2013
I would like to annouce a 2013. winner in “Bugs per line of code 2013.” contest.
Pleeeease welcome – MySQL Workbench
Posted in Other.
– July 26, 2013
If you’re using PHP 5.2.x on RHEL/CentoOS and you received error
PHP Fatal error: Call to undefined function sqlite_escape_string()
don’t worry. The reason for this is the missing sqlite extension which is not included in RHEL/Fedora/CentOS php packages by default.
To fix this issue, you can include it manually
tar xzvf php-5.2.XX.tar.gz
echo extension=sqlite.so >> /etc/php.d/sqlite.ini
service httpd restart
Replace XX with your PHP version (check the php version with “php -v”)
Posted in CentOS, PHP, Tips & Tricks.
– July 19, 2013