Forked from diyism/tailscale exit node settings and global dns settings on pc, android termux, android shell
Created
September 23, 2021 08:22
-
-
Save rainly/4fd2a3aae2beeec8fd334ebf4b879b85 to your computer and use it in GitHub Desktop.
tailscale exit node settings and global dns settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0.In my 0th vps (for example Oracle Cloud free tier VPS, ubuntu 20.04, it allow me to create 2 free vps servers): | |
sudo apt install tailscale(ref: https://tailscale.com/kb/1039/install-ubuntu-2004/) | |
sudo tailscale up //copy the showed url and authorize google sign-in in the web browser | |
ip addr show tailscale0 //for example: 100.71.153.9 | |
1. In my 1st vps(in china, for example my linux PC in my home): | |
sudo apt install tailscale | |
sudo sysctl net.ipv4.conf.all.forwarding=1 | |
sudo tailscale up --advertise-exit-node --accept-dns=false //copy the showed url and authorize google sign-in in the web browser | |
//"--advertise-exit-node" to advertise this vps as exit node, "--accept-dns=false" to avoid global dns settings overwriting /etc/resolv.conf in exit node | |
ip addr show tailscale0 //it shows for example: 100.71.153.10 | |
curl https://www.google.com/search?q=my%20ip //it shows for example: 132.226.172.5 | |
tailscale version //it shows 1.8.6 | |
//open socks5 proxy 8086 that go through the 0th vps | |
while true; do nohup /usr/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=10 -o ServerAliveCountMax=6 -CND 100.71.153.10:8086 [email protected] -p 22 > /dev/null 2>&1; sleep 1; done & | |
//create socks86 interface for 8086 socks5 proxy | |
while true; do nohup ip tuntap add dev socks86 mode tun user nobody >/dev/null 2>&1; ifconfig socks6 up 10.6.0.1 >/dev/null 2>&1; badvpn-tun2socks --tundev socks86 --netif-ipaddr 10.6.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 100.71.153.10:8086 >/dev/null 2>&1; sleep 1; done & | |
./mydns --listen 0.0.0.0:53 //my udp dns server, output every query logs, china/foreign IP split, for foreign IPs: ip route add <foregin ip>/32 dev socks86 scope link | |
2.In the web page of https://login.tailscale.com/admin/machines | |
Click the "..." menu button of 100.71.153.10 | |
Click "Review route settings" | |
Enable the "Use as exit node" | |
3.In the web page of https://login.tailscale.com/admin/dns | |
Click "Add nameserver", input "100.71.153.10" and click "Save" | |
Click the "Override local DNS" switch and enable it | |
4.In my android phone: | |
Install latest tailscale app from google play(version >=1.8.6) | |
Authenticate it with google sign-in | |
Click the "..." menu button on the top-right of the app | |
Click "Use "Use exit node" and select the name of "100.71.153.10" | |
Click "Active" switch | |
Open the browser, | |
visit https://www.google.com/search?q=my%20ip | |
It shows my 1st oracle vps's IP 132.226.172.5 | |
5.In my 2nd vps(in china, just for test, not must): | |
curl https://www.google.com/search?q=my%20ip //it shows my 2nd vps's IP: 152.70.90.2 | |
sudo apt install tailscale | |
sudo tailscale up --exit-node=100.71.153.10 //to restore: sudo tailscale down ; sudo tailscale up --reset | |
curl https://www.google.com/search?q=my%20ip --resolve www.google.com:443:216.58.200.36 //it shows my 1st vps's IP: 132.226.172.5 | |
Now I can see "/etc/resov.conf" has been changed to "nameserver 100.71.153.10" | |
I can see dns query log in my 1st vps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment