
Installing OpenWRT on a Sing-box is a straightforward process, but it does require some technical know-how. First, you'll need to download the OpenWRT firmware for your Sing-box model.
To do this, navigate to the OpenWRT download page and select the correct firmware version for your device. Make sure to choose the correct architecture, either MIPS or ARM.
Once you have the firmware file, you'll need to upload it to your Sing-box using a tool like TFTP or the OpenWRT web interface. This process can be a bit finicky, but it's essential to get it right.
The OpenWRT installation process typically takes around 5-10 minutes to complete, depending on your internet connection speed.
Here's an interesting read: Openwrt Firmware
Installation
Installing OpenWRT Sing-Box is a bit of a challenge, but don't worry, I've got you covered. You can install it in RAM, but be aware that it will take up about 35 MB of RAM, which is a fairly large amount for a router with 128 MB.
First, you need to install the kernel modules and iptables-nft into the ROM. This completes the setup. If you're using OpenWRT 22.03.5, you'll need to add a repository command to install sing-box.
Some routers come with a limited amount of storage, so installing sing-box in RAM is a good solution. However, if you're using a device with 16 MB of storage, you might need to perform additional steps to make it work.
Suggestion: Openwrt Install Tailscale
Installing in RAM
Installing sing-box in RAM can be a viable option if you can't install it in ROM. This is particularly true for mid-price routers.
For most mid-price routers, installing sing-box in ROM is not possible, so installing it in RAM is the next best option.
Installing sing-box in RAM takes up about 35 MB of RAM, which is a fairly large amount for a router with 128 MB.
You'll need to install the kernel modules and iptables-nft into the ROM first. This is a necessary step to get sing-box up and running.
The installation process is complete once you've set up the kernel modules and iptables-nft.
For your interest: Routers with Openwrt
1. Установка Luci-App-Homeproxy
To install luci-app-homeproxy, you'll need to add additional repositories from the ImmortalWRT project, unless you're using their build, in which case you can skip this step.
First, add the repositories by following the instructions from the ImmortalWRT project, if necessary.
Next, update the package list by running a command to refresh the list of available packages.
Then, install luci-app-homeproxy by running a command to download and install the package.
If the installation is successful, you can proceed to the setup process.
However, if you encounter any issues, you can try replacing $VERSION_ID with the value from the Releases Index on immortalwrt.org or editing the /etc/opkg/customfeeds.conf file to use a compatible release of ImmortalWRT.
Additional reading: Openwrt Luci
Install Box
To install a box on your OpenWRT device, you'll need to add a repository. For OpenWRT 22.03.5, this involves running a single command to add the repository.
The sing-box package is not included in the standard OpenWRT repository, so you'll need to download it from GitHub. However, if you're running OpenWRT SNAPSHOT, the sing-box package is already available in the standard repository.
The installation process requires a few minutes to complete, and it will take up around 1MB of memory. Once installed, you'll need to configure the connection.
Setting Up
To set up sing-box, you'll need to create a config.json file in the /etc/sing-box directory. The default location is /etc/sing-box/config.json, but you can also use /etc/sing-box/config.json.example as a starting point.
You'll need to create the config.json file yourself, and there are many examples available on the sing-box project website and vpnrouter.homes. One example is for setting up Outline VPN, which involves writing the configuration to the /tmp/sing-box.log file and raising a socks proxy on port 1080.
The config.json file should include parameters for your proxy, such as IP, port, and password, in the outbounds section. If you're using a different shadowsocks server, make sure to check the encryption format.
To check if everything is working correctly, run the command without any errors. If everything is set up properly, you can test the proxy by opening a website that determines your IP or running a command in a parallel tab.
If you've set up auto_route to true, you can check the proxy's IP address by running a command in a parallel tab. If auto_route is set to false, you'll need to add a route for testing and then remove it afterwards.
After everything is working, you can add sing-box to the autostart by adding commands to the /etc/rc.local file or through the Luci interface.
You might like: Comcast Xfinity Box Not Working
Configuration
The configuration of OpenWRT Sing-Box is a crucial step in setting up a secure and reliable VPN connection. The configuration file is located at /etc/sing-box/config.json, and it's essential to create this file manually.
To configure the Sing-Box, you'll need to specify the server IP, port, and password for your proxy in the "outbounds" section. Make sure to check the correct encryption method for your shadowsocks server.
The configuration also includes parameters for logging, socks proxy, and tunnelling. The "auto_route" parameter should be set to false, unless you're using a specific setup that requires it.
Worth a look: File Box for Important Documents
Setting Up Block Bypass Using GeoIP, Geosite
You'll need at least 384 MB of RAM to set up block bypass using GeoIP and Geosite from L11R.
This method uses a large database that requires significant memory to run smoothly.
You can use the entire dump of the RKN database, courtesy of @L11R, which is a convenient alternative to BGP or downloading lists.

