DNSMASQ Server Router
Try using ip of machine.

Wifi Router
-S, --local, --server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
Specify IP address of upstream servers directly. Setting this flag does not suppress reading of /etc/resolv.conf, use --no-resolv to do that. If one or more optional domains are given, that server is used only for those domains and they are queried only using the specified server. This is intended for private nameservers: if you have a nameserver on your network which deals with names of the form xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag --server=/internal.thekelleys.org.uk/192.168.1.1 will send all queries for internal machines to that nameserver, everything else will go to the servers in /etc/resolv.conf. DNSSEC validation is turned off for such private nameservers, UNLESS a --trust-anchor is specified for the domain in question. An empty domain specification, // has the special meaning of "unqualified names only" ie names without any dots in them. A non-standard port may be specified as part of the IP address using a # character. More than one --server flag is allowed, with repeated domain or ipaddr parts as required.

More specific domains take precedence over less specific domains, so: --server=/google.com/1.2.3.4 --server=/www.google.com/2.3.4.5 will send queries for *.google.com to 1.2.3.4, except *www.google.com, which will go to 2.3.4.5

The special server address '#' means, "use the standard servers", so --server=/google.com/1.2.3.4 --server=/www.google.com/# will send queries for *.google.com to 1.2.3.4, except *www.google.com which will be forwarded as usual.

Also permitted is a -S flag which gives a domain but no IP address; this tells dnsmasq that a domain is local and it may answer queries from /etc/hosts or DHCP but should never forward queries on that domain to any upstream servers. --local is a synonym for --server to make configuration files clearer in this case.

IPv6 addresses may include an %interface scope-id, eg fe80::202:a412:4512:7bbf%eth0.

The optional string after the @ character tells dnsmasq how to set the source of the queries to this nameserver. It can either be an ip-address, an interface name or both. The ip-address should belong to the machine on which dnsmasq is running, otherwise this server line will be logged and then ignored. If an interface name is given, then queries to the server will be forced via that interface; if an ip-address is given then the source address of the queries will be set to that address; and if both are given then a combination of ip-address and interface name will be used to steer requests to the server. The query-port flag is ignored for any servers which have a source address specified but the port may be specified directly as part of the source address. Forcing queries to an interface is not implemented on all platforms supported by dnsmasq.


server=/mydomain/192.168.1.1

Resolv Internal Name to External IP address.
Disable DNS SErver as that DNSMASQ will Handle
DNSMASQ
Link DNSMASQ to external Name Server Upstream


redirect  dnsmasq.conf
server=/mydomain/192.168.1.1
server=/swaroop.com/ns.swaroop.com
server=/swaroop.org/ns.swaroop.org

-S, --server=[/[<domain>]/[domain/]] ... ... More than one -S flag is allowed, with repeated domain or ipaddr parts as required.

The easiest way to come about this is properly installing dnsmasq (which is a DNS cacheing server) then in the folder /etc/dnsmasq.d add a
file for each domain you want to redirect.

For instance this is the contents of /etc/dnsmasq.d/hotmail.com on my system:

address=/hotmail.com/127.0.0.1
address=/www.hotmail.com/127.0.0.1

If I then ask the DNS server for the IP of hotmail.com i get 127.0.0.1 like this:

llp@cerberus:~$ nslookup hotmail.com
Server:     192.168.0.10
Address:    192.168.0.10#53

Name:   hotmail.com
Address: 127.0.0.1

llp@cerberus:~$

DNSMASQ OSX
Setup needed 127.0.0.1
https://superuser.com/questions/1093419/alias-for-ips-in-the-home-lan-network

add 192.168.1.103


On a Raspberry.

I've successfully installed DNSMasq on a Debian machine and everything seems to be working. Here's what I did:

  1. install DNSMasq with sudo apt-get install dnsmasq
  2. update file /etc/dnsmasq.d/home.dns with the following contents:

    # General configuration
    domain-needed
    bogus-priv
    domain=dummy.home
    dhcp-range=192.168.0.10,static,48h
    dhcp-option=3,192.168.0.1
    
    # Device IPs
    dhcp-host=00:00:5e:00:52:41,desktop,192.168.0.10
    dhcp-host=00:00:5e:00:52:12,android,192.168.0.11
    

    192.168.0.1 is my ISP router's IP.

  3. turn off DHCP on my ISP router

  4. restart DNSMasq service with sudo service dnsmasq restart

That's all great, but I'm new to networking and have a bunch of questions:

  1. how does DNSMasq communicate with the router? I mean, how does it tell the router that it should start using DNSMasq's DHCP server from that point on? Is there a specific protocol for that, whereby DNSMasq communicates with the router, or is it DHCP itself?

  2. why didn't I have to configure my devices (an android phone and a desktop computer) to use DNSMasq's DNS server? [The answer to this one may be the same as from the question above, but anyways...]

  3. is there a way of using DNSMasq for DNS only and have the router's DHCP server "talk to" or "use" DNSMasq's DNS server? This way I wouldn't need to turn the router's DHCP server off.

As I said, I'm a newbie, but I couldn't find answers to these questions anywhere on the web. Thanks in advance!

Answere:

DNSmasq does not need to communicate with your router. The DNSmasq service just took over the service of DNS and DHCP and your router does not have to provide that anymore. Since you have disabled the DHCP service on your router, only the DHCP server of the computer running DNSmasq will answer DHCP requests.
Your DHCP clients (android phone and desktop) get all needed information from the DHCP server, like IP address and netmask, DNS server and default router. From man dnsmasq:

By default, dnsmasq sends some standard options to DHCP clients, the netmask and broadcast address are set to the same as the host running dnsmasq, and the DNS server and default route are set to the address of the machine running dnsmasq.

In your case, you have set

dhcp-option=3,192.168.0.1

which tells the clients to use 192.168.0.1 as the default route. DNSmasq will also pick up the configuration in /etc/resolv.conf form the machine it is running to configure upstream DNS servers to resolve addresses outside your LAN.

You can run the DHCP server on a different server than your DNS server is running. But you will have to keep track of the clients and their IPs and corresponding names. In small networks you can easily assign static IP addresses and names, but that is nothing you want to do. There is also the option to dynamically update the DNS records from the DHCP server which is called dynamic DNS updates (DDNS) but needs a bit more configuration.