Start Tailscale from CLI

Hello, I need to start tailscale from cli in order to use the --login-server flag
Without this I can’t even use the printer (since needs to advise routes)

I disabled tailscale from GUI and started from cli but still do not manage :frowning: Is there a way to do this?
Thanks

no one? This is giving me so many problems, I can not even use the printer

What, specifically, does this mean? It implies that there is more information of relevance but that you did not share, as there would be nothing to disable if you had not already enabled it somewhere.

Again: What, specifically, did this mean? Starting Tailscale from the CLI is not a normal part of running it on GL.iNet’s customized version of OpenWRT, so it is not safe to assume that readers here know what you did when you state simply that you started Tailscale via its command line interface.

My guess based on the limited information you provided is that you have a mess of automatically- and manually-installed and run Tailscale, and that you will need to clean up before moving on to starting tailscale with a non-standard login server.

Try customizing the /etc/init.d/tailscale or the /usr/bin/gl_tailscale shell script with your login. You may have to fix the links to the new file in the /etc/rc.d directory afterwards.

Before modifying, make a backup of the original file first.

I do not work for and I am not directly associated with GL.iNet

1 Like

Thank you so so much, I did not have any experience with init.d, I will provide a list of what I did to add value to your helpful contribution

Since headscale needs machine registration that must be done beforehand through CLI

  1. start tailscaled daemon with /usr/sbin/tailscaled start
  2. on a side terminal (keeping the daemon one open) you can now execute /usr/sbin/tailscale up --login-server=https://headscale.hostname.tld

After the machine registration we can stop the daemon and edit the /usr/bin/gl_tailscale by scrolling down find
/usr/sbin/tailscale up --reset --accept-routes $param --timeout 3s > /dev/null

and change in to

/usr/sbin/tailscale up --reset --accept-routes --login-server=https://headscale.hostname.tld $param --timeout 3s > /dev/null

now is possible to just start tailscale from the GUI, all the sliders work as well (including exit node and exit node discovery)

is not needed to re-generate symlinks since we didnt touch /etc/init.d/tailscale

Thank you again for the init.d & gl-inet hints @wcs2228, I hope to have carried some value with the step by step solution

NOTE: this may be re-done each firmware upgrade, not tested yet but there are high chance (the process is quite easy and I would personally clear the settings after fw upgrade anyways)

NOTE2: since I needed to use the printer inside the tailnet remember obv. to accept the router’s routes (that is advising) from headscale CLI or wont work obv. To advise them you need to tick the access on LAN option from GL GUI

1 Like

UPDATE:

  • the GL gui allows to register a machine also with a different coordination server hence may not be needed to login beforehand through cli
  • sadly after an outage i discovered the router unbinded itself from the tailnet and needed another auth, I think for every reboot is needed to re-auth the router, let’s all remember is a travel one hence possibly is often unplugged/plugged back

Try adding your login commands in /etc/init.d/tailscale script, so that they are run on every reboot.

You may not have to fix the links in the /etc/rc.d directory because I think they are symbolic links, not hard links.