How to set up 404 VPN on a router

OpenWrt 23.05+ or Keeneticsing-box or Xrayabout 15 minpaid plan

A router with the tunnel built in covers every device at home, including TVs and consoles that cannot run a VPN app. It needs a router that runs OpenWrt or Keenetic firmware and roughly fifteen minutes. Stock firmware from most brands cannot do VLESS; the section at the end explains why.

Requirements

How to set up OpenWrt with sing-box

  1. SSH into the router and install the package: opkg update && opkg install sing-box.
  2. Create /etc/sing-box/config.json. The minimal config has one tun inbound and one vless outbound. Copy the server address, port, UUID, public key and short ID from the dashboard key into the outbound.
  3. Enable and start the service: service sing-box enable && service sing-box start.
  4. Add a firewall zone for the tun0 interface and forward the LAN zone to it in LuCI, Network, Firewall.
  5. Point LAN DNS to a resolver that is reached through the tunnel, for example 1.1.1.1, in Network, DHCP and DNS.
  6. From a laptop on the Wi-Fi open What is my IP.

A complete config file with comments, and a variant with Xray instead of sing-box, is in the blog.

Keenetic

Keenetic routers can run Xray through Entware:

  1. Enable the OPKG component in the Keenetic web interface and install Entware on a USB stick or the internal storage.
  2. SSH into Entware and run opkg install xray.
  3. Put the VLESS outbound into /opt/etc/xray/config.json with a dokodemo-door inbound on port 1080.
  4. Add a policy in Keenetic's web interface that sends chosen devices or the whole network through the proxy.
  5. Verify from a device on the network.

What does not work

Split routing

If you want only some devices through the tunnel, give them a separate VLAN or a static IP range on OpenWrt and apply the firewall forward rule only to that range. Keenetic does this with per-device policies in the web interface. Everything else stays on the regular connection.

FAQ

Which router do you recommend?

A GL.iNet model with OpenWrt preinstalled and at least 128 MB of flash, or a Keenetic Giga or Ultra if you prefer Keenetic's interface.

Does a router count as one device?

Yes, one device regardless of how many clients sit behind it.

Can I combine router VPN with the app on my phone?

Yes. On Wi-Fi at home the router covers you; outside, the app does. Both use the same subscription.

What speed should I expect?

CPU-bound. Encryption runs on the router's processor, so a quad-core router is several times faster than an older dual-core one. Measure with the speed test on a wired device before and after.

Does the kill switch exist on a router?

Yes, by design: if the firewall forwards LAN only to the tunnel interface, there is no path to the internet while the tunnel is down.