-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update some doc to toml config format (#67)
- Loading branch information
Showing
14 changed files
with
393 additions
and
292 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,36 +2,46 @@ | |
title: "通过 SSH 访问内网机器" | ||
weight: 5 | ||
description: > | ||
这个示例通过简单配置 TCP 类型的代理让用户访问到内网的服务器。 | ||
通过简单配置 TCP 类型的代理,使用户能够访问内网服务器。 | ||
--- | ||
|
||
1. 在具有公网 IP 的机器上部署 frps,修改 frps.ini 文件,这里使用了最简化的配置,设置了 frp 服务器用户接收客户端连接的端口: | ||
### 步骤 | ||
|
||
```ini | ||
[common] | ||
bind_port = 7000 | ||
1. **在具有公网 IP 的机器上部署 frps** | ||
|
||
部署 frps 并编辑 frps.toml 文件。以下是简化的配置,其中设置了 frp 服务器用于接收客户端连接的端口: | ||
|
||
```toml | ||
bindPort = 7000 | ||
``` | ||
|
||
2. 在需要被访问的内网机器上(SSH 服务通常监听在 22 端口)部署 frpc,修改 frpc.ini 文件,假设 frps 所在服务器的公网 IP 为 x.x.x.x: | ||
2. **在需要被访问的内网机器上部署 frpc** | ||
|
||
部署 frpc 并编辑 frpc.toml 文件,假设 frps 所在服务器的公网 IP 地址为 x.x.x.x。以下是示例配置: | ||
|
||
```ini | ||
[common] | ||
server_addr = x.x.x.x | ||
server_port = 7000 | ||
```toml | ||
serverAddr = "x.x.x.x" | ||
serverPort = 7000 | ||
|
||
[ssh] | ||
type = tcp | ||
local_ip = 127.0.0.1 | ||
local_port = 22 | ||
remote_port = 6000 | ||
[[proxies]] | ||
name = "ssh" | ||
type = "tcp" | ||
localIP = "127.0.0.1" | ||
localPort = 22 | ||
remotePort = 6000 | ||
``` | ||
|
||
`local_ip` 和 `local_port` 配置为本地需要暴露到公网的服务地址和端口。`remote_port` 表示在 frp 服务端监听的端口,访问此端口的流量将会被转发到本地服务对应的端口。 | ||
* `localIP` 和 `localPort` 配置为需要从公网访问的内网服务的地址和端口。 | ||
* `remotePort` 表示在 frp 服务端监听的端口,访问此端口的流量将被转发到本地服务的相应端口。 | ||
|
||
3. 分别启动 frps 和 frpc。 | ||
3. **启动 frps 和 frpc** | ||
|
||
4. 通过 SSH 访问内网机器,假设用户名为 test: | ||
4. **通过 SSH 访问内网机器** | ||
|
||
`ssh -oPort=6000 [email protected]` | ||
使用以下命令通过 SSH 访问内网机器,假设用户名为 test: | ||
|
||
```bash | ||
ssh -o Port=6000 [email protected] | ||
``` | ||
|
||
frp 会将请求 `x.x.x.x:6000` 的流量转发到内网机器的 22 端口。 | ||
frp 将请求发送到 `x.x.x.x:6000` 的流量转发到内网机器的 22 端口。 |
Oops, something went wrong.