xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Raspberry Pi 内网穿透实战教程 All In One

Raspberry Pi 内网穿透实战教程 All In One

树莓派 cpolar

使用场景

使用 Raspberry Pi 搭建个人 Web 项目的服务器,并且提供外网访问的能力 (Web, SSH)

数据安全,私有代码
低成本服务器
容器化
微服务
全栈开发

error ❌

image

$ curl -sL https://git.io/cpolar | sudo bash

$ curl https://raw.githubusercontent.com/probezy/cpolar-install/main/install-release-cpolar.sh | sudo bash

https://github.com/probezy/cpolar-install/issues/1

solution ✅

zip

$ curl -LO https://static.cpolar.com/downloads/releases/3.3.18/cpolar-stable-linux-arm.zip

image

# OR
$ wget https://static.cpolar.com/downloads/releases/3.3.18/cpolar-stable-linux-arm.zip

# 解压缩安装
$ unzip ./cpolar-stable-linux-arm.zip

# 连接您的帐户
$ ./cpolar authtoken *****

# 文档
$ ./cpolar help

# 端口80上启动HTTP隧道
$ ./cpolar http 80

https://dashboard.cpolar.com/get-started

https://cpolar.com/docs

demos

cpolar 公开一个本地Web站点至公网

只需一行命令,就可以将内网站点发布至公网,方便给客户演示
高效调试微信公众号、小程序、对接支付宝网关等云端服务,提高您的编程效率。

image

https://www.cpolar.com/

eric@rpi4b:~ $ ./cpolar authtoken ******
Authtoken saved to configuration file: /home/eric/.cpolar/cpolar.yml

$ cat /home/eric/.cpolar/cpolar.yml

eric@rpi4b:~ $ ./cpolar help
Usage: ./cpolar  <command> [OPTIONS] <local port or address>
Options:

Examples:
    cpolar http 80                    # secure public URL for port 80 website server
    cpolar http -subdomain=baz 8080   # port 8080 available at baz.cpolar.io
    cpolar http foo.dev:80            # tunnel to host:port instead of localhost
    cpolar tcp 22                     # tunnel arbitrary TCP traffic to port 22
    cpolar http -hostname="example.com" -httpauth="user:password" 10.0.0.1:8080
    cpolar ftp 21                     # tunnel to port 21 for ftp server 
    cpolar tls 443                    # create tls tunnel
    cpolar service install            # install cpolar daemon
    cpolar service start              # start cpolar daemon
    cpolar service stop               # stop cpolar daemon
    cpolar service uninstall          # uninstall cpolar daemon

Advanced usage: cpolar <command> [OPTIONS] [command args] [...]

Commands:
    cpolar authtoken               Save authtoken to configuration file
    cpolar http                    Start an http tunnel
    cpolar tcp                     Start a tcp tunnel
    cpolar start [tunnel] [...]    Start tunnels by name from config file
    cpolar start-all               Start all tunnels defined in config file
    cpolar list                    List tunnel names from config file
    cpolar help                    Print help
    cpolar version                 Print cpolar version
    cpolar ftp                     Start a ftp tunnel
    cpolar tls                     Start a tls tunnel
    cpolar service <install|start|stop|uninstall> Daemon Manager

Examples:
    cpolar start www api blog pubsub
    cpolar start ssh -log=stdout -config=cpolar.yml 
    cpolar start-all
    cpolar version
    cpolar service install
    cpolar service start
    cpolar service stop
    cpolar service uninstall
    cpolar http 8080

cpolar is a command line application, try typing 'cpolar http 8080'
at this terminal prompt to expose port 8080.
# 端口80上启动HTTP隧道
eric@rpi4b:~ $ ./cpolar http 80


# ✅
$ ./cpolar http 3000

http://192.168.0.168:3000/

http://1262e90a.r17.cpolar.top/

https://dashboard.cpolar.com/status

https://mp.weixin.qq.com/s/NCTF_3uZsrNV8lHh7CV33A

https://www.cpolar.com/blog/ssh-remote-raspberry-pi

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

.bashrc / .zshrc

$ vim .bashrc
$ cat .bashrc
# cpolar 全局别名
alias cpolar='/home/eric/cpolar'

# update ✅
# source ~/.bashrc
$ cpolar help

OpenWRT

软路由

OpenWrt Project is a Linux operating system targeting embedded devices.
Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management.

OpenWrt 项目是一个针对嵌入式设备的 Linux 操作系统。
OpenWrt 没有尝试创建单个静态固件,而是提供了一个具有包管理功能的完全可写文件系统。

https://openwrt.org/

https://github.com/openwrt/openwrt
https://zh.wikipedia.org/wiki/OpenWrt

refs

https://www.cnblogs.com/xgqfrms/p/14722228.html#5204334

https://askubuntu.com/questions/285976/download-zip-file-with-curl-command

https://stackoverflow.com/questions/21768455/download-a-zip-file-from-the-command-line



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-08-21 19:50  xgqfrms  阅读(124)  评论(6编辑  收藏  举报