← All articles

OpenWrt + sing-box: a working VLESS Reality config for routers

Setup · October 27, 2026 · Updated November 18, 2026 · 3 min read · 404 VPN team

This is the config we run on an OpenWrt router to send every device at home through 404 VPN over VLESS with Reality. It uses sing-box, a TUN inbound and one VLESS outbound. Paste it, fill in five values from your key, add the firewall zone, point DNS through the tunnel. Fifteen minutes on a router with 128 MB of flash.

Prerequisites are on the router page: OpenWrt 23.05 or newer, SSH access, and a paid plan.

1. Install sing-box

opkg update
opkg install sing-box kmod-tun

2. The config

Save as /etc/sing-box/config.json. Replace the six placeholders with values from a Reality key in your dashboard: SERVER_IP, SERVER_PORT, UUID, SNI, PUBLIC_KEY, SHORT_ID. See what each part of the key means.

{
  "log": { "level": "warn" },
  "dns": {
    "servers": [
      { "tag": "remote", "address": "https://1.1.1.1/dns-query", "detour": "vpn" },
      { "tag": "local", "address": "local", "detour": "direct" }
    ],
    "rules": [ { "outbound": "any", "server": "local" } ],
    "final": "remote"
  },
  "inbounds": [
    {
      "type": "tun", "tag": "tun-in",
      "interface_name": "tun0",
      "address": [ "172.19.0.1/30" ],
      "auto_route": false,
      "stack": "system",
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "vless", "tag": "vpn",
      "server": "SERVER_IP", "server_port": SERVER_PORT,
      "uuid": "UUID",
      "flow": "xtls-rprx-vision",
      "tls": {
        "enabled": true,
        "server_name": "SNI",
        "utls": { "enabled": true, "fingerprint": "chrome" },
        "reality": { "enabled": true, "public_key": "PUBLIC_KEY", "short_id": "SHORT_ID" }
      }
    },
    { "type": "direct", "tag": "direct" }
  ],
  "route": {
    "rules": [ { "ip_is_private": true, "outbound": "direct" } ],
    "final": "vpn"
  }
}

auto_route is off on purpose: on OpenWrt the firewall decides what goes into the tunnel, which keeps the router's own management traffic and the LAN direct.

3. Start it

service sing-box enable
service sing-box start
logread -e sing-box | tail

The log should show the TUN interface up and no errors. invalid short id or handshake errors mean a placeholder is wrong.

4. Firewall

In LuCI: Network, Interfaces, add interface vpn with protocol Unmanaged on device tun0. Then Network, Firewall, add zone vpn covering that interface, masquerading on, input Reject, output Accept, forward Reject. Edit the lan zone and allow forward to vpn. Remove lan to wan forwarding if you want a strict kill switch, so nothing leaves without the tunnel.

Finally add a route so LAN traffic enters the TUN: Network, Routing, static IPv4 route, interface vpn, target 0.0.0.0/0, metric 10.

5. DNS

Nothing to change: with the config above, sing-box resolves every client query through the tunnel at 1.1.1.1 and only the router's own lookups go direct. Leave clients receiving the router as their DNS server, which is the OpenWrt default.

6. Test

From a laptop on the Wi-Fi open What is my IP; it should show Netherlands. Then run the speed test on a wired device to see what the router's CPU delivers.

Fallback transport

Reality is one outbound. If a network ever filters it, add a second VLESS outbound from a WebSocket key of the same location: "server_port": 443, no reality block, "tls": { "enabled": true, "server_name": "SNI_FROM_THE_WS_KEY" } and "transport": { "type": "ws", "path": "PATH_FROM_THE_WS_KEY" }. Put both in a urltest selector and set final to the selector; sing-box then switches on its own.

FAQ

Does this work on 16 MB flash routers?

No. sing-box needs around 20 MB. Use a 128 MB device.

Can I use Xray instead of sing-box?

Yes; the outbound block is nearly identical. We use sing-box because its TUN inbound is simpler to set up on OpenWrt.

How do I route only some devices?

Change the route rules: add { "source_ip_cidr": [ "192.168.1.50/32" ], "outbound": "vpn" } for the devices you want and set final to direct.

Will the config survive an OpenWrt upgrade?

Add /etc/sing-box/config.json to System, Backup, Configuration, custom files. Packages need reinstalling after a sysupgrade.