Skip to content

Homelab - Intranet Penetration Tool frp

frp is a method for intranet penetration. You can expose internal host ports to the internet through a server with a public IP. frp supports various protocols such as TCP, UDP, HTTP, and HTTPS.

Server-side frps Deployment (Docker Compose)

First, create a compose.yaml file and paste the following content:

compose.yaml
version: "3"
services:
  frps:
    container_name: ${STACK_NAME}_app
    image: fatedier/frps:${APP_VERSION}
    network_mode: host
    volumes:
      - ${STACK_DIR}/frps.toml:/etc/frp/frps.toml
    command: "-c /etc/frp/frps.toml"
    restart: always

(Optional) It is recommended to create a .env file in the same directory as compose.yaml and customize your environment variables. If you prefer not to use environment variables, you can also directly customize your parameters within compose.yaml (such as replacing ${STACK_NAME} with frps).

.env
STACK_NAME=frps
STACK_DIR=/DATA/AppData/frps # Customize the project storage path, for example, ./frps

# frps
APP_VERSION=v0.56.0

Add a configuration file frps.ini to your project storage path ${STACK_DIR}:

frpc.toml
bindAddr = "0.0.0.0"
bindPort = 7000 # The frp port opened by the server, which needs to match the settings of frpc later on

kcpBindPort = 7000

transport.maxPoolCount = 5

webServer.addr = "0.0.0.0" # Address of the panel, must be 0.0.0.0 for external access
webServer.port = 7500 # frps panel port
webServer.user = "xxxxxx" # Panel username
webServer.password = "xxxxxx" # Password

auth.method = "token"
auth.token = "xxxxxx" # Custom token, which needs to match frpc

allowPorts = [
  { start = 2000, end = 3000 },
  { single = 3001 },
  { single = 3003 },
  { start = 4000, end = 50000 }
]

Finally, run the docker compose up -d command in the directory where compose.yaml is located to start the orchestrated containers.

If you prefer not to use Docker, you can also refer to this article: Server Configuration: How to Implement Remote Desktop Access over the Internet (frp).

Client-side frpc Deployment (Docker Compose)

First, create a compose.yaml file and paste the following content:

compose.yaml
version: "3"
services:
  frpc:
    container_name: ${STACK_NAME}_app
    image: fatedier/frpc:${APP_VERSION}
    network_mode: host
    volumes:
      - ${STACK_DIR}/frpc.toml:/etc/frp/frpc.toml
    command: "-c /etc/frp/frpc.toml"
    restart: always

(Optional) It is recommended to create a .env file in the same directory as compose.yaml, and customize your own environment variables. If you prefer not to use environment variables, you can also directly customize your parameters in compose.yaml (such as replacing ${STACK_NAME} with frpc).

.env
STACK_NAME=frpc
STACK_DIR=/DATA/AppData/frpc # Customize the project storage path, e.g., ./frpc

# frpc
APP_VERSION=v0.56.0

Add a configuration file frps.toml in your project storage path ${STACK_DIR}:

frpc.toml
user = "client-device-1" # Current device name

serverAddr = xx.xx.xx.xx # Public IP of the server
serverPort = 7000 # frp port opened by the server, should match the setting in frps

auth.method = "token"
auth.token = "xxxxxx" # Should match the setting in frps

transport.poolCount = 5

[[proxies]]
name = "app-name" # Application name
type = "tcp"
remotePort = xx # Public port for access
localIP = "127.0.0.1"
localPort = xx # Local port number

Finally, run the command docker compose up -d in the same directory as compose.yaml to start the orchestrated containers.

Configuration Explanation

Please ensure that the format of the toml file is correct, otherwise the service may not start properly. You can use a Toml online editor and validator to check.

References and Acknowledgments

Original: https://wiki-power.com/
This post is protected by CC BY-NC-SA 4.0 agreement, should be reproduced with attribution.

This post is translated using ChatGPT, please feedback if any omissions.