frp内网穿透搭建

使用nps穿透,因为自带socks代理,会被腾讯云和阿里云封禁,故采用功能单一的frp进行内网穿透。

  1. frp使用GO语言编写,所以无平台限制,官网下载对应平台程序。

    ssh 到服务器,可直接 wget frp 下来
    mv 进行改名
    修改 frps.ini 文件
    ./frps -c frps.ini
    nohup ./frps -c ./frps.ini &    // 后台启动
    //运行
    nohup ./frps -c frps.ini >/dev/null 2>&1 &  
    //查找服务
    ps -aux|grep frp| grep -v grep
    [1]12345
    //kill进程
    kill -9 12345
  2. 首先配置服务端,将程序上传至拥有公网的云服务器上,配置frps.ini文件,具体如下:

    [common]
    bind_port = 7000
    kcp_bind_port = 7000
    bind_udp_port = 7001
    token = xxxxxx
    dashboard_port = 7500
    dashboard_user = admin
    dashboard_pwd = xxxxxx
    enable_prometheus = true
    log_file = C:\\Users\\xxxxxx\\Desktop\\frp_0.43.0_windows_386\\frps.log
    log_level = info
    log_max_days = 3
  3. 配置内网被控客户端,修改frpc.ini文件,如下:

    [common]
    server_addr = xx.xx.xx.xx #云服务器IP
    server_port = 7000
    protocol = kcp
    tcp_mux = true
    token =  xxxxxx
    [rdp-318]
    type = tcp
    local_ip = 127.0.0.1
    local_port = 本机内网被控客户端rdp端口
    remote_port = 公网远程rdp端口 #可设置为local_port相同端口
    [rdp-udp-318]
    type = udp
    local_ip = 127.0.0.1
    local_port = 本机内网被控客户端rdp端口
    remote_port = 公网远程rdp端口 #可设置为local_port相同端口
  4. 隐藏窗口运行,创建文件start.vbs,内容如下:

    Set ws = CreateObject("Wscript.Shell")
    ws.run "cmd /c D:\frp_0.43.0\frpc.exe -c D:\frp_0.43.0\frpc.ini",vbhide
  5. 配置完毕。

参考链接:
https://www.0z.gs/soso/817.html
https://www.612ch.com/78.html
https://zhuanlan.zhihu.com/p/479551971
https://gofrp.org/
https://zhuanlan.zhihu.com/p/448305084
https://conimi.com/archives/128/#%E7%8E%AF%E5%A2%83
http://blog.demon.ren/685.html
https://learnku.com/articles/45769

本文链接:

https://ma.ge/archives/612.html