frp实现内网穿透(Windows版本)

frp

frp 是一个专注于内网穿透的高性能的反向代理应用,支持 TCP、UDP、HTTP、HTTPS 等多种协议,且支持 P2P 通信。可以将内网服务以安全、便捷的方式通过具有公网

IP 节点的中转暴露到公网。

github 下载地址:github.com/fatedier/frp/releases

frp配置参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[common]
bind_port = 7000
# 启用面板
dashboard_port = 7500
# 面板登录名和密码
dashboard_user = admin
dashboard_pwd = xxxxxx
# 使用http代理并使用80端口进行穿透
vhost_http_port = 80
# 使用https代理并使用443端口进行穿透
vhost_https_port = 443
# 日志路径
log_file = ./frps.log
# 日志级别
log_level = info
# 日志最大保存天数
log_max_days = 7
# 认证超时时间
authentication_timeout = 900
# 认证token,客户端需要和此对应
token=123123123
# 最大连接数
max_pool_count = 5
max_ports_per_client = 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[common]
bind_port = 7000
# 启用面板
dashboard_port = 7500
# 面板登录名和密码
dashboard_user = admin
dashboard_pwd = xxxxxx
# 使用http代理并使用80端口进行穿透
vhost_http_port = 80
# 使用https代理并使用443端口进行穿透
vhost_https_port = 443
# 日志路径
log_file = ./frps.log
# 日志级别
log_level = info
# 日志最大保存天数
log_max_days = 2
# 认证超时时间
authentication_timeout = 900
# 认证token,客户端需要和此对应
token=123123123
# 最大连接数
max_pool_count = 5
max_ports_per_client = 0

frpClient

1
2
3
4
5
6
7
8
9
10
11
12
[common]
serverAddr = 127.0.0.1
serverPort = 7000

auth.method = "token"
auth.token = "gKpsGx0AMSVRVjAVvo2Qa94kU81"

[web]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 8080

frpServer

1
2
3
4
5
6
7
8
9
10
11
[common]
bind_addr = 0.0.0.0
bindPort = 7000

auth.method = "token"
auth.token = "gKpsGx0AMSVRVjAVvo2Qa94kU8"

dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = "SuxqcRvNC2iknszYNpZmuxfrtp"

公网、内网服务器都下载一份。

找到第一条,然后下载 frp_windwos_amd64.zip 这个 (amd64 是 64 系统,386 是 32 位系统,现在电脑基本 64 位了),比如图片上的
frp_0.33.0_windows_amd64.zip

2、将 frp_0.33.0_windows_amd64.zip 解压至任意目录

3、进入解压目录这里所有 frpc 开头的文件都是客户端文件,所以全部删了,我们服务器只需要 frps 开头的文件

4、配置服务端(公网服务器)
我们打开 frps.ini(我用的 notepad++ 编辑器,记事本也可以)
注意配置文件不支持注释,请不要把汉字复制进去

1
2
3
[common]
bind_port = 7000 #与客户端绑定的进行通信的端口
vhost_http_port = 6081 #访问客户端web服务自定义的端口号

保存然后打开 cmd 进入当前目录(cmd 不会用自行百度),输入:frps.exe -c ./frps.ini,此时会提示网络防火墙安全警告,点允许

提示 start frps success 则服务启动成功

警告:云服务器一定要开放端口,不会开放自行百度,图中的 7000 是 frp 绑定的默认端口要打开,另外一个是 http(用不到可以删了)

至此服务端配置完成!
5、配置客户端(内网服务器),首先删掉 frps 开头文件文件,然后再进行配置,编辑 frpc.ini
注意配置文件不支持注释,请不要把汉字复制进去

1
2
3
4
5
6
7
8
9
[common]
server_addr = xx.xx.xx.xx #公网服务器ip
server_port = 7000 #与服务端bind_port一致

[yclj]
type = tcp
local_ip = 127.0.0.1
local_port = 3389 # 3389是windows的远程连接端口
remote_port = 24567 # 远程服务器端口(自定义)

保存然后执行
windows 使用 cmd 或者 powershell 进入当前目录,执行

frpc.exe -c frpc.ini
6、访问方式
(1) 远程连接 windows bind_post 要绑定 3389,其他的不行
ip:xx.xx.xx.xx:24567 (这个是服务器开放的端口,映射本地的 3389)

