What/why this event happens: Can't write to Linux tun/tap device (tun mode) /dev/net/tun: Input/output error

Guus Sliepen guus at tinc-vpn.org
Fri May 26 12:03:49 CEST 2017


On Fri, May 26, 2017 at 09:30:44AM +0800, Bright Zhao wrote:

> Due to some routing rotation purpose, I use crontab to add below info:
> 
> 0 * * * * echo Subnet = 54.169.128.0/17 >> /etc/tinc/myvpn/hosts/aws_sgp
> 0 * * * * echo Subnet = 54.169.0.0/17 >> /etc/tinc/myvpn/hosts/aws_sgp
> 1 * * * * /usr/sbin/tincd -n myvpn -k
> 1 * * * * /usr/sbin/tincd -n myvpn --debug=3
> 
> 30 * * * * sed -i '/54.169.128.0\/17/d' /etc/tinc/myvpn/hosts/aws_sgp
> 30 * * * * sed -i '/54.169.0.0\/17/d' /etc/tinc/myvpn/hosts/aws_sgp
> 31 * * * * /usr/sbin/tincd -n myvpn -k
> 31 * * * * /usr/sbin/tincd -n myvpn --debug=3

This is not the right way to do it. Cronjobs are being run in parallel.
So if you both stop and start tinc at the same time, there is no
guarantee that it will happen in the right order. The easiest way is to
create two scripts, one that adds the Subnets and the other that removes
them, and the other that adds them.

Another issue is that with tinc 1.0, the -k option sends a TERM signal
to the running tinc daemon, but it might take a little time before it
actually stops. So add a sleep command inbetween, or check for
/var/run/tinc.myvpn.pid to disappear.

-- 
Met vriendelijke groet / with kind regards,
     Guus Sliepen <guus at tinc-vpn.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.tinc-vpn.org/pipermail/tinc/attachments/20170526/5e388849/attachment.sig>


More information about the tinc mailing list