Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #256969

Re: how to change default nameserver?

From zithro <slack@rabbit.lu>
Newsgroups linux.debian.user
Subject Re: how to change default nameserver?
Date 2023-04-09 17:00 +0200
Message-ID <GiEGl-Sov-1@gated-at.bofh.it> (permalink)
References <GiyAV-OHv-5@gated-at.bofh.it> <GiCbv-R12-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09 Apr 2023 14:14, gene heskett wrote:

> I'm not sure, and my methods have been heavily denegrated by the dhcp 
> fans, but in my case with a many machine local net, and no dhcpd running 
> on the system, and the changes with each new release, I find the one 
> repeatable method to solve dns problem, is to compose an 
> /etc/resolv.conf with 2 lines:
> 
> mameserver ipv4 address of router
> search hosts, nameserver
> 
> And sudo chattr +i /etc/resolv.conf
> 
> quickly so NM can't change it. It will remove the search line, killing 
> your local network, in which case you can ping yahoo.com, but not 
> another machine on your local net. Your ISP's dns has no knowledge of 
> your local net which is as it should be.
> 
> My router runs something like dnsmasq as its running dd-wrt, and 
> theoretically a dns request then searchs the host file for a matching 
> name, failing that my whole local system then query's the router, which 
> if not cached by dnsmasq, sends the query on to my ISP's dns server, and 
> I get answers in around 30 milliseconds. And it all just works. With the 
> router NAT-ing, all machines here can browse the whole planet, as 
> transparently as border facilities allow.

It seems you misconfigured a few things.
- Either you use DHCP, and the DNS will be provided by the DHCP server, 
so don't touch resolv.conf (the DHCP server CAN provide 127.0.0.1 as DNS 
server)
- or you use static addressing, and you can simply remove the 
dhcp-client package, so resolv.conf will be left alone.

Also, the line "search hosts, nameserver" is wrong. The place to put 
such settings is "/etc/nsswitch.conf".
"search" is used to resolve hostnames to FQDN.
So if you put "search example.com", and you try to connect to a machine 
with for example "ssh hostname", the DNS client will try to append 
example.com to hostname, and try to resolve "hostname.example.com".

Finally, if using static addressing, I can't see why NetworkManager is 
useful.

So to recap, if your LOCAL domain is example.com, and your DNS server is 
192.168.1.1, a resolv.conf would look like:
# /etc/resolv.conf
nameserver 192.168.1.1
search example.com
#

Man pages:
man resolv.conf
man nsswitch.conf

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to change default nameserver? coreyh@free.fr - 2023-04-09 10:30 +0200
  Re: how to change default nameserver? Christoph Brinkhaus <c.brinkhaus@t-online.de> - 2023-04-09 11:00 +0200
  Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-09 14:20 +0200
    Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-09 17:00 +0200
      Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-09 17:10 +0200
        Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-09 21:50 +0200
      Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-09 17:30 +0200
        Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-09 22:30 +0200
        Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-10 18:10 +0200
          Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-10 19:40 +0200
            Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-10 21:50 +0200
              Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-10 23:00 +0200
                Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-10 23:00 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-11 00:10 +0200
                Re: how to change default nameserver? Andy Smith <andy@strugglers.net> - 2023-04-11 00:30 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-11 18:40 +0200
                Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-11 05:20 +0200
                Re: how to change default nameserver? Richard Hector <richard@walnut.gen.nz> - 2023-04-11 05:50 +0200
                Re: how to change default nameserver? Richard Hector <richard@walnut.gen.nz> - 2023-04-11 09:00 +0200
                Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-11 13:30 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-11 22:00 +0200
                Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-11 22:20 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-11 22:50 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-12 01:30 +0200
                Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-11 05:00 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-11 16:10 +0200
                Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-11 19:20 +0200
                Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-11 19:40 +0200
                Re: how to change default nameserver? "Andrew M.A. Cater" <amacater@einval.com> - 2023-04-11 19:40 +0200
                Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-11 22:30 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-12 16:30 +0200
                Re: how to change default nameserver? Max Nikulin <manikulin@gmail.com> - 2023-04-12 05:30 +0200
                Re: how to change default nameserver? zithro <slack@rabbit.lu> - 2023-04-11 19:50 +0200
                Re: how to change default nameserver? Nicholas Geovanis <nickgeovanis@gmail.com> - 2023-04-11 21:20 +0200
                Re: how to change default nameserver? gene heskett <gheskett@shentel.net> - 2023-04-12 01:20 +0200
          Re: how to change default nameserver? Andy Smith <andy@strugglers.net> - 2023-04-10 21:20 +0200
  Re: how to change default nameserver? Greg Wooledge <greg@wooledge.org> - 2023-04-09 14:50 +0200

csiph-web