Bypass gateway: disable DHCP, set client gateway/DNS, and switch back
Pick the mode: one-arm bypass vs WAN-enabled gateway
Section titled “Pick the mode: one-arm bypass vs WAN-enabled gateway”| Mode | OpenWrt interfaces | Who serves DHCP | Client gateway/DNS | Tested here |
|---|---|---|---|---|
| One-arm bypass | LAN only, no WAN | upstream main router | bypass LAN IP | no (E1 steps) |
| WAN-enabled gateway | LAN + WAN | upstream or bypass | bypass LAN IP | E2 |
Both can “send clients through OpenWrt”, but failure points differ:
- one-arm bypass: without DHCP/NAT, the main router must know the return route, or the bypass must NAT;
- WAN-enabled: OpenWrt gets its own WAN address and NATs LAN clients; this is the lab mode.
Do not say “bypass works” without saying whether it has WAN and who does DHCP.
Lab topology
Section titled “Lab topology”Upstream 192.168.50.1 │ WAN eth1 (DHCP 192.168.50.5/24) │ OpenWrt VM 200 │ LAN br-lan 192.168.1.2/24 │ DHCP disabled Client 192.168.1.100/24 gateway/DNS = 192.168.1.2- There is no
.1on this LAN, avoiding the upstream/main-router conflict; - clients must be static;
- with DHCP off, DHCP requests get no answer by design.
Configuration
Section titled “Configuration”uci show network.lanuci show network.wanuci show dhcp.lancp /etc/config/network /etc/config/network.bak.$(date +%F)cp /etc/config/dhcp /etc/config/dhcp.bak.$(date +%F)Keep console access; the old LAN IP dies immediately.
ExpectedYou know the LAN IP, WAN protocol and DHCP state.
Network → Interfaces → LAN → Edit:
- IPv4 address:
192.168.1.2/24; - DHCP Server → General → Ignore interface;
- Save and apply.
CLI equivalent:
uci set network.lan.ipaddr='192.168.1.2/24'uci set dhcp.lan.ignore='1'uci commit networkuci commit dhcp/etc/init.d/network reload/etc/init.d/dnsmasq restartThen reopen LuCI/SSH at 192.168.1.2.
ExpectedLAN is 192.168.1.2/24 and DHCP no longer hands out addresses.
ubus call network.interface.wan statusip -4 addr show eth1ip routeuci show firewall | grep -E 'zone|masquerade|forward'This lab used WAN 192.168.50.5/24, gateway 192.168.50.1; LAN clients NAT through OpenWrt.
ExpectedWAN has an address and LAN→WAN forwarding/NAT works.
# Linux exampleip addr add 192.168.1.100/24 dev eth0ip route add default via 192.168.1.2echo 'nameserver 192.168.1.2' > /etc/resolv.confping -c 2 192.168.1.2ping -c 2 1.1.1.1nslookup openwrt.org 192.168.1.2Windows: set IP, gateway and DNS manually; do not keep the old DHCP address.
ExpectedClient gateway/DNS are 192.168.1.2; public IP and DNS work.
# Linux exampleudhcpc -i eth0 -f -q -n -t 3This lab printed no lease, failing; the static address still pinged/resolved. If you still get a lease, a second DHCP server exists or ignore did not apply.
ExpectedDHCP gets no offer; the static configuration still works.
# public DNSnslookup openwrt.org 1.1.1.1# dead gatewayip route replace default via 192.168.1.250ping -c 2 1.1.1.1# restoreip route replace default via 192.168.1.2This lab: public DNS worked; .250 gave 100% loss; restoring .2 recovered.
ExpectedSeparate DNS failure from gateway failure.
One-arm bypass (E1, not tested here)
Section titled “One-arm bypass (E1, not tested here)”LAN-only, no WAN:
- bypass LAN
192.168.1.2/24, gateway to the main router192.168.1.1; - disable bypass DHCP;
- client gateway/DNS
.2; - enable forwarding; the main router needs a return route, or the bypass NATs LAN traffic;
- the main router firewall must allow client→internet forwarding.
No main-router lab was available, so this part is E1, not E2; verify against your router/firewall.
Common failures
Section titled “Common failures”Cannot reach the bypass after changing LAN
Section titled “Cannot reach the bypass after changing LAN”- still using the old IP;
- client is not on
192.168.1.0/24; - stale ARP:
ip neigh flush dev <iface>; - use the console:
ip -4 addr show br-lan.
Client gets no address
Section titled “Client gets no address”- bypass DHCP is off; that is expected; configure static;
- if you want DHCP, keep exactly one server (bypass or main router);
- check
dhcp.lan.ignoreand a second DHCP.
Client has an address but no internet
Section titled “Client has an address but no internet”- gateway/DNS not pointing at the bypass;
- bypass has no default route/upstream;
- firewall forwarding/NAT;
- main router lacks a return route (one-arm);
- subnet conflict/double NAT.
DNS fails
Section titled “DNS fails”- client still uses the old gateway for DNS;
- bypass dnsmasq not listening on LAN;
- upstream DNS blocked;
- app-level DoH/private DNS.
Recorded demo (009 lab)
Section titled “Recorded demo (009 lab)”E2 lab run (2026-10-20)
Section titled “E2 lab run (2026-10-20)”- Environment: OpenWrt 25.12.6 x86 VM 200; LAN
192.168.1.2/24;DHCP ignore=1; WAN DHCP192.168.50.5/24; netns client192.168.1.100/24. - DHCP off:
udhcpcgot no offer (no lease, failing); static address worked. - Static gateway/DNS
.2: gateway ping,1.1.1.1, andnslookupworked. - DNS
1.1.1.1worked; dead gateway.250broke public access; restoring.2recovered. - Not tested: pure one-arm bypass, main-router return route, real Wi-Fi/Windows clients, IPv6/RA.
- Cast:
public/casts/009-bypass.cast; recipe:tests/recipes/bypass-gateway-25.12.md.
Sources and review
Section titled “Sources and review”- This is E2 partial: the WAN-enabled bypass was tested; the one-arm path is E1 steps only.
- No independent reviewer; conclusions are limited to this VM/netns environment.
- “Bypass gateway” is not one fixed config; confirm who serves DHCP, who NATs, and whether the return route exists.
Sources
Independent OpenWrt notes. Every page states the firmware, device, package manager and way back.
Icons: Solar by 480 Design, CC BY 4.0