-1

On Ubuntu, when I change my eth0 network interface configuration between static and DHCP, the interface settings are updated nicely, but there seems to be a problem updating the DNS.

Before changing, I can refer to the Ubuntu machine from Windows 8 by it's hostname: gkgw-ea16. But after an IP address change, it seems that the changes are not propagated to the router (which I assume has a DNS server) and I'm no longer able to refer to gkgw-ea16 by it's hostname.

C:\Windows\System32>ping gkgw-ea16

Pinging gkgw-ea16 [192.168.1.78] with 32 bytes of data:
Request timed out.
Reply from 192.168.1.42: Destination host unreachable.
Reply from 192.168.1.42: Destination host unreachable.
Request timed out.

Ping statistics for 192.168.1.78:
    Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),

In fact Windows still assumes it's IP address is the same. If I then ping Ubuntu's new IP address from Windows or vice-versa, the hostname then magically becomes resolvable.

I'm not sure if the root cause of this problem is Ubuntu or router related, but what's the correct way to propagate a device's IP address change to the DNS server on a LAN?

doughgle
  • 99
  • 7
  • Why do you assume that the router has a DNS server? – Jenny D Oct 07 '14 at 07:45
  • Because I can refer to a Ubuntu device on the same LAN by it's hostname (as defined in /etc/hosts). How does that work actually? – doughgle Oct 07 '14 at 07:47
  • 1
    To clarify: Why do you assume that it's the router that is acting as DNS server? You've described very little about your setup, but it does not appear to be a professional one as described in the [help]. – Jenny D Oct 07 '14 at 08:05

2 Answers2

1

You will need to create a suitable A record in your DNS for the static IP address. How you do that depends entirely upon the DNS server in use and the tools/privileges available to you.

user9517
  • 115,471
  • 20
  • 215
  • 297
  • I'm not explicitly configuring any DNS, I'm just assuming that one runs in the LAN's router to keep a mapping between hostname and IP address. Am I even close here? – doughgle Oct 07 '14 at 07:40
  • Routers don't generally perform DNS hosting capabilities, meaning they act as resolvers only and don't host any authoritative DNS zones. What you really need is to install your own authoritative DNS server on your LAN for whatever your internal DNS zone is, or what you'd like it to be. You'll need to make sure that all of your internal hosts use the same DNS suffix and are configured to use the internal DNS server for DNS. – joeqwerty Oct 07 '14 at 13:17
  • @joeqwerty I thought the OP was talking about a DSL modem/router all in one box but it's hard to tell based on the info provided. – user9517 Oct 07 '14 at 16:45
1

One of two things may be occurring:

  1. Your router's DNS forwarding service gets host information from the DHCP server and that is how your clients are resolving. Dnsmasq is an example of a DNS/DHCP service that does this.
  2. You're using Multicast DNS (mDNS).

For either of these cases your systems have a cached copy for the other's hostname. You can do one of two things:

  1. Flush the DNS cache on your Windows system: ipconfig /flushdns
  2. Restart avahi-daemon on your Linux system: sudo service avahi-daemon restart

And then try to connect to the other system.

To avoid this problem all together you could use static IPs, static DHCP leases, or longer lease expiration times.

Gene
  • 3,663
  • 20
  • 39
  • I'd tried flushing the DNS cache on windows - that didn't work. My Ubuntu system doesn't have a service called avahi-daemon. – doughgle Oct 07 '14 at 08:13