Setting Up Static IPs and DNS

I want machines on my network to be able to talk to each other via hostnames (fqdns). Here's how I set that up.


On my local router (a TP-Link Archer C3150), I set up static IPs for each device. The right menu is located from

Advanced Tab at the top -> Network button to the left -> DHCP Server beneath Network

Static IPs must be in the local LAN ( for me from the Network -> LAN menu) and I prefer them not to be in the DHCP pool either ( So I gave my devices some static IPs starting from This does limit me to 54 devices.

I had to reset the router before pinging the static IPs would work.


Next is setting up DNS entries on my Registrar. I use NameCheap and finding the menu for this wasn't too hard:

Manage To the left of the selected domain -> Advanced DNS at the top -> Add New Record

I added an A : -> record with an auto TTL (which for some reason is 1701 right now...).

At this point, I'm able to ping a host by the new fully qualified domain name.

NOTE: because these fqdns are publicly available, they present security risks:

  • Someone could see what devices I have by inspecting DNS
  • I could connect to the wrong host while connected to someone else's private network.

For my use case, both of these risks are acceptable.


This part isn't strictly necessary, but it is nice.


For some reason, one of these commands failed...

➜  ~  sudo scutil --set LocalHostName
SCPreferencesSetLocalHostName() failed: Invalid argument


$ hostnamectl set-hostname
$ systemctl reboot