0

When I connect to a wireless network from my laptop, Network Manager somehow requests a DNS nameserver IP from the router and writes it to /etc/resolv.conf.

How can I request a nameserver address from cli without changing /etc/resolv.conf, if I only know address of the gateway?

monday
  • 55
  • 1
  • 5

1 Answers1

3

Network Manager doesn't somehow requests the IP address of a name server from the router. When you connect to a network and request an IP address using DHCP — as opposed to statically configuring the IP address, default gateway, etc. yourself — the DHCP server might (but most likely will) give you the IP address of one or more DNS servers; which then can get saved into the file /etc/resolv.conf.

How can I request a name server address from CLI without changing /etc/resolv.conf, if I only know address of the gateway?

You cannot. Why would you want to do that anyway?

You can always broadcast a DHCP query on the network and await a DHCP response which most likely will contain the IP address of the known DNS servers.

Tommiie
  • 5,547
  • 2
  • 11
  • 45