I am setting up a new home server with Ubuntu 16.04 as its OS. I use SSH to access the server for setup. When I SSH into the server with ssh username@192.168.0.10
it just works fine. But when I want to do the same using ssh username@servername
or username.servername.localdomainname
it just does not work.
I read some topics about this and one stated to edit the /etc/resolv.conf
file, but in my installation this file has this line as content: DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN.
So, I guess I have to change the settings somewhere else.
How do I set up DNS on Ubuntu Server without installing extra software? I want to keep setup as pure as possible. If I look into the /etc/resolv.conf
there are two lines, one is like this: search router.localdomainname
and one like this nameserver 192.168.1.1
. I read that for the DNS to function, it has to look at 127.0.1.1? What to do to change these settings?
DNS works, for example my router's address can be typed into the address bar of my browser and it functions. Also the server name is present in the static ip table of the router.
So, how does one setup DNS right in a local network on Ubuntu server 16.04?
edit: I have opened the network-manager file, found in /etc/dnsmasq.d/
. There is a line of text inside it about network-manager. network-manager
is an unknown command (I guess it is a GUI program?) But Ubuntu Server does not have a GUI.
edit2: I have tried this: dnslookup router.localdomain from my server and from my workstation (Ubuntu 16.04 with Unity). the server has router IP as DNS server and the workstation uses 127.0.1.1. the router's DNS name is found by both systems. But when I try to lookup my server's name both systems do not find it.
Thanks for reading my question.
Marcel.
resolvconf
settings on your server aren't going to affect how clients resolve its name (they are for outgoing lookup); if you don't want to set up an actual DNS server for your local domain you could use avahi/bonjour/mDNS (not sure if that's installed by default in the server installation) to enable addressing in the formservername.local
, or use localssh_config
files on the client(s) to map the servername to its IP. – steeldriver Sep 18 '16 at 13:13