二叉树树

二叉树树

瞎几吧写

Ultimate Feeding Tutorial, Hand-in-Hand Guide to Internal Network Penetration

What is NAT Traversal?#

When we have a NAS at home and want to access it from the school/company network, we need to use NAT traversal to achieve external access to internal services. The principle generally involves P2P hole punching and server relay traffic.


Preliminary Preparation#

Enable UPnP on the router 9d3b273d5844fcd41079d7a2e8db3a56

Disable the router's IPv4 and IPv6 firewalls eac87ee01ac2d3d08db22a6ea7cc8a3a

Using Zerotier/Tailscale for NAT Traversal#

Both of their principles involve attempting to establish a P2P connection with the peer, requiring the peer to install a software and run it continuously.

Detailed Tutorial on Using Zerotier for NAT Traversal#

Create a Zerotier Account#

https://zerotier.com

If you can't create an account, just give up.

Create a New Zerotier Network Group#

Once you successfully log in to your account, you will be automatically redirected to this page. Click Create A Network. If not, please visit ZeroTier Central.

The list below will add a new network group; click on it. 3154a3b032e8b3cdce514bf906b49c50

The default network group mode for Zerotier is Private. Even if others know your Network ID, they will need your verification to join your network group.

Copy the Network ID. We will use this to join the network group later. 79274cf9aab6443cfbf642dfa68d901e


Install the Zerotier Application on Devices#

Windows:#

Go to Download - ZeroTier, and download the exe installation file.

After installation, check the tray in the lower right corner and follow the image instructions to join the network group. 177ed23d4c38c023db3fead1eaf363bc

beb25a738c6912e22c82feef3e371aab

0bfcaf8af8ff555db37c38eda71c7bc6

Here you can find your device ID and your IP in this network group.

362952c2329796dc755e55d7a50e34a7

Linux (Feiniu OS):#

Connect to your Linux device via SSH.

Check the installation command: Download - ZeroTier

Execute in the terminal: curl -s https://install.zerotier.com | sudo bash

When you see this line, the installation is complete; the following string is your device ID: 37fead44557116de244c5ba83e0ddc7b

Join the network: sudo zerotier-cli join your Network ID fd3821520158695f7865a88c9251ac6e

Android#

Download the client.

  1. Zerotier One: ZeroTier One APK Download for Android - Latest Version

  2. ZerotierFix: Releases · kaaass/ZerotierFix

Follow the instructions in the images.

bd023de84dc615809d70179b59786bc0

ce7fc24bcc2bc665b7f60004eaef352e


Authorize Devices in Zerotier#

Go to Zerotier's web console: ZeroTier Central.

Authorize the device you just joined. f8394790363041406c07b27577a20890

Check the box and then save. 719c16702c54501ce1747d1e17a43739


Zerotier Connectivity Test#

If you already have more than two devices in the same network group, you can try pinging to test connectivity. Please ensure that the two devices are not on the same local area network (for example, the phone using mobile data and the NAS using home Wi-Fi).

You can check the IP here. 87689f1bc02cc87249a5d097ac8db0c2

Ping test: eff5fbdb118f37310ee2a9af64b03c6f


Detailed Tutorial on Using Tailscale for NAT Traversal#

Create a Tailscale Account#

Go to: Tailscale. If you can't access it, try using a VPN. If you don't understand English, you can enable your browser's translation feature.


Install the Tailscale Application on Devices#

Windows:#

Go to Download · Tailscale, and download the exe installation file.

Official tutorial: 0d4c74f322235f34e52fd51a4c6f816f

Linux (Feiniu OS):#

Connect to your Linux device via SSH.

Check the installation command: Download · Tailscale

Execute in the terminal: curl -fsSL https://tailscale.com/install.sh | sh

Wait for the installation to complete, then enter: tailscale login

Open the pop-up browser window and log in to your account.

Android#

Download the client (Google Play): Download · Tailscale

Log in to your account.


Tailscale Connectivity Test#

Go to Tailscale's web console: Machines - Tailscale. You can see the IP assigned to each device by Tailscale. 4bfe1eb12ba6d23e3eec4adb5e13d3b0

Ping test: eff5fbdb118f37310ee2a9af64b03c6f


Using Cloudflare Tunnel for NAT Traversal#

This method allows direct access on the public network without any configuration, but is limited to web services. If you want to tunnel game servers, this method is not applicable. You need to host your domain on Cloudflare first.

