逍遥游

不废话,直接上流程

服务区端

mt7621的cpu的一个路由器 ,跑mipsle的程序,

客户端

这个客户端时一个wr703n的路由器, 用来做mqtt server , 跑mips程序,其中把web控制页面透过frp共享出去. 端口为80 .

frpc.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[common]
server_addr = xxx.xxx.com
server_port = 7000


# decide if exit program when first login failed, otherwise continuous relogin to frps
# default is true
login_fail_exit = true


# auth token
token = xxxxxxxxxxxxx


#[ssh]
#type = tcp
#local_ip = 127.0.0.1
#local_port = 22
#remote_port = 6000


[tai_web]
type = http
local_port = 80
privilege_mode = true
custom_domains = abc.abc.com

custom_domains = abc.abc.com 这个域名必须域名解析器加上,让其解析到 服务器ip,或者服务器的域名.

下面自启动进程

必须先安装 nohup

1
2
opkg update
opkg install coreutils-nohup

增加下面这个文件

/etc/init.d/frpc

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org

START=99

start() {
sleep 60; nohup /root/frp_0.35.1_linux_mips/frpc -c /root/frp_0.35.1_linux_mips/frpc.ini >/tmp/nohup.out 2>&1 &
}

stop() {
kill -9 `ps | grep '/root/frp_0.35.1_linux_mips/frpc' | grep -v 'grep' | awk '{print $1}'`
}

在/etc/rc.d/ 增加一个链接文件

ln -s /etc/init.d/frpc /etc/rc.d/S99frpc