How to set up 404 VPN on a router
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
- OpenWrt 23.05 or newer with at least 32 MB of free flash and 256 MB of RAM, or a Keenetic model that supports the Entware package repository.
- SSH access to the router.
- A single VLESS key from the VPN tab of your dashboard. Routers need one fixed key rather than the subscription link.
- A paid plan: the router counts as one device and runs around the clock.
How to set up OpenWrt with sing-box
- SSH into the router and install the package:
opkg update && opkg install sing-box. - Create
/etc/sing-box/config.json. The minimal config has onetuninbound and onevlessoutbound. Copy the server address, port, UUID, public key and short ID from the dashboard key into the outbound. - Enable and start the service:
service sing-box enable && service sing-box start. - Add a firewall zone for the
tun0interface and forward the LAN zone to it in LuCI, Network, Firewall. - Point LAN DNS to a resolver that is reached through the tunnel, for example
1.1.1.1, in Network, DHCP and DNS. - 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:
- Enable the OPKG component in the Keenetic web interface and install Entware on a USB stick or the internal storage.
- SSH into Entware and run
opkg install xray. - Put the VLESS outbound into
/opt/etc/xray/config.jsonwith adokodemo-doorinbound on port 1080. - Add a policy in Keenetic's web interface that sends chosen devices or the whole network through the proxy.
- Verify from a device on the network.
What does not work
- Stock firmware from TP-Link, ASUS, Netgear and others. Their VPN client speaks OpenVPN or WireGuard, not VLESS. Where your dashboard offers a WireGuard configuration for a location, such a router can use it, but WireGuard is the first thing filtered on restrictive networks.
- ISP-provided routers. Usually locked and cannot run third-party firmware.
- Routers with 16 MB of flash. sing-box does not fit. Use the TP-Link Archer line or GL.iNet models with 128 MB or more.
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.