1

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!

rok
  • 935
  • 3
  • 15
  • 28
  • May I suggest running sudo apt install resolvconf which will make a soft link loop through resolv.conf but you can use resolvconf/head for a permanent fix for DNS resolution, because out of Network manager overwriting dhcp, and dhcp overwriting interfaces and resolvconf being temporary and can be written over by many applications, the network folder can also overwrite all of those, it's better just to stick with a primary DNS application capable of handling only DNS's –  Oct 15 '18 at 03:30
  • By the way, DHCP stands for dynamic (changing) host configuration protocol, and your interfaces file is static (stationary) So DHCP might be trying to renew and it can't because your IP is static somewhere else –  Oct 15 '18 at 03:32
  • If you're using DHCP then all the interfaces file should only hold is auto lo and Iface loopback –  Oct 15 '18 at 03:41

2 Answers2

2

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

rok
  • 935
  • 3
  • 15
  • 28
0

This depends heavily on your router. While running Win10 (which works) check the network parameters your computer receives via DHCP with ipconfig /all. While running Ubuntu set to DHCP (which doesn't work), do the same with ip addr, ip route and cat /etc/resolv.conf. Compare the two to your router configuration to see where the difference might come from.

As your /etc/resolv.conf says nameserver 127.0.1.1 that shows you're running dnsmasq on Ubuntu (the default), so you'll have to check the dnsmasq configuration too. That's not so easy since it is managed dynamically by Network Manager via dbus, so there's no configuration file you can read, and regrettably there seems to be no way of querying dnsmasq's current configuration. Start by requesting a dnsmasq statistics reqort with

sudo killall -URS1 dnsmasq

and scanning the syslog for messages from dnsmasq with

grep dnsmasq /var/log/syslog

EDIT: Sorry I forgot about dnsmasq. As I'm not allowed to post comments I updated my answer.

Tilman
  • 3,599
  • 21
  • 27