Problems encountered when using frp connect: connection refuseddial tcp xxxx:7000: connect: connection refused

The project I am working on recently requires the use of frp as a proxy to connect to the local intranet machine. When I finally start the client, I get an error message: login to server failed: dial tcp xxxx:7000: connect: connection refuseddial tcp xxxx:7000: connect : connection refused! ! I have found many ways to try, and now I will list them for you. I hope it will be helpful to you.

  1. basic usage of frp

download frp

Search github and download to frp, server frps/client frpc. . When downloading, pay attention to the CPU version of your local intranet machine and the server CPU architecture.

My computer is a mac M1PRO version. The download is: darwinarm64

The server is

1. Modify the frps.ini file and set the listening HTTP request port to 8080:

[common]
bind_port = 7000
vhost_http_port = 8080

2. Modify the frpc.ini file, assuming that the IP of the server where frps is located is xxxx, local_port is the listening port of the Web service on the local machine, and the bound custom domain name is custom_domains.

 [common]
server_addr = x.x.x.x
server_port = 7000

[web]
type = http
local_port = 80
custom_domains = www.yourdomain.com

[web2]
type = http
local_port = 8080
custom_domains = www.yourdomain2.com

3. Start frps and frpc respectively.

4. Resolve the domain name A records of www.yourdomain.com and www.yourdomain2.com to IP xxxx. If the server already has the corresponding domain name, you can also resolve the CNAME record to the server's original domain name. Or you can achieve the same effect by modifying the Host field of the HTTP request.

5. Visit http://www.yourdomain.com:8080 through the browser to access the service on port 80 on the intranet machine. Visit http://www.yourdomain2.com:8080 to access the intranet machine. Service on port 8080.

First start the server frps, start the command:

nohup ./frps -c frps.ini >/dev/null 2>&1 &

Client startup instructions:

./frpc -c frpc.ini

2. Problems encountered when starting the client: login to server failed: dial tcp xxxx:7000: connect: connection refuseddial tcp xxxx:7000: connect: connection refused

Solve the problem:

First check whether the server has started successfully. The success prompt is as follows:

frps uses config file: frps.ini
frps tcp listen on 0.0.0.0:7000
http service listen on 0.0.0.0:8080
frps started successfully

Prompt when starting the client:

login to server failed: dial tcp xxxx:7000: connect: connection refuseddial tcp xxxx:7000: connect: connection refused

  1. Check whether the server has released ports 7000 and 8080

  1. Check whether the contos server firewall has open ports 7000 and 8080

1. Open port 7000

firewall-cmd --zone=public --add-port=7000/tcp --permanent 

2. The configuration takes effect immediately

firewall-cmd --reload  

3. View all open ports on the firewall

firewall-cmd --zone=public --list-ports

Start again on local client: ./frpc -c frpc.ini

problem solved! ! ! !

Guess you like

Origin blog.csdn.net/wuzhangting/article/details/129786466