How to: Set up Syncthing/Pulse on a Chromebook Through Crouton

I spent quite a few hours getting Syncthing/Pulse to work on my Chromebok with Ubuntu 14.04 through crouton. I thought I would share how I got syncthing to work and if there is a better way please let me know.

The biggest problem I had was working around ChromeOS’s built in firewall. This required modifing some IPtable rules. That is something I have never done before but I think I finally found a way to let Syncthing work without completely exposing myself to everything.

I started out with the crouton documentation on setting up an SSH server here and figured out the rest through google and trail and error.

Install what we need

sudo apt-get install iptables
sudo apt-get install nano

Edit the file that will set up our firewall rules when crouton is launched

sudo nano -w /etc/rc.local

Now you will want to add the following lines to the file

/sbin/iptables -I INPUT -p tcp --dport 22000 -j ACCEPT
/sbin/iptables -I INPUT -p udp --dport 21026 -j ACCEPT

Press control-o to save and control-x to exit

Now when you launch syncthing it probablly still won’t work. Apparently more ports are needed than listed in the port forwarding documentation

With this set up I was able to get syncthing to work sometimes but it was not consistent. So I had to pull out the nuclear option.

Edit rc.local again

sudo nano -w /etc/rc.local

Add the following lines

/sbin/iptables -A INPUT -s 192.168.1.x -j ACCEPT
/sbin/iptables -A OUTPUT -s 192.168.1.x -j ACCEPT
/sbin/iptables -A FORWARD -s 192.168.1.x -j ACCEPT

replacing 192.168.1.x with the IP adress of the other machine running syncthing

Even with all this the automatic discovery still did not work all that well so you need launch syncthing and click on the device (node?) you are trying to connect to and change the Addresses from “dynamic” to “192.168.1.x” (Whatever the actual IP of that device is)

Syncthing should now connect reliablly and quickly between your chromebook and the other syncthing machine.

Please note that I am not an expert at this stuff, there may be a better way to do this or some of the steps might be redundent but this is how I got synchting working on my chrombook (Acer C720) and I thought I would share.

I got this to work without doing a complete dropping of shields. The trick was to monkey with the firewall before even starting crouton. To do that:

Get into the full shell in Chrome OS, then:

sudo vi /usr/local/bin/startxfce4

Then, before the line that begins “exec sh -e”, add the two lines given in the post above (except that the port for the second one should be 21025):

/sbin/iptables -I INPUT -p tcp --dport 22000 -j ACCEPT
/sbin/iptables -I INPUT -p udp --dport 21025 -j ACCEPT

Save and exit.

1 Like