Cross-Platform Internal Network Penetration with FRP: Setup and Auto-Start Configuration
This guide uses a Windows machine as the client and an Ubuntu server accessible via a public IP, such as a cloud instance from providers like Tancent or Alibaba.
FRP (Fast Reverse Proxy) is an internal network penetration tool designed to expose services from a private network to the public internet. It operates using a client-server model to forward and proxy network traffic.
Key characteristics include:
- Reverse Proxy: FRP can map internal services like web applications, SSH, or FTP to public endpoints through reverse proxy configurations.
- Multi-Platform Support: Clients and servers are available for Windows, Linux, and macOS.
- Security: Supports TLS/SSL encryption for secure data trensmission.
- Configuration Simplicity: Service mapping is managed through configuration files.
- Efficiency: Built with Go, it is lightweight and performant.
Common applications include remote access to internal resources, development environment exposure for external testing, and traversing NAT or firewalls.
Obtaining FRP
Download the latest release from the official GitHub repository: https://github.com/fatedier/frp. Select the appropriate archive for your operating system and architecture.
Configuring the Ubuntu Server
After transferring the downloaded archive to the server, extract it:
tar -zxvf frp_0.60.0_linux_amd64.tar.gz
Optionally, rename the extracted directory:
mv frp_0.60.0_linux_amd64 frp_server
Navigate into the server directory. For a server setup, you only need the frps binary and its configuration file. Edit the server configuration:
sudo nano frps.toml
A minimal configuration includes:
bindPort = 7000
auth.method = "token"
auth.token = "your_secure_token_here"
Note: The newer TOML format requires strings to be quoted. Start the server manually to test:
./frps -c ./frps.toml
Refer to the official documentation for advanced server options: https://gofrp.org/zh-cn/docs/reference/server-configures/
Configuring the Windows Client
Extract the Windows archive. For the client, you need the frpc.exe binary and its configuration file. Edit frpc.toml:
serverAddr = "your.server.public.ip"
serverPort = 7000
auth.method = "token"
auth.token = "your_secure_token_here"
[[proxies]]
name = "web_app"
type = "tcp"
localIP = "127.0.0.1"
localPort = 8080
remotePort = 6000
Save the file and launch the client from Command Prompt in the directory:
frpc.exe -c frpc.toml
Consult the client configuration reference for more options: https://gofrp.org/zh-cn/docs/reference/client-configures/
Verification
With both client and server running, a service running locally on the Windows client (e.g., on localhost:8080) should now be accessible via your.server.public.ip:6000.
Configuring Automatic Startup
Ubuntu Server (using systemd) Create a systemd service file:
sudo nano /etc/systemd/system/frps.service
Add the following content, adjusting the ExecStart path:
[Unit]
Description=FRP Server Service
After=network.target
[Service]
Type=simple
User=ubuntu
ExecStart=/home/ubuntu/frp_server/frps -c /home/ubuntu/frp_server/frps.toml
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable frps.service
sudo systemctl start frps.service
Use sudo systemctl status frps.service to verify it's running.
Windows Client (using Startup Folder)
Create a batch file (e.g., start_frpc.bat) in the FRP client directory with the following content, ensuring the path is correct:
@echo off
cd /d "C:\Path\To\Your\frp_client"
start /B frpc.exe -c frpc.toml
Create a shortcut to this batch file. Press Win + R, type shell:startup, and place the shortcut in the opened Startup folder. The client will launch on user login.