三、结尾

  1. 客户端连接服务端提示访问被拒绝,则需要服务端开放防火墙端口(学习的话全开就行了,生产环境除外)。

示例代码

frpc.ini(客户端)frpc.exe -c frpc.ini

1
2
3
4
5
6
7
8
9
[common]
server_addr = xx.xx.xx.xx
server_port = 7000

[yclj]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 80

frps.ini(服务端)frps.exe -c frps.ini

1
2
3
[common]
bind_port = 7000
vhost_http_port = 6081

frp 如何增加密码校验

FRP(Fast Reverse Proxy)可以通过以下几种方式增加密码校验:

1. 使用 Token 鉴权

FRP 支持通过 Token 进行身份验证。你需要在服务端(frps)和客户端(frpc)的配置文件中设置相同的 token 值。

  • 服务端配置(frps.toml

    toml

    复制

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    [common]
    bind_port = 7000
    auth.method = "token"
    auth.token = "your_secret_token"


    auth.method = "token"
    auth.token = "gKpsGx0AMSVRVjAVvo2Qa94kU8"

    dashboard_addr = 127.0.0.1
    dashboard_port = 7500
    dashboard_user = admin
    dashboard_pwd = "SuxqcRvNC2iknszYNpZmuxfrtp"
  • 客户端配置(frpc.toml

    toml

    复制

    1
    2
    3
    4
    5
    6
    7
    8
    [common]
    server_addr = x.x.x.x
    server_port = 7000
    auth.method = "token"
    auth.token = "your_secret_token"

    auth.method = "token"
    auth.token = "gKpsGx0AMSVRVjAVvo2Qa94kU8"

2. 使用 OpenID Connect (OIDC) 鉴权

FRP 也支持使用 OpenID Connect (OIDC) 进行身份验证。

  • 服务端配置(frps.toml

    toml

    复制

    1
    2
    3
    4
    5
    [common]
    bind_port = 7000
    auth.method = "oidc"
    auth.oidc.issuer = "https://example-oidc-issuer.com/"
    auth.oidc.audience = "https://oidc-audience.com/.default"
  • 客户端配置(frpc.toml

    toml

    复制

    1
    2
    3
    4
    5
    6
    7
    8
    [common]
    server_addr = x.x.x.x
    server_port = 7000
    auth.method = "oidc"
    auth.oidc.clientID = "your_client_id"
    auth.oidc.clientSecret = "your_client_secret"
    auth.oidc.audience = "https://oidc-audience.com/.default"
    auth.oidc.tokenEndpointURL = "https://example-oidc-endpoint.com/oauth2/v2.0/token"

3. 使用 BasicAuth 鉴权

如果你需要对 HTTP/HTTPS 代理进行密码校验,可以使用 BasicAuth 鉴权。

  • 客户端配置(frpc.ini

    ini

    复制

    1
    2
    3
    4
    5
    6
    7
    8
    [http]
    type = http
    local_port = 80
    remote_port = 8080
    use_encryption = true
    use_compression = true
    http_user = admin
    http_passwd = 123456
  • 服务端配置(frps.ini

    ini

    复制

    1
    2
    [common]
    bind_port = 7000

4. 使用签名验证

在某些高级场景中,可以通过签名验证来保护配置文件不被篡改。例如,通过计算配置文件的 MD5 值并进行验证,但这种方法需要结合额外的工具或脚本实现。

5. 使用 TLS 双向认证

虽然 TLS 双向认证主要用于加密通信,但也可以通过证书来验证客户端和服务端的身份。

  • 服务端配置(frps.toml

    toml

    复制

    1
    2
    3
    transport.tls.certFile = "/path/to/server.crt"
    transport.tls.keyFile = "/path/to/server.key"
    transport.tls.trustedCaFile = "/path/to/ca.crt"
  • 客户端配置(frpc.toml

    toml

    复制

    1
    2
    3
    transport.tls.certFile = "/path/to/client.crt"
    transport.tls.keyFile = "/path/to/client.key"
    transport.tls.trustedCaFile = "/path/to/ca.crt"

根据你的需求选择合适的密码校验方式,并按照上述配置进行设置即可。

MongoDB Auth创建账号和权限

MongoDB Auth创建账号和权限

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use admin

db.createUser({
user: 'db_reader',
pwd: 'A123456',
mechanisms: ["SCRAM-SHA-1"],
roles: [{
role: "read",
db: "my-app"
}]
});

db.createUser({
user: "db_manager",
pwd: "A456789",
mechanisms: ["SCRAM-SHA-1"],
roles: ['readWriteAnyDatabase', 'dbAdminAnyDatabase', {
role: "dbAdmin",
db: 'my-app'
}, {
role: "readWrite",
db: 'my-app'
}, {
role: "dbAdmin",
db: 'my-app'
}]
});

db.createUser({
user: 'db_root',
pwd: 'A10111213',
mechanisms: ["SCRAM-SHA-1"],
roles: [{
role: "dbAdminAnyDatabase",
db: "admin"
}, {
role: "root",
db: "admin"
}]
});

OPC-DA-ALL-List-OPC-(一)-安装Matrikon OPC Simulation Server

安装OPC Server模拟器

可以在此处下载
或者去官网下载

双击下载下来的MatrikonOPCSimulation.EXE安装文件

Collecting Information

接受并Next

Complete Setup

选择Complete Setup并Next

Select the install path

安装路径为c:\Program Files\Matrikon\OPC然后Next

Create quick start icon

默认,Next

Confirm password

默认密码是MatrikonOPC然后选择Next

Ready to start

然后选择Next进行安装

最后安装完成会出现如下图示

Install finished

选择第一个和第二个Checked,其他选项Uncheck 第一个的意思是打开MatrikonOPC Configuration Panel 第二个的意思是打开Quick
Start文档(有兴趣可以看一下,英文的)

本次安装包含三部分

  • Analyzer分析器
  • Explorer浏览器
  • Simulation模拟器

260801-mysql(mysqlpump&mysql)5.7.26.压缩导出.md

MySQL 5.7.26 可以直接使用官方自带的 mysqlpump.exe 压缩导出。它支持 ZLIBLZ4 两种压缩算法。

案例

服务端执行,解决异常问题

mysqlpump: [WARNING] (13) Can’t get stat of ‘.\mysql\general_log.CSV’ (Errcode: 2 - No such file or directory)
mysqlpump: [ERROR] (13) Can’t get stat of ‘.\mysql\general_log.CSV’ (Errcode: 2 - No such file or directory)

1
2
3
4
5
6
7
8
9
10
11
12
## 关闭
SET GLOBAL general_log=OFF;
SET GLOBAL slow_query_log=OFF;
SET GLOBAL log_output='FILE';

SELECT @@GLOBAL.general_log, @@GLOBAL.log_output, @@GLOBAL.slow_query_log;


## 生产环境可以保持
SET GLOBAL general_log = OFF;
SET GLOBAL log_output = 'FILE';
SET GLOBAL slow_query_log = ON;

含义是:

  • general_log = OFF:关闭所有 SQL 通用日志,避免日志量巨大和性能下降。
  • log_output = FILE:日志写到文件,不写入损坏的系统 CSV 表。
  • slow_query_log = ON:保留慢查询日志,用于排查慢 SQL。

这是比较合理的生产配置,无须为了导出结束而恢复成 TABLE

算法文件对比

假设原始 SQL 文件为 10 GB,实际结果可能类似:

算法 可能的压缩大小 导出压缩耗时
LZ4 3~5 GB 较短
ZLIB 2~4 GB 较长
1
mysqlpump.exe --no-defaults -h 127.0.0.1 -P 3306 -u root --password --single-transaction --default-character-set=utf8mb4 --compress-output=LZ4 --result-file="C:\mysql-backup\km_tables.sql.lz4"  km_database km_table

推荐:ZLIB 压缩导出

在 Windows CMD 或 PowerShell 中执行:

1
2
3
4
5
6
7
8
9
10
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqlpump.exe" ^
-h 127.0.0.1 ^
-P 3306 ^
-u root ^
-p ^
--single-transaction ^
--default-character-set=utf8mb4 ^
--compress-output=ZLIB ^
--result-file="C:\mysql-backup\km_database.sql.zlib" ^
km_database

执行后生成:

1
C:\mysql-backup\km_database.sql.zlib

这里建议使用 --result-file,不要在 PowerShell 中写:

1
mysqlpump ... > backup.zlib

因为 Windows PowerShell 的输出重定向可能改变输出编码;官方也建议 Windows 使用 --result-file

指定表并使用 LZ4 压缩

1
2
3
4
5
6
7
8
9
10
11
12
13
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqlpump.exe" ^
-h 127.0.0.1 ^
-P 3306 ^
-u root ^
-p ^
--single-transaction ^
--default-character-set=utf8mb4 ^
--compress-output=LZ4 ^
--result-file="C:\mysql-backup\km_tables.sql.lz4" ^
km_database ^
product_auto_task_data ^
product_auto_task_data_detail ^
km_device

这条命令只导出:

1
2
3
km_database.product_auto_task_data
km_database.product_auto_task_data_detail
km_database.km_device

LZ4ZLIB 都是 MySQL 5.7 mysqlpump 支持的输出压缩算法。

解压备份

MySQL 5.7.26 自带 zlib_decompress.exe

1
2
3
"C:\Program Files\MySQL\MySQL Server 5.7\bin\zlib_decompress.exe" ^
"C:\mysql-backup\km_database.sql.zlib" ^
"C:\mysql-backup\km_database.sql"

zlib_decompress 从 MySQL 5.7.10 开始提供,因此 5.7.26 可以使用。

导入恢复

1
2
3
4
5
6
7
8
9
10
11
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
-h 127.0.0.1 ^
-P 3306 ^
-u root ^
-p ^
--default-character-set=utf8mb4 ^
km_database ^
< "C:\mysql-backup\km_tables.sql"

mysql.exe -h 127.0.0.1 -P 3306 -u owen -p --default-character-set=utf8mb4 km_database < "C:\mysql-backup\km_tables.sql"
mysql.exe -h 127.0.0.1 -P 3306 -u root -p --default-character-set=utf8mb4 km_database < "C:\mysql-backup\km_tables.sql"

LZ4 方式

LZ4 一般压缩速度更快,也可以直接使用:

1
2
3
4
5
6
7
8
9
mysqlpump.exe ^
-u root ^
-p ^
--single-transaction ^
--compress-output=LZ4 ^
--result-file="C:\mysql-backup\km_database.sql.lz4" ^
km_database

mysqlpump.exe -u root -p --single-transaction --compress-output=LZ4 --result-file="C:\mysql-backup\km_database.sql.lz4" km_database

解压:

1
2
3
4
5
lz4_decompress.exe ^
"C:\mysql-backup\km_database.sql.lz4" ^
"C:\mysql-backup\km_database.sql"

lz4_decompress.exe "C:\mysql-backup\km_tables.sql.lz4" "C:\mysql-backup\km_tables.sql"

因此,你这个版本优先使用:

1
mysqlpump.exe + --compress-output=ZLIB + --result-file

mysqldump + 7-Zip 更直接,不需要先生成未压缩的 SQL 文件。

260401-openclaw-cn-uninstall卸载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 运行 OpenClaw 的内置卸载程序
openclaw-cn uninstall --all --yes
openclaw uninstall --all --yes

## npm卸载
npm uninstall -g openclaw-cn
npm uninstall -g openclaw

## 删除本地文件
rm -rf ~/.openclaw
# 如果安装过旧版本,也一并删除
rm -rf ~/.clawdbot ~/.moltbot ~/.molthub

# 清理 npm 缓存
npm cache clean --force

260310-openclaw部署和使用

必需环境

  • Node.js ≥ 22.0.0

  • npm ≥ 10.0.0(或 pnpm ≥ 8.0.0)

安装NodeJs

1

配置npm 或者 pnpm 仓库源

1
2
3
4
5
# 如果还没有安装 pnpm
npm install -g pnpm

# 安装 OpenClaw
pnpm add -g openclaw@latest

安装openclaw

1
2
3
npm install -g openclaw@latest

openclaw --version

启动配置向导

1
2
3
4
openclaw onboard --install-daemon

# 启动 Gateway 控制平面
openclaw gateway --port 18789 --verbose

在终端执行以下命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
openclaw onboard --install-daemon

? 选择 AI 模型供应商:
❯ MiniMax M2.5(CN) - 国内可用,中文支持好
Kimi - 月之暗面,长文本处理强
DeepSeek - 推理能力强,代码能力出色
Claude - Anthropic 出品(需国际网络)
OpenAI GPT - 经典选择(需国际网络)
Gemini - Google 出品(需国际网络)
Ollama - 本地模型,完全离线


? 输入 API Key: [粘贴你的 API Key]
✓ 正在验证 API Key...
✓ 认证成功!


? 是否现在配置 Channel(渠道)?
❯ 跳过,稍后配置

? 是否现在安装 Skills(技能)?
❯ 跳过,稍后安装

? 是否现在配置 Hooks(钩子)?
❯ 跳过,稍后配置

常用命令

管理命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 打开 Web Dashboard
openclaw dashboard

# 启动 Gateway 控制平面
openclaw gateway --port 18789 --verbose

# 查看运行状态
openclaw status

# 查看日志
openclaw logs

# 运行诊断工具
openclaw doctor

# 停止所有服务
openclaw stop

Agent 命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 与助手对话
openclaw agent --message "你好" --thinking high

# 发送消息到指定渠道
openclaw message send --to +1234567890 --message "Hello from OpenClaw"

# 列出所有 Agent
openclaw agents list

# 添加新 Agent
openclaw agents add <agent-name>

# 编辑 Agent 配置
openclaw agents edit <agent-name>

Channel 命令

1
2
3
4
5
6
7
8
9
10
11
# 列出所有渠道
openclaw channels list

# 添加新渠道
openclaw channels add

# 删除渠道
openclaw channels remove <channel-name>

# 重启渠道
openclaw channels restart <channel-name>

Skill 命令

1
2
3
4
5
6
7
8
9
10
11
# 列出已安装的技能
openclaw skills list

# 搜索技能(需要先安装 clawhub)
clawhub search <关键词>

# 安装技能
clawhub install <skill-name>

# 卸载技能
openclaw skills uninstall <skill-name>

Plugin 命令

1
2
3
4
5
6
7
8
# 列出所有插件
openclaw plugins list

# 启用插件
openclaw plugins enable <plugin-name>

# 禁用插件
openclaw plugins disable <plugin-name>

更新命令

1
2
3
4
5
6
7
# 更新到最新稳定版
openclaw update

# 切换版本通道
openclaw update --channel stable # 稳定版
openclaw update --channel beta # 测试版
openclaw update --channel dev # 开发版

部署QWen自定义大模型参数

1
2
https://dashscope.aliyuncs.com/compatible-mode/v1
qwen3.5-plus

部署deepSeek大模型

1
2
https://api.deepseek.com
deepseek-v4-flash

260309-Virtualbox主机和虚拟机之间文件夹共享及双向拷贝(Windows<->Windows, Windows<->Linux)

记录下,Virtualbox下如何实现主机和虚拟机之间文件夹共享及双向拷贝
关于双向拷贝
1.设置虚拟机为“双向”共享粘贴

有的人反应只要设置双向粘贴就可以,但是我的不行,我还需要再给虚拟机安装一下增强功能。需要启动虚拟机,安装菜单项“设备”中的最后一项。

安装完增强功能,注意要重启虚拟机,双向拷贝才被启用。

关于文件夹共享
情况一:
Host操作系统:Windows 7
Guest操作系统:Windows Server
1.首先设置共享文件夹

2.虚拟机中的菜单项中,设备 - 分配光驱 – 选择一个虚拟光盘。在弹出的对话框选择 VirtualBox 安装目录下选择
VBoxGuestAdditions.iso
3.虚拟机中的光驱,运行VBoxWindowsAdditions.exe,安装完成后,重启虚拟机中的系统,就能看到主机中的共享目录了。


情况二:
Host操作系统:Windows 7
Guest操作系统:Oracle Linux

和情况一一样先设置共享目录。
然后在Linux虚拟机上边的菜单中,设备->安装增强功能。

出现VBOXADDITIONS,然后运行此软件

可以看到共享文件夹了

挂在这个目录到Linux本地目录。
首先创建一个文件夹
mkdir /home/share
改为可读可写
cd /home/share
chmod 777 .

运行命令加载
sudo mount -t vboxsf -o uid=1000,gid=1000 Share /home/share
红色Share为VirtualBox共享目录的名字

蓝色的/home/share为刚刚创建的目标目录。