FRPC和NPS使用方法

🙄请按照这个方法来尝试连接

下面是整理好的 FRPC 使用说明,分为「中文版本」和「English Version」。 示例配置里的内容已全部脱敏,只保留参数名,方便你直接发给客户。


一、中文版本(给客户看的说明)

1. 您将从服务提供方收到什么?

FRPC使用说明

下载地址

你会得到的东西

你会用本 FRP 穿透服务之前,您会从服务提供方收到以下信息(请妥善保管,不要公开):

  • serverAddr:FRPS 服务器地址(IP 或域名)
  • serverPort:FRPS 端口(例如 7000
  • user:您的专属用户名
  • token:与该用户对应的密钥
  • 可用的 remotePort 列表:允许您使用的远程端口(例如一组端口号)

下文中的所有占位符(如 <SERVER_ADDR>)都需要您替换为服务提供方给您的实际值。


FRPC使用方法(Linux)

2. 准备工作

  1. 在您的电脑上创建一个目录,例如:

    1
    2
    mkdir -p ~/frp-client
    cd ~/frp-client
  2. 下载适用于您系统的 frpc 客户端程序(Linux / Windows / macOS), 然后放到该目录下,并确保有执行权限(Linux):

    1
    chmod +x ./frpc

3. 创建配置文件 frpc.toml

在同一目录下创建文件 frpc.toml,内容示例如下(请务必使用英文和数字,不要写入中文):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ===== Basic connection settings =====
serverAddr = "<SERVER_ADDR>"
serverPort = <SERVER_PORT>

# Must match the user provided by your provider
user = "<USERNAME>"

[metadatas]
# Must match the token provided by your provider
token = "<TOKEN>"

# ===== Example proxy: expose a local HTTP service =====
[[proxies]]
name = "example-http"
type = "tcp"
localIP = "127.0.0.1"
localPort = 80
remotePort = <REMOTE_PORT_FROM_ALLOWED_LIST>

字段说明

  • serverAddr:替换为服务提供方给你的服务器 IP 或域名,例如 "1.2.3.4"
  • serverPort:替换为服务端端口号,例如 7000(不需要引号)。
  • user:替换为服务提供方给你的用户名。
  • token:替换为服务提供方给你的 token。
  • localIP:本地要暴露的服务 IP,一般为 "127.0.0.1" 或你本机的内网地址。
  • localPort:本地服务端口,例如你的 Web 服务是 80,SSH 是 22
  • remotePort必须从服务提供方给你的「可用端口列表」中选择一个端口号(不加引号)。

注意:请删除示例中的尖括号 < >,直接填写具体的值,例如:

1
2
3
4
5
serverAddr = "1.2.3.4"
serverPort = 7000
user = "u123"
token = "abc123xyz"
remotePort = 10001

4. 如何启动 FRPC

Linux / macOS

frpcfrpc.toml 所在目录执行:

1
./frpc -c frpc.toml

Windows

在命令提示符(cmd)中进入 frpc.exe 所在目录:

1
frpc.exe -c frpc.toml

看到类似输出且无报错,即表示连接成功。


5. 如何添加更多转发服务

如果您已经有一个工作正常的配置,例如 HTTP 转发:

1
2
3
4
5
6
[[proxies]]
name = "example-http"
type = "tcp"
localIP = "127.0.0.1"
localPort = 80
remotePort = <REMOTE_PORT_FROM_ALLOWED_LIST>

想要再增加一个 SSH 转发,只需要 复制一份 [[proxies]] 块,并修改其中几项:

1
2
3
4
5
6
[[proxies]]
name = "example-ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = <ANOTHER_REMOTE_PORT_FROM_ALLOWED_LIST>

注意事项:

  • 每个 name 必须唯一。
  • 每个 remotePort 必须来自服务提供方给你的「可用端口列表」,且不能重复使用同一个端口。
  • 修改完 frpc.toml 后,需要重启 frpc 使配置生效。

6. 常见问题

  1. FRPC 启动后立即退出
    • 检查 serverAddrserverPortusertoken 是否填写正确。
    • 检查你的网络是否能访问服务端 IP 和端口。
  2. FRPC 启动正常,但外部访问不上
    • 确认本地服务(例如 Web / SSH)在 localIP:localPort 上已经正常监听。
    • 确认你使用的 remotePort 在服务提供方给你的端口范围之内。
    • 确认客户端和服务端之间没有额外防火墙阻挡。

二、English Version (For Customers)

1. What information will you receive?

Before using this FRP tunneling service, you will receive the following values from your provider:

  • serverAddr: FRPS server address (IP or domain)
  • serverPort: FRPS port (e.g. 7000)
  • user: your dedicated username
  • token: the token bound to this user
  • Allowed remotePort list: the remote ports you are allowed to use

All placeholders like <SERVER_ADDR> below must be replaced with the actual values your provider gives you.


2. Preparation

  1. Create a working directory, for example:

    1
    2
    mkdir -p ~/frp-client
    cd ~/frp-client
  2. Download the frpc client binary for your system (Linux / Windows / macOS) and place it in this directory. On Linux, make it executable:

    1
    chmod +x ./frpc

3. Create the frpc.toml configuration file

In the same directory, create a file named frpc.toml with the following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ===== Basic connection settings =====
serverAddr = "<SERVER_ADDR>"
serverPort = <SERVER_PORT>

# Must match the user provided by your provider
user = "<USERNAME>";

[metadatas]
# Must match the token provided by your provider
token = "<TOKEN>"

# ===== Example proxy: expose a local HTTP service =====
[[proxies]]
name = "example-http"
type = "tcp"
localIP = "127.0.0.1"
localPort = 80
remotePort = <REMOTE_PORT_FROM_ALLOWED_LIST>

Field description

  • serverAddr: replace with the server IP or domain provided by your provider, e.g. "1.2.3.4".
  • serverPort: replace with the FRPS port, e.g. 7000 (no quotes).
  • user: replace with the username you received.
  • token: replace with the token you received.
  • localIP: the IP of your local service, usually "127.0.0.1" or your LAN IP.
  • localPort: the port of your local service, e.g. 80 for HTTP, 22 for SSH.
  • remotePort: must be one of the ports from the allowed port list given by your provider (no quotes).

Important: remove the angle brackets < > and fill in real values, for example:

1
2
3
4
5
serverAddr = "1.2.3.4"
serverPort = 7000
user = "u123"
token = "abc123xyz"
remotePort = 10001

4. How to start FRPC

Linux / macOS

Run in the directory where frpc and frpc.toml are located:

1
./frpc -c frpc.toml

Windows

Open Command Prompt (cmd), go to the folder where frpc.exe is located, and run:

1
frpc.exe -c frpc.toml

If there are no error messages and the process keeps running, the connection is likely established.


5. How to add more proxies

If you already have one working proxy, for example:

1
2
3
4
5
6
[[proxies]]
name = "example-http"
type = "tcp"
localIP = "127.0.0.1"
localPort = 80
remotePort = <REMOTE_PORT_FROM_ALLOWED_LIST>

and you want to expose another service (for example SSH), copy the whole [[proxies]] block and modify a few fields:

1
2
3
4
5
6
[[proxies]]
name = "example-ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = <ANOTHER_REMOTE_PORT_FROM_ALLOWED_LIST>

Notes:

  • Each name must be unique.
  • Each remotePort must come from the allowed remote port list provided by your provider, and you should not reuse the same port for different proxies.
  • After editing frpc.toml, restart frpc to apply the changes.

6. FAQ

  1. FRPC exits immediately after start
    • Check if serverAddr, serverPort, user, and token are correct.
    • Check your network connectivity to the server IP and port.
  2. FRPC is running, but you cannot access the service from outside
    • Make sure your local service is actually listening on localIP:localPort.
    • Make sure the remotePort you use is within the allowed range from your provider.
    • Make sure there is no firewall blocking the traffic between client and server.