[GH-ISSUE #3317] Autorun on OpenWRT #2658

Closed
opened 2026-05-05 13:42:52 -06:00 by gitea-mirror · 11 comments
Owner

Originally created by @lavinkabul on GitHub (Feb 17, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3317

Describe the feature request

I am new to linux and OpenWRT in particular. I installed the frp server on my Ubuntu VPS using the auto-installation script and it was automatically added to startup. How to do the same with frp client on router with OpenWRT? Maybe there is a universal auto-installation script, with the subsequent ability to edit the configuration from luci?
In addition, my VPS sometimes reboots (due to the fault of the provider), I would like the frp client to constantly try to reconnect when it loses connection with the server (for example, with a pause of 5 minutes).
Could you tell me how to do this?
I have OpenWRT 21.02.5

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @lavinkabul on GitHub (Feb 17, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3317 ### Describe the feature request I am new to linux and OpenWRT in particular. I installed the frp server on my Ubuntu VPS using the auto-installation script and it was automatically added to startup. How to do the same with frp client on router with OpenWRT? Maybe there is a universal auto-installation script, with the subsequent ability to edit the configuration from luci? In addition, my VPS sometimes reboots (due to the fault of the provider), I would like the frp client to constantly try to reconnect when it loses connection with the server (for example, with a pause of 5 minutes). Could you tell me how to do this? I have OpenWRT 21.02.5 ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [X] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:42:52 -06:00
Author
Owner

@guokun1998 commented on GitHub (Feb 17, 2023):

Openwrt is base on Linux. You should kown your openwrt arch. It is usually arm64/misple/etc. And you can find releases package in https://github.com/fatedier/frp/releases.
Like, frp_0.47.0_linux_arm64.tar.gz

<!-- gh-comment-id:1434164403 --> @guokun1998 commented on GitHub (Feb 17, 2023): Openwrt is base on Linux. You should kown your openwrt arch. It is usually arm64/misple/etc. And you can find releases package in `https://github.com/fatedier/frp/releases`. Like, [frp_0.47.0_linux_arm64.tar.gz](https://github.com/fatedier/frp/releases/download/v0.47.0/frp_0.47.0_linux_arm64.tar.gz)
Author
Owner

@lavinkabul commented on GitHub (Feb 17, 2023):

I have already installed frpc on OpenWRT and configured to work with remote frps server on Ubuntu OS. Everything works fine until restarting the router (Openwrt). After rebooting the router, frpc does not start on the router. Therefore, I would like to somehow register in autoload and cyclic restart of frpc, if suddenly the remote server where frps is located was not available for some time (for example, there was no Internet or the remote server rebooted)

<!-- gh-comment-id:1434194744 --> @lavinkabul commented on GitHub (Feb 17, 2023): I have already installed frpc on OpenWRT and configured to work with remote frps server on Ubuntu OS. Everything works fine until restarting the router (Openwrt). After rebooting the router, frpc does not start on the router. Therefore, I would like to somehow register in autoload and cyclic restart of frpc, if suddenly the remote server where frps is located was not available for some time (for example, there was no Internet or the remote server rebooted)
Author
Owner

@guokun1998 commented on GitHub (Feb 17, 2023):

  1. Run server
  2. Run client
  3. Stop server
  4. wait
  5. Restart server

client log is :

2023/02/17 15:22:37 [I] [control.go:242] [33bc36f644381f25] control writer is closing
2023/02/17 15:22:37 [I] [visitor_manager.go:60] [33bc36f644381f25] gracefully shutdown visitor manager
2023/02/17 15:22:38 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:22:38 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 1s for another retry
2023/02/17 15:22:39 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:22:40 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 2s for another retry
2023/02/17 15:22:42 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:22:42 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 4s for another retry
2023/02/17 15:22:46 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:22:46 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 8s for another retry
2023/02/17 15:22:54 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:22:54 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 16s for another retry
2023/02/17 15:23:09 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:23:09 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry
2023/02/17 15:23:30 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:23:30 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry
2023/02/17 15:23:49 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:23:49 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry
2023/02/17 15:24:10 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:24:10 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry
2023/02/17 15:24:31 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server...
2023/02/17 15:24:32 [I] [service.go:299] [33bc36f644381f25] login to server success, get run id [33bc36f644381f25], server udp port [0]
2023/02/17 15:24:32 [I] [proxy_manager.go:142] [33bc36f644381f25] proxy added: [ssh]
2023/02/17 15:24:32 [I] [control.go:172] [33bc36f644381f25] [ssh] start proxy success

When server close, clinet will reconnect.
I am using v0.47.0.

<!-- gh-comment-id:1434231227 --> @guokun1998 commented on GitHub (Feb 17, 2023): 1. Run server 2. Run client 3. Stop server 4. wait 5. Restart server client log is : ``` 2023/02/17 15:22:37 [I] [control.go:242] [33bc36f644381f25] control writer is closing 2023/02/17 15:22:37 [I] [visitor_manager.go:60] [33bc36f644381f25] gracefully shutdown visitor manager 2023/02/17 15:22:38 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:22:38 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 1s for another retry 2023/02/17 15:22:39 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:22:40 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 2s for another retry 2023/02/17 15:22:42 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:22:42 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 4s for another retry 2023/02/17 15:22:46 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:22:46 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 8s for another retry 2023/02/17 15:22:54 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:22:54 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 16s for another retry 2023/02/17 15:23:09 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:23:09 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry 2023/02/17 15:23:30 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:23:30 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry 2023/02/17 15:23:49 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:23:49 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry 2023/02/17 15:24:10 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:24:10 [W] [service.go:214] [33bc36f644381f25] reconnect to server error: dial tcp 192.168.99.61:7000: connect: connection refused, wait 20s for another retry 2023/02/17 15:24:31 [I] [service.go:211] [33bc36f644381f25] try to reconnect to server... 2023/02/17 15:24:32 [I] [service.go:299] [33bc36f644381f25] login to server success, get run id [33bc36f644381f25], server udp port [0] 2023/02/17 15:24:32 [I] [proxy_manager.go:142] [33bc36f644381f25] proxy added: [ssh] 2023/02/17 15:24:32 [I] [control.go:172] [33bc36f644381f25] [ssh] start proxy success ``` When server close, clinet will reconnect. I am using v0.47.0.
Author
Owner

@lavinkabul commented on GitHub (Feb 17, 2023):

When OpenWRT restarts, frpc does not start automatically. I need to do it manually

<!-- gh-comment-id:1434238721 --> @lavinkabul commented on GitHub (Feb 17, 2023): When OpenWRT restarts, frpc does not start automatically. I need to do it manually
Author
Owner

@guokun1998 commented on GitHub (Feb 17, 2023):

It can use init.d bash in OpenWRT.

<!-- gh-comment-id:1434250854 --> @guokun1998 commented on GitHub (Feb 17, 2023): It can use `init.d` bash in OpenWRT.
Author
Owner

@lavinkabul commented on GitHub (Feb 18, 2023):

I created a file in /etc/init.d/frpc and wrote to it:

START=99
USE_PROCD=1

start_service() {
    procd_open_instance "frpc"
    procd_set_param command /root/frpc -c /root/frpc.ini
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_set_param user root
    procd_close_instance
}

Did chmod 755 (rwxr-xr-x) for this file.

Next, frpc and frpc.ini placed in the /root folder
Also did chmod 755 (rwxr-xr-x)

From the ssh command line, I run the command:
/root/frpc -c /root/frpc.ini
and everything works great.
Next, to check the operation of frpc, I reboot the router. But frpc won't start.

I understand that the mistake is in some trifle, but I can not understand what.

<!-- gh-comment-id:1435439884 --> @lavinkabul commented on GitHub (Feb 18, 2023): I created a file in /etc/init.d/frpc and wrote to it: ``` START=99 USE_PROCD=1 start_service() { procd_open_instance "frpc" procd_set_param command /root/frpc -c /root/frpc.ini procd_set_param stdout 1 procd_set_param stderr 1 procd_set_param user root procd_close_instance } ``` Did chmod 755 (rwxr-xr-x) for this file. Next, frpc and frpc.ini placed in the /root folder Also did chmod 755 (rwxr-xr-x) From the ssh command line, I run the command: `/root/frpc -c /root/frpc.ini` and everything works great. Next, to check the operation of frpc, I reboot the router. But frpc won't start. I understand that the mistake is in some trifle, but I can not understand what.
Author
Owner

@Becods commented on GitHub (Feb 18, 2023):

opkg install luci-app-frpc
Then go to openwrt's web management interface to configure.

<!-- gh-comment-id:1435493797 --> @Becods commented on GitHub (Feb 18, 2023): `opkg install luci-app-frpc` Then go to openwrt's web management interface to configure.
Author
Owner

@lavinkabul commented on GitHub (Feb 18, 2023):

opkg install luci-app-frpc
Then go to openwrt's web management interface to configure.

I started from the web interface and started setting up frpc.
For example, what to choose here:
OpenWRT_frpc

I tried different values (root, daemon). But frpc does not start automatically in any way.
Can it be configured somehow through "Scheduled Tasks", could you tell me if such a solution is suitable and how to implement it?

<!-- gh-comment-id:1435794398 --> @lavinkabul commented on GitHub (Feb 18, 2023): > `opkg install luci-app-frpc` > Then go to openwrt's web management interface to configure. I started from the web interface and started setting up frpc. For example, what to choose here: ![OpenWRT_frpc](https://user-images.githubusercontent.com/112599095/219904563-235ed1ca-8921-4022-8076-6aa5dff7a310.jpg) I tried different values (root, daemon). But frpc does not start automatically in any way. Can it be configured somehow through "Scheduled Tasks", could you tell me if such a solution is suitable and how to implement it?
Author
Owner

@lavinkabul commented on GitHub (Feb 19, 2023):

I'll add more. If I manually start frpc at http://192.168.1.1/cgi-bin/luci/admin/system/startup , the fast reverse proxy client starts up fine:
OpenWRT_frpc_start

My guess is that maybe I need to add a pause before starting frpc after the router boots up. Only I don’t know which file to edit for this and which command to write.

<!-- gh-comment-id:1435806710 --> @lavinkabul commented on GitHub (Feb 19, 2023): I'll add more. If I manually start frpc at http://192.168.1.1/cgi-bin/luci/admin/system/startup , the fast reverse proxy client starts up fine: ![OpenWRT_frpc_start](https://user-images.githubusercontent.com/112599095/219906607-a9d7fd7a-107c-4d09-99cf-e2e7637d48ba.jpg) My guess is that maybe I need to add a pause before starting frpc after the router boots up. Only I don’t know which file to edit for this and which command to write.
Author
Owner

@lavinkabul commented on GitHub (Feb 24, 2023):

In general, after searching the Internet, a solution was found. Checking for the presence of a process using the scheduler:

*/1 * * * * root ps -A | grep frpc > /dev/null || /etc/init.d/frpc start

The presence of the frpc process will be checked every minute.

Write it down on the page http://192.168.1.1/cgi-bin/luci/admin/system/crontab

<!-- gh-comment-id:1444129551 --> @lavinkabul commented on GitHub (Feb 24, 2023): In general, after searching the Internet, a solution was found. Checking for the presence of a process using the scheduler: `*/1 * * * * root ps -A | grep frpc > /dev/null || /etc/init.d/frpc start` The presence of the frpc process will be checked every minute. Write it down on the page `http://192.168.1.1/cgi-bin/luci/admin/system/crontab`
Author
Owner

@github-actions[bot] commented on GitHub (Mar 27, 2023):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1484300613 --> @github-actions[bot] commented on GitHub (Mar 27, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#2658
No description provided.