[SOLVED]How to modify a specific DNS mapping in DD-WRT?

Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.)
Author Message
zhuli66
DD-WRT User


Joined: 03 Dec 2021
Posts: 58

PostPosted: Sat Dec 04, 2021 18:14    Post subject: [SOLVED]How to modify a specific DNS mapping in DD-WRT? Reply with quote
My English is not good, let me give you an example.

For example, if I enter http://www.baidu.com in the address bar of the computer browser, the computer will first query the DNS server and get the corresponding IP address http://220.181.38.251, and then the browser will access this IP address .
What I need now is that when I enter http://www.baidu.com in the browser, DD-WRT will not pass the request to the DNS server, but directly return another IP address (http: //142.251.42.206) to the browser.

How should I operate on the router?


Last edited by zhuli66 on Thu Dec 09, 2021 13:33; edited 1 time in total
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14246
Location: Texas, USA

PostPosted: Sat Dec 04, 2021 18:24    Post subject: Reply with quote
Thanks to someone being overzealous, I have to repeat myself.
You need to use address= lines in your additional dnsmasq configs:

Code:
address=/www.baidu.com/142.251.42.206


https://thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

Quote:
-A, --address=/<domain>[/<domain>...]/[<ipaddr>]
Specify an IP address to return for any host in the given domains. Queries in the domains are never forwarded and always replied to with the specified IP address which may be IPv4 or IPv6. To give both IPv4 and IPv6 addresses for a domain, use repeated --address flags. To include multiple IP addresses for a single query, use --addn-hosts=<path> instead. Note that /etc/hosts and DHCP leases override this for individual names. A common use of this is to redirect the entire doubleclick.net domain to some friendly local web server to avoid banner ads. The domain specification works in the same way as for --server, with the additional facility that /#/ matches any domain. Thus --address=/#/1.2.3.4 will always return 1.2.3.4 for any query not answered from /etc/hosts or DHCP and not sent to an upstream nameserver by a more specific --server directive. As for --server, one or more domains with no address returns a no-such-domain answer, so --address=/example.com/ is equivalent to --server=/example.com/ and returns NXDOMAIN for example.com and all its subdomains. An address specified as '#' translates to the NULL address of 0.0.0.0 and its IPv6 equivalent of :: so --address=/example.com/# will return NULL addresses for example.com and its subdomains. This is partly syntactic sugar for --address=/example.com/0.0.0.0 and --address=/example.com/:: but is also more efficient than including both as separate configuration lines. Note that NULL addresses normally work in the same way as localhost, so beware that clients looking up these names are likely to end up talking to themselves.

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
zhuli66
DD-WRT User


Joined: 03 Dec 2021
Posts: 58

PostPosted: Sun Dec 05, 2021 11:36    Post subject: Reply with quote
[quote="kernel-panic69"]Thanks to someone being overzealous, I have to repeat myself.
You need to use address= lines in your additional dnsmasq configs:

Code:
address=/www.baidu.com/142.251.42.206




Hello, I just saw your answer, thank you for your answer.

However, I only bought wrt1900acsv2 a week ago, and I am new to DD-WRT. I really don't understand what you mean by "dnsmasq". Is it a router plug-in? Before using this command line, do I need to install a plug-in to DD-WRT?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14246
Location: Texas, USA

PostPosted: Sun Dec 05, 2021 12:30    Post subject: Reply with quote
Look at the services tab in the webUI, scroll up and down... it's right there....
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.) All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum