How to access OpenWRT soft routing web interface remotely

In a few simple steps, you can remotely access the openWRT web management interface in a public network environment. Use cpolar intranet penetration to create a secure tunnel to map port 443 of the openWRT web interface panel. No public IP or router is required.

1.openWRT install cpolar

Operate openwrt through ssh connection and download the public key:

wget -O cpolar-public.key http://openwrt.cpolar.com/releases/public.key

Add the public key after the download is complete

opkg-key add cpolar-public.key

Add cpolar’s ​​opkg warehouse source

echo "src/gz cpolar_packages http://openwrt.cpolar.com/releases/packages/$(. /etc/openwrt_release ; echo $DISTRIB_ARCH)"  >>  /etc/opkg/customfeeds.conf

Update repository

opkg update

Then start installing cpolar and execute the following three installation commands to install the three packages:

opkg install cpolar
opkg install luci-app-cpolar
opkg install luci-i18n-cpolar-zh-cn

After the installation is completed, openopenwrt Web管理界⾯, we can see there is service, you can see us belowcpolar内网穿透

image-20230426172304148

After clicking in, you can see the cpolar interface, and then configure it.cpolar Authtoken

image-20230426173631379

Log in to the cpolar official website. If you have not registered an account, you can register an account first, and then click on the left side验证 to view your authentication token.

cpolar官网:https://www.cpolar.com

20230111103532

After that, copy the token viewed on the official website to Auth Token of the openwrt cpolar service interface, and click saveSave after setting.

image-20230426174954224

After successful saving, click 打开Web-UI界面 in the interface to seecpolar web ui 管理界面

image-20230426175417187

Use the account registered on our official website to log in. After logging in, you can manage the tunnel and the installation is complete.

image-20230517171057612

2. Configure the remote access address

We click Tunnel Management - Create Tunnel on the left dashboard. The port of the openWRT web interface panel is443, so we need to create an http tunnel pointing to port 443: < /span>

  • Tunnel name: Customizable, be careful not to repeat it
  • Protocol: http
  • Local address: 443
  • Domain name type: Choose a random domain name
  • Region: Select China VIP

Click创建

image-20230517171141270

After the creation is successful, open the online tunnel list and you can see the address for public network access. There are two public network address access methods, one is http and the other is https.

image-20230517171220016

Then we use one of the https addresses to access it in the browser, and we can see our openWRT web interface. In this way, the remote access is configured, which is very simple.

image-20230517171358491

3. Fixed public network address

When we created the tunnel earlier, we used a free random temporary address. The public network address it generates will change within 24 hours. In order to facilitate long-term and stable connections, we can fix the access address, which is called a fixed second-level subdomain name in cpolar, or You can also configure access using your own domain name. Here we take the cpolar subdomain name as an example

You need to upgrade to the basic package or above to support the configuration of second-level subdomain names.

Log incpolar official website backend, click 预留 on the left dashboard, find < a i=4>, reserve a second-level subdomain name for the http tunnel. 保留二级子域名

  • Region: Select server region
  • Name: Fill in the second-level subdomain name you want to reserve (can be customized)
  • Description: Notes, which can be customized

image-20230517171610261

This example reserves a second-level subdomain namedopenwrtweb. After the subdomain name is successfully reserved, we copy the subdomain name and then configure it into the tunnel.

image-20230517171646513

Open the cpolar web ui management interface. Click 隧道管理——隧道列表 on the left dashboard, find the tunnel that needs to configure the second-level subdomain name, and click on the right编辑

image-20230517171721648

Modify the tunnel information and configure the second-level subdomain name into the tunnel:

  • Domain Type: Select instead二级子域名
  • Sub Domain: Fill in the second-level subdomain name we just reserved (in this case openwrtweb)

After modification is completed, click更新

image-20230517171803892

After the tunnel is updated successfully, click 状态——在线隧道列表 on the left dashboard. You can see that the public network address of the tunnel has been updated to 2 level subdomain name.

image-20230517171831378

Then we use one of the https methods to access it in the browser, and we can see our openwrt interface. In this way, a fixed remote access openWRTweb interface is configured.

image-20230517171946618

Guess you like

Origin blog.csdn.net/st200112266/article/details/134576716