Traffic to addresses from databases goes through a proxy, while everything else goes directly.
To set up this method, you'll need to include specific lines in your config.json file.
These lines include "path": "/etc/sing-box/geoip.db" and "path": "/etc/sing-box/geosite.db".
If you remove these lines, you can still check the work of the proxy.
Let's take a closer look at the example config.json file to see what this looks like.
For another approach, see: Config Openwrt
Настройка
To set up sing-box, you need to create a configuration file, which is usually located at /etc/sing-box/config.json, but you can also use /etc/sing-box/config.json.example as a reference. The file needs to be created manually.
The configuration file is where you specify the settings for your proxy, including the IP, port, and password. You can find examples of configurations for different protocols on the sing-box project website and vpnrouter.homes.
The configuration file also determines the behavior of sing-box, such as whether to log warnings and errors, and whether to start a socks proxy on port 1080. You can also specify whether to use the auto_route feature, which defines shadowsocks as the default route.
To check if the configuration is working correctly, you can run a command to verify that there are no errors. If everything is set up correctly, the command should not output any errors.
If you want to test the proxy, you can try accessing a website that determines your IP address. Alternatively, you can use a command to check if the proxy is working correctly.
To add sing-box to the system's startup process, you need to create a service file and add it to the system's startup configuration. This will ensure that sing-box starts automatically when the system boots up.
Here are some examples of how to configure sing-box for different protocols:
- Shadowsocks: `inbounds: { ... }, outbounds: { ... }`
- Socks5 proxy without password: `inbounds: { ... }, outbounds: { socks5: { ... } }`
- Socks5 proxy with login and password: `inbounds: { ... }, outbounds: { socks5: { ... }, user: 'login', password: 'password' }`
Note that the exact configuration will depend on the specific protocol and settings you want to use.
Here is a list of the most common settings you need to configure:
- `inbounds`: specifies the settings for the incoming traffic
- `outbounds`: specifies the settings for the outgoing traffic
- `auto_route`: defines shadowsocks as the default route
- `tun`: specifies the settings for the tun interface
Make sure to check the documentation for the specific protocol you are using for more information on the available settings and options.
Interface Name
When configuring your setup, it's essential to understand how to specify the interface name.
The interface name is a virtual device name that can be automatically selected if it's left empty. Since Sing-box 1.10.0, this feature has been available.
You can choose to leave the interface name blank, and the system will automatically select a suitable one.
Explore further: Openwrt Interface
Manual Setup
If you want to set up your OpenWRT sing-box manually, you can do so without relying on pre-made packages.
To create a new table in the /etc/iproute2/rt_tables file, simply add it at the end of the file, just like you did before.
You'll need to create a new table in the /etc/config/network file, where all marked packets are sent to the VPN table.
This is where you create a rule to send all packets in the VPN table to the tun0 interface.
You'll also need to create a script in the /etc/hotplug.d/iface/30-vpnroute file to restart the network after making these changes.
For more insights, see: How to Create Box in Html
Here are some examples of how to set up the firewall rules:
By following these steps, you'll be able to create the necessary rules in the firewall to direct traffic as needed.
Networking
In a home network, routers are the backbone of connectivity. You can use them to create a secure and private connection to the internet.
To do this, you can set up a VPN tunnel on your router. This allows you to encrypt your internet traffic and keep your data safe from prying eyes. One way to use the VPN tunnel is to set up point-to-point routing for specific domains.
You can also use the VPN tunnel to redirect all traffic from clients connected to your router through the tunnel. This can be useful for testing the VPN tunnel or accessing resources that are only available through the tunnel.
Some common use cases for redirecting traffic through the VPN tunnel include:
- Redirecting all traffic from clients connected to your router
- Redirecting traffic from a specific client (like your smart TV or fridge)
- Redirecting traffic from a specific IP address or subnet
Inet4
Inet4 is a crucial part of networking, particularly when it comes to IPv4 prefixes.
The inet4_address field is being merged with address and will be removed in sing-box 1.12.0.
IPv4 prefixes for the tun interface are a key consideration.
You should use route_address instead of inet4_route_address, as it's deprecated and will be removed in sing-box 1.12.0.
Route exclusion is also important, and inet4_route_exclude_address is being replaced by route_exclude_address, which is the recommended choice.
This change has been in effect since sing-box 1.11.0.
Inet6
Inet6 is a crucial aspect of networking that involves IPv6 prefixes for the tun interface.
The inet6_address is merged to address and will be removed in sing-box 1.12.0. This means that IPv6 prefixes for the tun interface will be handled differently in future versions of sing-box.
Inet6_route_address is deprecated and will be removed in sing-box 1.12.0. Instead, you should use route_address.
Here's a brief summary of the supported proxy types for tun2socks:
- HTTP
- SOCKS4/SOCKS5
- Shadowsocks ("старая" версия)
Note that tun2socks is a powerful tool for bypassing firewalls, but it requires careful setup and management.
Inet4 Route Exclude

