Ubuntu – DNS resolution not working in DHCP

16.04dhcpdisplay-resolutiondns

I noticed this strange behaviour, I have a wi-fi network that only works with static IP addresses. If I set DHCP the DNS resolution fails, I can for example ping 8.8.8.8 but I can't surf the web or ping www.google.com.
It happens only with my computer, and only with the Ubuntu partition (no problem using Win10). I don't have any kind of problem with other wi-fi networks.
My computer runs 16.04, everything updated.
Any hints?

UPDATE

These are output from Ubuntu commands (not working)

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp7s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether fc:3f:db:a2:6d:46 brd ff:ff:ff:ff:ff:ff
3: wlp19s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether c8:ff:28:93:26:32 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.100/24 brd 192.168.0.255 scope global dynamic wlp19s0
       valid_lft 7193sec preferred_lft 7193sec
    inet6 fe80::e9a0:6a46:1112:815/64 scope link 
       valid_lft forever preferred_lft forever

$ ip route
default via 192.168.0.1 dev wlp19s0  proto static  metric 600 
169.254.0.0/16 dev wlp19s0  scope link  metric 1000 
192.168.0.0/24 dev wlp19s0  proto kernel  scope link  src 192.168.0.100  metric 600 


$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

And this is from ipconfig /all in Win10 (working)

Scheda LAN wireless Wi-Fi:

   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : Realtek RTL8188EE 802.11 bgn Wi-Fi Adapter
   Indirizzo fisico. . . . . . . . . . . : C8-FF-28-93-26-32
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::7d95:51a8:c887:792e%17(Preferenziale)
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.0.100(Preferenziale)
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Lease ottenuto. . . . . . . . . . . . : sabato 1 aprile 2017 10:12:04
   Scadenza lease . . . . . . . . . . .  : sabato 1 aprile 2017 12:12:18
   Gateway predefinito . . . . . . . . . : 192.168.0.1
   Server DHCP . . . . . . . . . . . . . : 192.168.0.1
   IAID DHCPv6 . . . . . . . . . . . : 281607976
   DUID Client DHCPv6. . . . . . . . : 00-01-00-01-1D-FD-6A-93-FC-3F-DB-A2-6D-46
   Server DNS . . . . . . . . . . . . .  : 192.168.0.1
   NetBIOS su TCP/IP . . . . . . . . . . : Attivato

I also tried to factory reset the router, without any luck.. but I might found something interesting, after reset, I tried to connect to the router to change the settings via LAN cable, and was not able to connect using tplinkmodem.net , but only using 192.168.1.1. There is something bad in my local DNS resolution I think, but I'm not an expert.. so I'm waiting for suggestion!

Best Answer

This solution worked for me: https://askubuntu.com/a/432374/373541

However I don't understand why. DHCP has always worked before in my Ubuntu.. If someone can explain what I did following the solution, would be great. thank you

Related Question