1

I'm testing a dotnet core app set up to use NGINX as a reverse proxy. To test it, I set up Bind9 to resolve example.com to my LAN IP address. I've set the network manager DNS in the top right corner of Ubuntu 18.04 to use my IP as DNS and resolve.conf body to use the my IP as the DNS. When I dig example.com I get the local IP address:

dig example.com

; <<>> DiG 9.11.3-1ubuntu1-Ubuntu <<>> example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54728
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: c3f027023efb13f917866a635b0e8feaa95ff6a3a3be7227 (good)
;; QUESTION SECTION:
;example.com.           IN  A

;; ANSWER SECTION:
example.com.        604800  IN  A   192.168.75.136

;; AUTHORITY SECTION:
example.com.        604800  IN  NS  ns.example.com.

;; ADDITIONAL SECTION:
ns.example.com.     604800  IN  A   192.168.75.136

;; Query time: 0 msec
;; SERVER: 192.168.75.136#53(192.168.75.136)
;; WHEN: Wed May 30 04:50:02 PDT 2018
;; MSG SIZE  rcvd: 117

However when I search in Firefox the online example.com is loaded. I flushed dns using:

sudo /etc/init.d/dns-clean restart
and
sudo /etc/init.d/networking force-reload

Obviously something I did wrong because I can no longer edit the wired connection in the top right properties (it's gone). I setup no forwarders in named.conf.options so I shouldn't be able to resolve internet addresses.

in /etc/networkManager/system-connections/Wired connection 1

[ipv4]
dns=192.168.75.136;
dns-search=
ignore-auto-dns=true
method=auto

generated resolve.conf:

nameserver 192.168.75.136
nameserver 127.0.0.53

There is no line in /etc/NetworkManager/NetworkManager.conf saying dns=dnsmasq


I also added to /etc/network/interfaces after the loopback (based on this post):

# The primary network interface  
auto eth0 
iface eth0 inet static  
address 192.168.75.136
netmask 255.255.255.0
gateway 192.168.75.2
dns-nameservers 192.168.75.136

and then ran sudo ifdown eth0 && sudo ifup eth0

While undoing each step, I discovered that this last step is what caused eth0 to disappear and make the network manager wired settings in the top right of Ubuntu to no longer appear in 18.04


sudo netstat -antup | grep LISTEN

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1538/nginx: master  
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1489/named          
tcp        0      0 192.168.75.136:53       0.0.0.0:*               LISTEN      1489/named          
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1489/named          
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      566/systemd-resolve 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1081/cupsd          
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      1489/named          
tcp6       0      0 :::53                   :::*                    LISTEN      1489/named          
tcp6       0      0 ::1:631                 :::*                    LISTEN      1081/cupsd          
tcp6       0      0 ::1:953                 :::*                    LISTEN      1489/named          

NMCLI for some reason shows no dns server at all

nmcli dev show eth0

GENERAL.DEVICE:                         eth0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         00:0C:29:05:33:F4
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         192.168.75.136/24
IP4.GATEWAY:                            192.168.75.2
IP4.ROUTE[1]:                           dst = 0.0.0.0/0, nh = 192.168.75.2, mt =
IP4.ROUTE[2]:                           dst = 169.254.0.0/16, nh = 0.0.0.0, mt =
IP4.ROUTE[3]:                           dst = 192.168.75.0/24, nh = 0.0.0.0, mt 
IP6.ADDRESS[1]:                         fe80::20c:29ff:fe05:33f4/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table

var/run/systemd/resolve: nameserver 192.168.75.136

nmcli -t connection show --active

virbr0:4239285a-844c-4ec0-b671-c145089b52f1:bridge:virbr0

nmcli con show 'virbr0' | grep dns

ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      100
ipv4.ignore-auto-dns:                   no
ipv6.dns:                               --
ipv6.dns-search:                        --
ipv6.dns-options:                       ""
ipv6.dns-priority:                      100
ipv6.ignore-auto-dns:                   no
sticker592@ubuntu:~$ nmcli con show 'eth0' | grep dns
Error: eth0 - no such connection profile.
  • seems it is ubuntu 18.04, right? please edit your post and paste the output of sudo netstat -antup | grep LISTEN. This will show us if systemd-resolved is running – cmak.fr May 30 '18 at 12:16
  • @cmak.fr ok. I'm reading the /etc/systemd/resolved.conf file and it is completely commented out. no dns – user5389726598465 May 30 '18 at 12:17
  • wrong file, look at cat /var/run/systemd/resolve/resolv.conf – cmak.fr May 30 '18 at 12:35
  • @cmak.fr Still shows local dns. Also I only set up one zone in bind9 and A record and ns record all pointing to local. – user5389726598465 May 30 '18 at 12:39
  • @cmak.fr output? Bind9 settings you mean? I'll add – user5389726598465 May 30 '18 at 12:41
  • Now, verify NM dns. Get active profile name and details ... Get the profile Name nmcli -t connection show --active AND details nmcli con show 'Profile Name' | grep dns – cmak.fr May 30 '18 at 12:43
  • @cmak.fr something is broken because the output shows no eth0,(shouldn't it?) see above – user5389726598465 May 30 '18 at 12:45
  • 1
    If you want to resolve example.com to my lan ip address isn't it sufficient to only edit /etc/hosts file on your computer? Or by using a much simpler DNS-Resolver? It is not trivial to configure/setup Bind9. – Ben May 30 '18 at 13:21
  • @Ben good idea. I actually found entire textbooks on bind9, although I think I messed up on the step setting the Ubuntu configuration pointing to the dns server. – user5389726598465 May 30 '18 at 13:24
  • 1
    Just remove/revert Bind9 and simple add 127.0.0.1 example.com and/or 127.0.0.1 www.example.com to your /etc/hosts and you're done. Nothing more to to... I cannot add this as an answer, because this would not answer your particular question about resolve.conf and NetworkManager. – Ben May 30 '18 at 13:31

1 Answers1

0

Very simple solution: I forgot to clear the cache in Firefox:

  1. Type Ctrl+Shift+Del and
  2. select to delete everything.
David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • @DavidFoerster I was going to delete the question since I was just being careless/thoughtless, but then I figured maybe someone else might forget to do the same thing... – user5389726598465 Jun 01 '18 at 16:59