1

I'll do my best to provide as much information as possible, I'm still fairly new to linux, but I have Ubuntu Server 18.04.4 currently running my media server, and I'm trying to set a static IP.

I found plenty of tutorials online, I can get it to work fine by editing a file called 50-cloud-init.yaml, and here are the settings that I had:

network:
    renderer: networkd
    ethernets:
        eno1:
            dhcp4: no
            addresses: [192.168.2.46/18]
            gateway4: 192.168.2.1
            nameservers:
                addresses: [192.168.2.1,1.1.1.1]
            dhcp4-overrides:
                hostname: starlight01
                send-hostname: yes
                use-hostname: yes
    version: 2

Now that works perfectly fine, and I do the whole sudo netplan apply thing, and I can browse my samba shares from by doing \\192.168.2.46\ however, I have a few applications that rely on the machine name, not IP, and for some reason, when it's a dynamic IP I can type \\starlight01\, but it suddenly stops working when I use the machine/host name.

I would also like to add that every machine stops being able to access via the machine name.

When it has a static IP, I can ping by IP, and get a response, but pinging by machine name results in a timeout, but pinging with a Dynamic IP works fine for both.

I have also tried the following:

  • rebooting my router, and associated switches
  • rebooting the server
  • dns flush on my windows machine
  • rebooting my windows machine
  • removing the dhcp4-overrides section of the said file
3
  • 1
    Is this really a home network that needs a /18 CIDR and not a /24 for the network? A /18 makes the valid network 192.168.0.1 - 192.168.63.254
    – Terrance
    Mar 20, 2020 at 0:50
  • Have you tried machinename.local or starlight01.local?
    – user68186
    Mar 20, 2020 at 0:52
  • 1
    Response to @Terrance: That's my mistake, I used an online calculator for the cidr notation, and probably mis-typed the ip address, or range, and it probably gave me that number, instead of /26 (my subnet is: 255.255.255.192) (I had to look it up) , will try the correct CIDR notation first. Response to user68186: I have not tried the .local I shall give that a go, if using the correct CIDR notiation doesnt work Mar 20, 2020 at 1:04

1 Answer 1

0

Your client machine always connects to the server using an IP address. When you ask it to connect using a machine name, it internally converts the name to an IP address using some service. A variety of name->IP conversion services exist, and you're probably relying on DNS (Domain Name System) in your case. Other options are WINS, MDNS, LLMNR, ... Your client machine probably uses your network/WiFi router (or router/modem combo unit) as the DNS server, which uses information from DHCP requests to create a local name->IP mapping table, which it uses to respond to some of the DNS requests made by your client machine.

What happens when you have DHCP enabled on the server is:

  • When the server needs to get its own IP address, it sends a DHCP request to the DHCP server; typically to your WiFi router or router+modem.
  • The DHCP request includes the name of the machine making the DHCP request.
  • The DHCP server assigns an IP to the machine, and records the IP/name pair in an internal database.
  • The DHCP server sends back the IP to the server for it to use.
  • Whenever another system asks for the IP associated with the server's name using the DNS protocol, the DNS server first consults the local database created by the DHCP server, and provides an answer from that if there is a matching entry (otherwise it continues to query the Internet at large).

When you use a static IP address, the DHCP request is never made, so the DHCP/DNS server never get an opportunity to add the relevant entry into the local name/IP database.

As mentioned in one of the comments, you can probably use servername.local as the name instead of servername, and it will work (this uses MDNS). Linux and I think Mac clients support this, but Windows doesn't unless you've installed non-default software that supports this protocol (e.g. Apple's Bonjour software stack).

Since I see UNC paths (those starting with \) in your questions, I assume your client machine is Windows, and you're running Samba on the server. In this case, you can tell Samba to act as a WINS server. WINS is another name->IP mapping protocol. I think your client machines will just find the WINS server and automatically start querying it for name lookups, at least for the Windows/Samba file-sharing protocol. If not, you may need to either: - Enable a WINS server on your router, and tell Samba to register with it, or - Configure your router's DHCP server to tell clients about the WINS server running on your file server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .