Web lists-archives.com

Re: Wrong DNS when connected to phone


On Sun, Sep 02, 2018 at 12:46:20PM +0200, Leandro Noferini wrote:
> Ciao a tutti,
> I have a strange behaviour when I connect the PC to my android phone in
> tethering via wifi: the PC takes as DNS the address of the phone

Not a strange behaviour, this is a normal one.
Your phone's DHCP server announces itself as a DNS, your PC's DHCP
client complies.

> and this does not work

And this is definitely not normal. It's most likely that your phone has
dnsmasq as a DHCP/DNS caching server, and DNS part should use whatever
forwarders your carrier provides.
So it should work (it does for me, at least).

> so I need to manually change the /etc/resolv.conf file.

No, you do not. What you need is to fix your phone's DHCP server
settings, but that's hard if not impossible. Because it requires
modifying phone root filesystem (which is read only), which requires
root privileges, yadda, yadda.

> I do not understand where to change.

 What you really need (assuming that you use isc-dhcp-client) is
something like:

supersede domain-name-servers <ur_correct_DNS here>;

put into /etc/dhcp/dhclient.conf.

It's a hack, pinning DHCP client to a single DNS, but it's not like
you're going to move your PC somewhere (i.e. to a different network).