I installed a Linux (Ubuntu) server inside my home LAN, initially it's automatically configured to use DHCP interface. I'm connecting to this server from another computer using that server's hostname. All OK, my router is configured to use DHCP inside my home network and gives an IPs automatically to each computer. But when I connect to this host using SSH, it warns me that I should accept a fingerprint from each newly assigned IP of the server, and it's a little annoying. So I configured it to use a static IP addressing editing the /etc/network/interfaces
file like this:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0 iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
All works well except that I can't connect to this server using it's hostname. When pinging I see that it's routed to the last assigned IP address that was given by DHCP dynamically, and of course Destination Host is Unreachable
. I know that I can hardcode it in my /etc/hosts
file, but I want to know -- why it works well with DHCP and it doesn't with static. Apparently, I don't understand something. Thanks in advance!