Skip to content

Commit 37ed7a7

Browse files
author
Bernard `Guyzmo` Pratz
committed
added article about mobility
1 parent 142e014 commit 37ed7a7

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-0
lines changed
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
type: post
3+
categories: hack
4+
tags: [ linux, tinc, setup, laptop, workstation, ssh ]
5+
title: "How I achieve full mobility with simple linux tools"
6+
date: 2017-03-24T23:12:14+01:00
7+
summary: "Over the years, I've tried many ways to make it possible to switch between my
8+
laptop and my workstation in the most seamless way possible. After the break, I'll share
9+
my mobile epiphany…"
10+
lang: english
11+
logo: "/img/syncthing.jpeg"
12+
header_background: /img/laptop_coffee.png
13+
tweet: 845061462817198080
14+
---
15+
16+
I spent most of my life doing *stuff* with computers. Originally, I was only working
17+
on static workstations, and as I grew up, I had my hands on a few crappy laptops. Then
18+
I've bought my first mac (about 12 years ago, and it was a powerbook) and stuck with
19+
Apple.
20+
21+
But I never abondonned using a workstation. Because it's where I can store a
22+
lot of data (because terabytes are cheap!), which I can connect to from anywhere in
23+
the world, on which I got my mechanical keyboard connected, got 22 USB inputs, have
24+
got some hifi speakers on etc.
25+
26+
# The frustration
27+
28+
Though, I always had that frustration when starting a work on a device, I have to keep
29+
on working on that same device, because I won't be able to start over where I left at
30+
on the other device.
31+
32+
<center>
33+
![](/img/trollface_frustration.png)
34+
</center>
35+
36+
The issue here, is that keeping my work in sync between two devices is tough, and does
37+
not work well, and I gave many shots at that. There are a few good cloud based tools
38+
out there that might do the job. But I prefer to stay frustrated than use a tool that
39+
I cannot trust and stores my data in places I don't know.
40+
41+
So I tried many tools. I first used SVN to sync my home and my configuration, but ended
42+
up in a nightmare having my work SVN repositories mixed up with my home one… And years
43+
later when I upgraded to Git things did not go better on that side. So version control
44+
was not a good idea ☹
45+
46+
I then tried using rsync, the unix utility that can do whatever you want when it comes
47+
to syncing your files. I tried unison on top of that, but it fell too easily out of sync,
48+
I had a few conflicts, or with other parameters it was just too slow… In the end it
49+
was always too painful.
50+
51+
The following years, I tried bittorrent-sync (non-free, but not keeping your files)
52+
which lost me some files, a dual way configuration of lsyncd (which ended up in a weird
53+
file copy feedback loop), and even lurked at orifs, which is a great concept if only it
54+
worked!
55+
56+
But file syncing is not the only thing, there's also network configuration. Wherever
57+
I am, I want to be able to have my workstation↔laptop connections stay up and working.
58+
And I've tried many different VPNs that were working so-so, but were a nightmare to
59+
configure and keep in shape.
60+
61+
# The Solutions
62+
63+
Then in the recent months, I switched back from Apple laptops to a linux-based lenovo
64+
laptop. Doing so, I tried again to work a solution to have real mobility between my
65+
devices. And finally, there was an epiphany 🙌
66+
67+
## Private network
68+
69+
I have discovered [`tinc`][tinc] as advised by a good friend, and found out that it's
70+
the first time I got a tunnel that can be setup in a couple of minutes, while being
71+
relatively safe.
72+
The great thing of tinc is that it's supporting the full IP stack, including UDP.
73+
74+
To create a new network, you've got to create three files, generate a key and start
75+
the service:
76+
77+
``` bash
78+
% mkdir /etc/tinc/myprivatenetwork
79+
% cat > /etc/tinc/myprivatenetwork/tinc.conf
80+
Name = MyWorkstation
81+
ConnectTo = MyLaptop
82+
83+
% cat > /etc/tinc/myprivatenetwork/tinc-up
84+
#!/bin/sh
85+
86+
ip link set $INTERFACE up
87+
ip addr add 192.168.254.10/32 dev $INTERFACE
88+
ip route add 192.168.254.0/24 dev $INTERFACE
89+
90+
% cat > /etc/tinc/myprivatenetwork/tinc-down
91+
#!/bin/sh
92+
ip route del 192.168.42.0/24 dev $INTERFACE
93+
ip addr del 192.168.42.10/32 dev $INTERFACE
94+
ip link set $INTERFACE down
95+
96+
% tincd -n myprivatenetwork -K
97+
% sudo systemctl start tincd@myprivatenetwork
98+
```
99+
100+
Then when you're adding new hosts to the network, you need to copy the public
101+
key of that host in `/etc/tinc/myprivatenetwork/hosts` of your other hosts.
102+
103+
And you're set!
104+
105+
Then, everytime I restart or get my laptop out of sleep, I have my connections
106+
to my workstation back on, and I can keep working seamlessly. I can also switch
107+
from wifi to the network cable at home, without having to restart synergy or other
108+
local network apps!
109+
110+
[tinc]:http://tinc-vpn.org
111+
112+
## File syncing
113+
114+
I have found greatness in a tool called [syncthing]. It's packaged on all the
115+
distributions, and has been designed to be the bittorrent-sync (and dropbox)
116+
killer. And I have to admit, not only it is FLOSS, but it definitely sets a new
117+
standard in syncing files. I've been using it for a few months, and I almost
118+
feel like I'm having the same drive shared on NFS on both computers — without
119+
the slow.
120+
121+
Once installed, syncthing comes with a WebUI, though a GTK app also exists. You
122+
need to pair your computers together, sets up the volumes you want to share, and
123+
start sharing. From then on, you just forget about it, it'll do the job.
124+
125+
As a side effect, I'm also having my work (as it is) being duplicated between two
126+
storing units (laptop and workstation), making it a great real time backup helping
127+
me to never loose any minute of my work even when if I break my laptop. If you add
128+
a duplicity backup of my work onto another storage drive, my work is pretty safe!
129+
130+
[syncthing]:https://syncthing.net/
131+
132+
## Working over slow connections
133+
134+
I'm an heavy IRC user, and I still read my mail in the shell, on an SSH connection.
135+
But as I also have been taking the train a lot, I've started to use [mosh] to make
136+
it friendly to work on very slow connections.
137+
138+
Though, because of it's heavy use of UDP ports (and it's coded in [Perl 🔥](https://youtu.be/yp_l5ntikaU?t=59)), I prefer
139+
to keep the session opened inside tinc!
140+
141+
[mosh]:http://mosh.org
142+
143+
# Finally…
144+
145+
…I'm happy with my new setup, and even though I know I can do better (like syncing my mails
146+
between my laptop and my workstation, but that's for another article), it's doing a great
147+
job at optimising my productivity and keep my mind at rest in terms of backup.
148+
149+
What are your solutions to keep your data in sync? And your network connections?
150+

static/img/laptop_coffee.png

572 KB
Loading

static/img/syncthing.jpeg

10.7 KB
Loading
36.9 KB
Loading

0 commit comments

Comments
 (0)