How to force a computer to use a specific nameserver for lookups?
I know that you can edit /etc/hosts
to make certain hostnames resolve to specific IPs, but is there a way I can force my machine to use a certain nameserver for a domain?
For instance, if I own mysite.com and running dig mysite.com ns
shows CloudFlare as the nameservers, I'd like to override that locally so it uses AWS Route 53.
The goal is to make sure moving my whole domain from CloudFlare to AWS will work ok, before I actually change the nameservers.
dns nameserver
add a comment |
I know that you can edit /etc/hosts
to make certain hostnames resolve to specific IPs, but is there a way I can force my machine to use a certain nameserver for a domain?
For instance, if I own mysite.com and running dig mysite.com ns
shows CloudFlare as the nameservers, I'd like to override that locally so it uses AWS Route 53.
The goal is to make sure moving my whole domain from CloudFlare to AWS will work ok, before I actually change the nameservers.
dns nameserver
add a comment |
I know that you can edit /etc/hosts
to make certain hostnames resolve to specific IPs, but is there a way I can force my machine to use a certain nameserver for a domain?
For instance, if I own mysite.com and running dig mysite.com ns
shows CloudFlare as the nameservers, I'd like to override that locally so it uses AWS Route 53.
The goal is to make sure moving my whole domain from CloudFlare to AWS will work ok, before I actually change the nameservers.
dns nameserver
I know that you can edit /etc/hosts
to make certain hostnames resolve to specific IPs, but is there a way I can force my machine to use a certain nameserver for a domain?
For instance, if I own mysite.com and running dig mysite.com ns
shows CloudFlare as the nameservers, I'd like to override that locally so it uses AWS Route 53.
The goal is to make sure moving my whole domain from CloudFlare to AWS will work ok, before I actually change the nameservers.
dns nameserver
dns nameserver
edited Jan 16 at 1:20
ffxsam
asked Jan 16 at 1:11
ffxsamffxsam
12316
12316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Run your own local lightweight DNS server like MaraDNS or Dnsmasq.
Whenever any software on your computer tries to reach out to internet with DNS name, it resolves to a corresponding IP addresses by querying a DNS server. This setup is usually done via /etc/resolv.conf
. But Unix systems before querying on network try to look it up locally on /etc/hosts
. If your destination IP address doesn't change, it is best you just put an entry in /etc/hosts
.
If you don't want to do that, other way is to run a DNS server yourself. When you run a DNS server locally, you have to mention an upstream server. An upstream DNS server is basically a go-to DNS server (typically your ISP's or Google DNS or OpenDNS) which your local DNS can query.
If you are running Ubuntu/Debian follow this:
dnsmasq
Once you have your Dnsmasq up and running, you should configure your dnsmasq to query your choice of NS for specific domain/s with server=/example.com/208.67.222.222
. example.com is the domain and the IP address is the Nameserver you want Dnsmasq to query.
Don't forget to update the resolv.conf
or other tools which controls resolv.conf
so that your computer queries locally.
That way for all requests, your computer queries your ISP provided DNS server and for a specific domain it queries IP address of your choice. HTH.
Ref: Dnsmasq Man page
1
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For yourmysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up astub zone
or aforward zone
on your local PC's DNS server.
– BeowulfNode42
Jan 16 at 2:26
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394755%2fhow-to-force-a-computer-to-use-a-specific-nameserver-for-lookups%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Run your own local lightweight DNS server like MaraDNS or Dnsmasq.
Whenever any software on your computer tries to reach out to internet with DNS name, it resolves to a corresponding IP addresses by querying a DNS server. This setup is usually done via /etc/resolv.conf
. But Unix systems before querying on network try to look it up locally on /etc/hosts
. If your destination IP address doesn't change, it is best you just put an entry in /etc/hosts
.
If you don't want to do that, other way is to run a DNS server yourself. When you run a DNS server locally, you have to mention an upstream server. An upstream DNS server is basically a go-to DNS server (typically your ISP's or Google DNS or OpenDNS) which your local DNS can query.
If you are running Ubuntu/Debian follow this:
dnsmasq
Once you have your Dnsmasq up and running, you should configure your dnsmasq to query your choice of NS for specific domain/s with server=/example.com/208.67.222.222
. example.com is the domain and the IP address is the Nameserver you want Dnsmasq to query.
Don't forget to update the resolv.conf
or other tools which controls resolv.conf
so that your computer queries locally.
That way for all requests, your computer queries your ISP provided DNS server and for a specific domain it queries IP address of your choice. HTH.
Ref: Dnsmasq Man page
1
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For yourmysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up astub zone
or aforward zone
on your local PC's DNS server.
– BeowulfNode42
Jan 16 at 2:26
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
add a comment |
Run your own local lightweight DNS server like MaraDNS or Dnsmasq.
Whenever any software on your computer tries to reach out to internet with DNS name, it resolves to a corresponding IP addresses by querying a DNS server. This setup is usually done via /etc/resolv.conf
. But Unix systems before querying on network try to look it up locally on /etc/hosts
. If your destination IP address doesn't change, it is best you just put an entry in /etc/hosts
.
If you don't want to do that, other way is to run a DNS server yourself. When you run a DNS server locally, you have to mention an upstream server. An upstream DNS server is basically a go-to DNS server (typically your ISP's or Google DNS or OpenDNS) which your local DNS can query.
If you are running Ubuntu/Debian follow this:
dnsmasq
Once you have your Dnsmasq up and running, you should configure your dnsmasq to query your choice of NS for specific domain/s with server=/example.com/208.67.222.222
. example.com is the domain and the IP address is the Nameserver you want Dnsmasq to query.
Don't forget to update the resolv.conf
or other tools which controls resolv.conf
so that your computer queries locally.
That way for all requests, your computer queries your ISP provided DNS server and for a specific domain it queries IP address of your choice. HTH.
Ref: Dnsmasq Man page
1
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For yourmysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up astub zone
or aforward zone
on your local PC's DNS server.
– BeowulfNode42
Jan 16 at 2:26
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
add a comment |
Run your own local lightweight DNS server like MaraDNS or Dnsmasq.
Whenever any software on your computer tries to reach out to internet with DNS name, it resolves to a corresponding IP addresses by querying a DNS server. This setup is usually done via /etc/resolv.conf
. But Unix systems before querying on network try to look it up locally on /etc/hosts
. If your destination IP address doesn't change, it is best you just put an entry in /etc/hosts
.
If you don't want to do that, other way is to run a DNS server yourself. When you run a DNS server locally, you have to mention an upstream server. An upstream DNS server is basically a go-to DNS server (typically your ISP's or Google DNS or OpenDNS) which your local DNS can query.
If you are running Ubuntu/Debian follow this:
dnsmasq
Once you have your Dnsmasq up and running, you should configure your dnsmasq to query your choice of NS for specific domain/s with server=/example.com/208.67.222.222
. example.com is the domain and the IP address is the Nameserver you want Dnsmasq to query.
Don't forget to update the resolv.conf
or other tools which controls resolv.conf
so that your computer queries locally.
That way for all requests, your computer queries your ISP provided DNS server and for a specific domain it queries IP address of your choice. HTH.
Ref: Dnsmasq Man page
Run your own local lightweight DNS server like MaraDNS or Dnsmasq.
Whenever any software on your computer tries to reach out to internet with DNS name, it resolves to a corresponding IP addresses by querying a DNS server. This setup is usually done via /etc/resolv.conf
. But Unix systems before querying on network try to look it up locally on /etc/hosts
. If your destination IP address doesn't change, it is best you just put an entry in /etc/hosts
.
If you don't want to do that, other way is to run a DNS server yourself. When you run a DNS server locally, you have to mention an upstream server. An upstream DNS server is basically a go-to DNS server (typically your ISP's or Google DNS or OpenDNS) which your local DNS can query.
If you are running Ubuntu/Debian follow this:
dnsmasq
Once you have your Dnsmasq up and running, you should configure your dnsmasq to query your choice of NS for specific domain/s with server=/example.com/208.67.222.222
. example.com is the domain and the IP address is the Nameserver you want Dnsmasq to query.
Don't forget to update the resolv.conf
or other tools which controls resolv.conf
so that your computer queries locally.
That way for all requests, your computer queries your ISP provided DNS server and for a specific domain it queries IP address of your choice. HTH.
Ref: Dnsmasq Man page
edited Jan 16 at 4:21
answered Jan 16 at 1:16
RamRam
1263
1263
1
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For yourmysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up astub zone
or aforward zone
on your local PC's DNS server.
– BeowulfNode42
Jan 16 at 2:26
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
add a comment |
1
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For yourmysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up astub zone
or aforward zone
on your local PC's DNS server.
– BeowulfNode42
Jan 16 at 2:26
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
1
1
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
I know zilch about DNS servers, you'll have to elaborate a bit, please.
– ffxsam
Jan 16 at 1:18
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For your
mysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up a stub zone
or a forward zone
on your local PC's DNS server.– BeowulfNode42
Jan 16 at 2:26
@ffxsam This is basically setting up your local computer to be a DNS server. Then its DNS server software is configured to be a DNS forwarder. For your
mysite.com
domain it is set up to forward DNS queries to the specified nameservers, in this case AWS. For other domains it will forward the DNS queries to your regular DNS servers, ie your ISP DNS servers. In words you may be more familiar with you are setting up a stub zone
or a forward zone
on your local PC's DNS server.– BeowulfNode42
Jan 16 at 2:26
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
Don’t forget to mention the resolv.conf or the DNS settings on any device have to be updated to use the newly installed DNS server.
– Appleoddity
Jan 16 at 3:49
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
@Appleoddity right.. will update the answer to reflect your point
– Ram
Jan 16 at 4:18
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394755%2fhow-to-force-a-computer-to-use-a-specific-nameserver-for-lookups%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown