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.
sudo netstat -antup | grep LISTEN
. This will show us if systemd-resolved is running – cmak.fr May 30 '18 at 12:16cat /var/run/systemd/resolve/resolv.conf
– cmak.fr May 30 '18 at 12:35nmcli -t connection show --active
AND detailsnmcli con show 'Profile Name' | grep dns
– cmak.fr May 30 '18 at 12:43resolve 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