Static IP, Host Names and Name resolution for LAN devices - What is best practice ?

mk76

Adept
I give static IPs to all devices at home. Group them by type. For ex
  • 192.xxx.xxx.1-20 - The backbone - Routers, pihole, printer,nas etc
  • 192.xxx.xxx.50-100 - Servers, virtual machines
  • 192.xxx.xxx.100-150 - PC/laptop
  • 192.xxx.xxx.150-200 - Mobile devices
  • 192.xxx.xxx.200-250 - Media , TV, Chromecast etc
Q1 Is this a good practice ?

There is no explicit workgroup or domain defined.
Q2 Is this a good practice ?

In my Asus AC86U, I've to manually give the hostnames/client names. But pihole does not recognize the names and list devices as ip.
What is best way to assign persistent IP + Host names + name resolution such that the config can survive router change and that all devices on lan can recognize others by hostnames?
 
I have configured my main router DHCP server to hand out static IPs to some devices and hand out DNS server IP as my RPI which is running pihole with mapping hostnames to the static IPs... So I can ping, iperf, ssh etc using the trendy cool hostnames instead of IPs.

I guess I could even disable DHCP server on the router and run everything on RPI too, to "survive router change" as you ask?
 
There a way to reserve ip address for each device based on mac id . I used to do that , rather than assigning in each device.
In router i can see which is connected and reserve a defined ip.
My main pc will take some fancy number like 192.168.1.10 etc.

hope other network admins can help you in this regard

@gwrench2000
 
There a way to reserve ip address for each device based on mac id . I used to do that , rather than assigning in each device.
In router i can see which is connected and reserve a defined ip.
My main pc will take some fancy number like 192.168.1.10 etc.

hope other network admins can help you in this regard

@gwrench2000
Yes via setting what is called a DHCP reservation.
 
I give static IPs to all devices at home. Group them by type. For ex
  • 192.xxx.xxx.1-20 - The backbone - Routers, pihole, printer,nas etc
  • 192.xxx.xxx.50-100 - Servers, virtual machines
  • 192.xxx.xxx.100-150 - PC/laptop
  • 192.xxx.xxx.150-200 - Mobile devices
  • 192.xxx.xxx.200-250 - Media , TV, Chromecast etc
Q1 Is this a good practice ?

There is no explicit workgroup or domain defined.
Q2 Is this a good practice ?

In my Asus AC86U, I've to manually give the hostnames/client names. But pihole does not recognize the names and list devices as ip.
What is best way to assign persistent IP + Host names + name resolution such that the config can survive router change and that all devices on lan can recognize others by hostnames?
This grouping reminds me of DNS zoning.
Here is an article to setup a home DNS server using CoreDNS.
Run Your Own Home DNS on coredns // Qiu's Quibble (idempotent.ca)
 
For hostname resolution, have you considered mDNS? Any popular implementation should work - having recently switched from Avahi to systemd-resolved for local hostname resolution, it really has made life easier.

Personally, I use a combination of plain DHCP (for devices I don't need access to - TV, etc.), static leasing (devices I need access to, but cannot use mDNS on - Android devices, etc.) and mDNS (for all other machines I need access to).
 
I give static IPs to all devices at home. Group them by type. For ex
  • 192.xxx.xxx.1-20 - The backbone - Routers, pihole, printer,nas etc
  • 192.xxx.xxx.50-100 - Servers, virtual machines
  • 192.xxx.xxx.100-150 - PC/laptop
  • 192.xxx.xxx.150-200 - Mobile devices
  • 192.xxx.xxx.200-250 - Media , TV, Chromecast etc
Q1 Is this a good practice ?

There is no explicit workgroup or domain defined.
Q2 Is this a good practice ?

In my Asus AC86U, I've to manually give the hostnames/client names. But pihole does not recognize the names and list devices as ip.
What is best way to assign persistent IP + Host names + name resolution such that the config can survive router change and that all devices on lan can recognize others by hostnames?
Yes to Q1 -- Yes sort your devices into discrete IP ranges. It makes management much simpler.
Yes to Q2 -- for a small home network it would default to workgroup.
Solution for third issue is to use DHCP (and DNS) from PiHole, rather than the main router. The main router will have its DHCP disabled and only used as the default gateway. This will ensure hostnames for clients requesting DHCP will get automatically updated. If you use static IP assignments, you would also need to manually add the hostname to the respective DHCP reservation while creating it.
 
Thanks @gwrench2000 .
I initially had DHCP set pi-hole. However I moved back to router for some reason I do not remember.

Nevertheless it is possible to have router work as fallback DHCP if I set pihole primary one to pihole ?
 
@mk76 no you can only have 1 DHCP server per subnet else their broadcast messages (between clients and servers) will clash (DHCP-DISCOVER etc)
 
For hostname resolution, have you considered mDNS?
Will read about that. Thx

I guess I could even disable DHCP server on the router and run everything on RPI too, to "survive router change" as you ask?
I've tried it earlier but for some reason moved back to router. Will consider this option. Thx

There a way to reserve ip address for each device based on mac id . I used to do that , rather than assigning in each device.
If ur router supports mac binding then do that
Already using mac binding to assign static IPs . Thx


Here is an article to setup a home DNS server using CoreDNS.
Will go through. Thx
@mk76 no you can only have 1 DHCP server per subnet else their broadcast messages (between clients and servers) will clash (DHCP-DISCOVER etc)
Found this . https://serverfault.com/questions/368512/can-i-have-multiple-dhcp-servers-on-one-network
Very well explained.
 
Thanks @gwrench2000 .
I initially had DHCP set pi-hole. However I moved back to router for some reason I do not remember.

Nevertheless it is possible to have router work as fallback DHCP if I set pihole primary one to pihole ?
You already have an answer to your question, in the good explanation at https://serverfault.com/questions/368512/can-i-have-multiple-dhcp-servers-on-one-network. Once you start segregatting devices and computers into seperate IP ranges and such, you are a small step away from VLANS. The VLANS would allow you to actually segregate clients into seperate (V)LAN and make firewall rules that control how traffic can flow across. Get yourself two cheap openwrt routers and you will be able to perform many neat networking tricks which are usally found only in expensive commercial routers.
 
Back
Top