The "deadgateway" tag, is a dhcp tag applies to a dynamic dhcp lease which returns a non-responding address for the default gateway.
I am asking is anyone has a oneliner command, which can be run on linux or windows (10 22h2,not updated), which will tell the router to apply the "deadgateway" tag to the requested host.
In other words, it is a single line command, which will ask the router NOT to allow my host to connect to the internet.
And I would also like the oneliner to reverse this.
I am asking in case someone has already achieved this.
This command must only use utilities already present and may not download anything from the internet beyond the command itself.
As placeholder values, the router username will be root, the router password will be MYPASSWORD, and the router's root authorized key will be
The command to create a deadgateway tag, is (using my network address, so a more advanced command would automatically find the network address from br-lan and also scan for a dead host that also has no static lease and is outside the dhcp lease range)
This only needs to run once
# create deadgateway dhcp tag
uci set dhcp.deadgateway=tag; uci add_list dhcp.deadgateway.dhcp_option='3,10.0.0.254' ; uci commit
the command to create the dynamic lease is as follows, where host mac address is DE:AD:BE:EF:69:67
No. It's asking the router to give an useless default route to the client. Giving wrong directions to the client is superficially effective, but it does not disallow access to the internet.
Block the host from accessing the internet in the firewall. That's its purpose.
There is no single UCI command that means "delete the host entry with this MAC". UCI requires you to identify the section first. You could try grepping using the MAC address in the output of uci show dhcp to identify the section.
This has nothing to do with “orthodoxy”, belief systems, or personal sensibilities. Giving a bogus gateway to a client simply does not block its internet access. That's not a norm, that's a fact.
We don't disagree about whether this can work. It’s about whether it enforces it in a reliable way. DHCP only proposes a configuration. The client ultimately decides what routes exist and may add others independently of DHCP. As soon as any alternate path exists (IPv6 RA, static route, VPN, manual change, reconnection race), your brittle workaround breaks.
Firewalls exist exactly for the purpose of conditionally allowing and blocking traffic between zones, and your router is already running one. If you, for whichever reason, still insist to sidestep that in favour of your "unorthodox" approach, I won't continue to argue with you and leave you to enjoy its many exciting edge cases.
How would the host obtain the deadgateway if it already obtained a DHCP lease including the working Internet gateway?
I assume you also plan to command the client to drop the lease in order to obtain a new one?
If you insist on the one liner (and its inverse) for the client, simply use commands to go from A.) DHCP to B.) manual config (with invalid "dead" gateway).
The OP could do that.
I think the user could:
create a host entry for this client
then the one liner could add the tag to the entry
and a one liner to remove the tag only
use/create an SSH key
add the public key to the OpenWrt
use the private key on the client to login
(This is usually done by having the key saved in a file. Your post with a sample key leads me to suggest you review the manual for the ssh command.)