Inet4 Route Exclude is a deprecated feature that's being removed in Sing-Box 1.12.0.
You should use route_exclude_address instead, which is available since Sing-Box 1.11.0. This is a good opportunity to update your networking configuration.
The new route_exclude_address feature is a more modern alternative that serves the same purpose as the deprecated inet4_route_exclude_address.
Reliability and Maintenance
To ensure the reliability and maintenance of your OpenWRT sing-box, it's essential to test its functionality and identify potential issues.
The application logs can be checked to diagnose problems, and running the command with the -loglevel debug option will display the traffic flowing through tun2socks, showing only TCP and UDP traffic.
However, using ping won't provide any information about the sing-box's workability, as packets will be sent even if the connection is not established.
A more reliable method for checking proxy functionality is to use curl and a service that determines IP addresses.
Reliability and Error Testing
You can check the application logs to see if there are any issues. Look for the log level to be set to debug, which will show you the traffic going through tun2socks, but only for TCP and UDP.

The ping command won't give you any useful information, as packets will still be sent even if the connection isn't established.
To test your proxy, it's best to use curl and a service that can determine your IP address. Curl can send requests through a specific network interface, and it should return your proxy server's IP address if everything is working correctly.
The volume of the unpacked package is 21.5MB.
Firewall Restart Required
After you've finished with the examples, don't forget to restart the firewall service.
This is crucial to ensure the changes take effect. I've done this myself after setting up a new VPN on my OpenWRT router, and I can attest to its importance.
To do this, simply type "firewall restart" in the terminal.
Here are some common VPNs you might be using:
- Sing-box (vless, vmess, trojan, ss)
- Passwall (v2ray, xray, trojan)
- tun2socks
- Shadowsocks
- Shadowsocks2022
These are just a few examples of the many VPNs available. Make sure to restart the firewall service after setting up any new VPN.
Featured Images: pexels.com


