Skip to content

Commit

Permalink
Add some troubleshooting steps & link telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
anasfanani committed May 9, 2024
1 parent e5b4073 commit 5ee787a
Showing 1 changed file with 74 additions and 12 deletions.
86 changes: 74 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Github All Releases](https://img.shields.io/github/downloads/anasfanani/Magisk-Tailscaled/total.svg)]()
[![GitHub release](https://img.shields.io/github/release/anasfanani/Magisk-Tailscaled?include_prereleases=&sort=semver&color=blue)](https://github.com/anasfanani/Magisk-Tailscaled/releases/)
[![issues - Magisk-Tailscaled](https://img.shields.io/github/issues/anasfanani/Magisk-Tailscaled)](https://github.com/anasfanani/Magisk-Tailscaled/issues)
[![Static Badge](https://img.shields.io/badge/Discussion-Telegram-blue?style=flat&logo=telegram&link=t.me%2Fsystembinsh%2F158)](https://t.me/systembinsh/158)

# Magisk Tailscaled

Expand Down Expand Up @@ -37,20 +38,28 @@ After installation, the Tailscale daemon (`tailscaled`) will run automatically o

## Limitation

- This module only support for `arm` or `arm64` architecture, you can download manually.
- This module only support for `arm` or `arm64` architecture, you can download manually for other architecture.
- Tailscale binary is designed to run in Linux environment, Some feature might not works properly.
- MagicDNS currently not working.
- Runs in userspace mode, read more at [https://tailscale.com/kb/1112/userspace-networking](https://tailscale.com/kb/1112/userspace-networking)
- Subnet routes is manually routed with socks5-tun, you must define your own ip routes to `tailscaled.tun.up` and `tailscaled.tun.down`

## Usage
## Usage of this module

This module runs `tailscaled` with the following command:

```bash
tailscaled -tun=userspace-networking -statedir=/data/adb/tailscale/tmp/ -state=/data/adb/tailscale/tmp/tailscaled.state -socket=/data/adb/tailscale/tmp/tailscaled.sock -port=41641
```
This command uses a userspace network stack instead of the kernel's network stack, which can be useful on devices where the kernel's network stack is not compatible with Tailscale. The state file for tailscaled is stored at `/data/adb/tailscale/tmp/tailscaled.state`, and the log output is written to `/data/adb/tailscale/run/tailscaled.log`.
The state file for tailscaled is stored at `/data/adb/tailscale/tmp/tailscaled.state`, and the log output is written to `/data/adb/tailscale/run/tailscaled.log`.

## Available command

- `tailscale`: This command is execute tailscale operation.
- `tailscaled`: This command is execute tailscaled daemon operation.
- `tailscaled.service`: This command for manage tailscaled service, you can start,stop,restart daemon and view live logs the tailscaled operation.
- `tailscaled.tun`: This command is for manage hev-socks5-tunnel.

## Example of Using Tailscale

### SSH to Termux
Expand Down Expand Up @@ -79,13 +88,13 @@ Enter your password when prompted, for example, `123`.
3. Open the terminal & SSH to your Android IP:

```bash
ssh <random_user>@<tailscale_ip> -p 8022
ssh <root>@<tailscale_ip> -p 8022
```

For example:

```bash
ssh user@100.95.95.95 -p 8022
ssh root@100.95.95.95 -p 8022
```

### SSH access to your Android device
Expand Down Expand Up @@ -159,19 +168,69 @@ FLAGS

For more details about CLI commands, check out the [Tailscale CLI documentation](https://tailscale.com/kb/1080/cli#using-the-cli).

## Troubleshooting
## FAQ & Troubleshooting

Tailscale has some known issues. You can check them out [here](https://github.com/tailscale/tailscale/issues?q=no+safe+place+found+to+store+log+state).
Tailscale has manny issues. You can check them out [here](https://github.com/tailscale/tailscale/issues).

In order to execute any Tailscale command on the terminal, you must navigate to the directory `/data/adb/tailscale/tmp/` and then execute the Tailscale command. For example, `cd /data/adb/tailscale/tmp/` then `tailscale login`, or `tailscale status`.
#### Cannot access other tailnet devices

To address this issue, I have created mock versions of `tailscale` and `tailscaled`. Now, you can run `tailscale login` directly without needing to navigate to the `/data/adb/tailscale/tmp/` directory.
This module runs the `tailscaled` binary in userspace-networking mode. To access other devices in the tailnet, you must use a local proxy on port 1099. I've implemented a workaround using `hev-socks5-tunnel` to tunnel local socks5 on port 1099 and bind it to the interface named `tailscale0`.

If you encounter any problems, take a look at the `service.sh` file. You can modify the commands that are not necessary. If you make some modifications to the commands and they work, please open an issue and make a report.
Please note, this `tailscale0` interface is different from the original `tailscale0` interface on Linux. In Linux, `tailscale0` is managed by the `tailscaled` daemon, whereas in this module, `tailscale0` is managed by `hev-socks5-tunnel`. The default gateway is `100.100.100.100`, as defined in the `tailscaled.tun.config.yaml` file.

This module is confirmed to be supported for KernelSU, as [confirmed by the author of KernelSU](https://github.com/anasfanani/Magisk-Tailscaled/issues/2#issue-2055047162). If you encounter any problems, please let me know.
This solution should work on most common devices. However, if you encounter problems accessing other tailnet devices, follow these troubleshooting steps:

1. Verify that `tailscaled.service` is running. If not, restart it with `tailscaled.service restart`.
2. Verify that `tailscaled.tun` is running. If not, restart it with `tailscaled.tun restart`.
3. Check if your device is connected to tailscaled and try a ping connection with `tailscale ping <your_tailnet_ip>`.
4. Verify the port you want to access is accessible. You can do this by accessing it with another tailscale device or using the Tailscale Android App.
5. Check if the local socks5 server is working with curl. Execute the following command:
```
curl 1.1.1.1 -vI -x localhost:1099
```
If it connects, then the local socks5 server is running and working.
6. Check if the local socks5 server can connect to the tailnet network.
```
curl <your_tailnet_ip>:<port> -vI -x localhost:1099
```
If it connects, then the local socks5 server is functioning correctly.
7. Finally, check the connection directly with `curl <your_tailnet_ip>:<port> -vI`.

If the last step fails, the problem likely lies with `socks5-tun`. Verify there is an interface named `tailscale0`. If it exists, the problem may be with the iptables route, either due to a conflict with another rule or some other issue. Feel free to explore your own solutions. If you're unable to resolve the issue, contact me on Telegram and I'll see if I can assist you.

#### My subnet-routes is'nt working

Yes because we need define the routes with `iptables` in file `tailscaled.tun.up` and `tailscaled.tun.down`, you can check this [issue reference](https://github.com/anasfanani/Magisk-Tailscaled/issues/17).
I suppose you're already know the iptables works, if dont, there are chatAI to ask.
You can copy whole `tailscaled.tun.up` script to chatAI and send instruction with please add 192.168.1.1/24 to this route, also dont forget `tailscaled.tun.down`

If you still can't do it by yourself, I'm verry welcome to people who needs help.

#### Exit nodes

You can check this [issue reference](https://github.com/anasfanani/Magisk-Tailscaled/issues/17).

#### ipv6

If you encounter any issues, you can check the logs at `/data/adb/tailscale/tmp/tailscaled.log`.
Unfortunately, I'm verry lazy to learn ipv6.

#### Headscale

Check [this](https://github.com/anasfanani/Magisk-Tailscaled/issues/19#issuecomment-2091579177).
Also explore on the issue first, then you can ask trough telegram.


#### Other Error & Bugs

You can explore to the issue tab, if there not exists, you can open issue, for help me resolve the problem, you can include fresh log.

1. Restart tailscaled with `tailscaled.service restart`
2. Reproduce what are you doing which has problem.
3. Get log at `/data/adb/tailscale/run/tailscaled.log`

## Notes

This module is confirmed to be supported for KernelSU, as [confirmed by the author of KernelSU](https://github.com/anasfanani/Magisk-Tailscaled/issues/2#issue-2055047162). If you encounter any problems, please let me know.

For more information, check out the links below:

Expand All @@ -186,10 +245,13 @@ For more information, check out the links below:

- [Tailscale Inc & AUTHORS](https://github.com/tailscale/tailscale). for the static binaries of tailscale & tailscaled
- [John Wu & Authors](https://github.com/topjohnwu/Magisk). for The Magic Mask for Android
- [heiher & Authors](https://github.com/heiher/hev-socks5-tunnel). for the hev-socks5-tunnel

## Disclaimer

This module is provided as-is, I'm not employee at official tailscale, not a verry genius people which can resolve all your problem.
This module is not affiliated with the official Tailscale. It is a third-party implementation and the author is not responsible for any damage to your device that may occur from its use. Use at your own risk.
Any improvements is required, any PR is verry required, not just welcome.

## License

Expand Down

0 comments on commit 5ee787a

Please sign in to comment.