Skip to main content
fix typos
Source Link
fossy
  • 11
  • 3

The nslookup, dig and ping return different values for me. I want foo.bar.name to always resolve statically to localhost on my machine.

I used the command host <myname.favorite.name> and edited

host foo.bar.name

and edited /etc/hosts to include the line 1.1.1.1 foo.bar.name foo

1.1.1.1 foo.bar.name foo

(where 1.1.1.1 ip address of localhostmy host machine)

So that when I ping foo.bar.name it resolves to 1.1.1.1. LikewiseWhen I run either ping or curl locally to connect to foo.bar.name, it resolves to 1.1.1.1 and connects finebehaves the way I want. But

But when I run dig, andor nslookup for that matter, it connects to what must be some other source of DNS services and resolvesthe foo.bar.name to something else, not localhost. For a test I'd like to run, I need this machine to beaddress resolves completely oblivious to any DNS other than its own which should return localhost for foo.bar.name and no other ipsdifferently. What

Did I miss something?

What configurations do I need to modify to make sure that happen?on that particular host DNS resolution happens the way I've stated.

The nslookup, dig and ping return different values for me.

I used the command host <myname.favorite.name> and edited /etc/hosts to include the line 1.1.1.1 foo.bar.name foo (where 1.1.1.1 ip address of localhost)

So that when I ping foo.bar.name it resolves to 1.1.1.1. Likewise I run curl locally to connect to foo.bar.name it resolves to 1.1.1.1 and connects fine. But when I run dig, and nslookup for that matter, it connects to what must be some other source of DNS services and resolves foo.bar.name to something else, not localhost. For a test I'd like to run, I need this machine to be completely oblivious to any DNS other than its own which should return localhost for foo.bar.name and no other ips. What configurations do I need to modify to make that happen?

The nslookup, dig and ping return different values for me. I want foo.bar.name to always resolve statically to localhost on my machine.

I used the command

host foo.bar.name

and edited /etc/hosts to include the line

1.1.1.1 foo.bar.name foo

(where 1.1.1.1 ip address of my host machine)

When I run either ping or curl, it behaves the way I want.

But when I run dig, or nslookup for that matter, the foo.bar.name address resolves completely differently.

Did I miss something?

What configurations do I need to modify to make sure that on that particular host DNS resolution happens the way I've stated.

Source Link
fossy
  • 11
  • 3

How to you override the default dns configuration in ubuntu so that nslookup returns static values?

The nslookup, dig and ping return different values for me.

I used the command host <myname.favorite.name> and edited /etc/hosts to include the line 1.1.1.1 foo.bar.name foo (where 1.1.1.1 ip address of localhost)

So that when I ping foo.bar.name it resolves to 1.1.1.1. Likewise I run curl locally to connect to foo.bar.name it resolves to 1.1.1.1 and connects fine. But when I run dig, and nslookup for that matter, it connects to what must be some other source of DNS services and resolves foo.bar.name to something else, not localhost. For a test I'd like to run, I need this machine to be completely oblivious to any DNS other than its own which should return localhost for foo.bar.name and no other ips. What configurations do I need to modify to make that happen?