Create a Cloudflare account Homepage | Cloudflare

Enter Cloudflare One (requires linking a PayPal account).

Follow the instructions to create a Tunnel. 2d2bbb2ad48b2c3a8f647687b9d541c9

8f385e411d10f7f1d5fb1aeaef7339d3

9876952a7aa5126855d5367af6094c8f

46f00361303a5d239f1c52549dd3d422

Docker Method#

Using 1Panel

Copy the command as shown in the image. 2d2bbb2ad48b2c3a8f647687b9d541c9

Paste it and copy the token that follows. f2bc4b3c94867ee553efbfecb6913351

Search for cloudflared in the 1Panel app store. 5feb8c30ab1cd2485539e172901cc184

Enter the token. 51b7db888e40427fd48d4903605145e8

Check the IP of cloudflared#

If you are in Docker mode, you need to check the host IP by entering ip a in the SSH terminal. Here it is 192.168.124.34.

root@n100-debian:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether bc:24:11:33:e1:7d brd ff:ff:ff:ff:ff:ff
    altname enp0s18
    inet 192.168.124.34/24 brd 192.168.124.255 scope global dynamic ens18
       valid_lft 46579sec preferred_lft 46579sec
    inet6 2409:8a30:320:a170:be24:11ff:fe33:e17d/64 scope global dynamic mngtmpaddr
       valid_lft 1902sec preferred_lft 1898sec
    inet6 fe80::be24:11ff:fe33:e17d/64 scope link
       valid_lft forever preferred_lft forever

Native Mode (Using Debian as an Example)#

Select Debian, then copy the command below and execute it directly in the terminal. 8bd16ca73825a5c3e993a24fabf99782

If your environment cannot connect to GitHub, try downloading manually: https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb

Then transfer it to Linux via SSH or other means, as shown in the terminal for MobaXterm. b02d31131cc8cdc55310b49142b09c6f

Then use: dpkg -i cloudflared-linux-amd64.deb to install this package.

Then directly copy the command on the right to execute in the SSH terminal. 60d7f879966e15f71fa872cfa571e59a

Android (Termux)#

Install Termux | The main termux site and help pages. on Android.

Execute in the terminal: pkg install cloudflared

Select Debian, then copy the command on the far right and execute it in the terminal. 60d7f879966e15f71fa872cfa571e59a

If you cannot use the built-in cloudflared in Termux, try installing a proot container.

Enter the commands sequentially:

pkg update && pkg upgrade
pkg install proot
pkg install proot-distro
proot-distro list
proot-distro install debian
proot-distro login debian
apt install wget
wget https://github.com/cloudflare/cloudflared/releases/download/2024.10.1/cloudflared-linux-arm64.deb
dpkg -i cloudflared-linux-amd64.deb

Then directly copy the command on the right to execute in the SSH terminal. 60d7f879966e15f71fa872cfa571e59a


Configure and Access Tunnel#

Configuration via Web#

This method requires running the token directly on the device where cloudflared is installed.

Enter as shown in the image to create an HTTP tunnel. 899382207df11cccb4ac875efa48406f

e8e631ad6a8c97bbab11e34735a726e7

96c2faced6f8285c2a2815a975e4171e

Fill in your IP and port; in non-Docker mode, you can directly fill in localhost.

Local Method#

This method only requires entering some commands on the device where cloudflared is installed and then authorizing via the web. Subsequent configuration changes also need to be done locally.

Log in and authorize: cloudflared tunnel login

Create a tunnel and set the tunnel (HTTP mode penetration, target address 127.0.0.1, port: 8080, external domain: test.onani.cn): cloudflared tunnel --name test --url http://127.0.0.1:8080 --http2 --hostname test.onani.cn

Access Test#

Successfully accessed. 1f390df608dfd3cf7b722de26fe44f6e

Using STUN Hole Punching#

This method allows direct access on the public network without any configuration, and all types of services can be used normally. However, NAT traversal using this method cannot be fixed or specified for IP and port, and will change after 3 to 7 days.

Install Lucky#

Execute: curl -o /tmp/install.sh http://6.666666.host:6/files/golucky.sh && sh /tmp/install.sh http://6.666666.host:6/files 2.13.4

Access the Lucky backend through host:16601 and set up STUN traversal. If the DMZ host is not set as the Lucky host, it may fail. The masked area is the public access IP and port. dc40568b1c0e143f1aef24ef556dc27d

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.