SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
DHCP vs. Fixed IP
For the past, oh, 25-30 years or so I've been using fixed IP addressing for all my Ethernet equipment; servers, printers, plotters, etc. No wi-fi, everything has a CAT-5 or CAT-6 cable. Everything has a name, everything is added to /etc/hosts on every server, everybody can find everybody else with no problem. I run everything internally as 192.168.x.x with a router that has an assigned fixed IP address facing the outside world.
I've also done the "hosts" trick with sites that are frequently visited, where the site name and address are in /etc/hosts which avoids doing a look up at a DNS server (real quick, that). Not many, just a few.
The only thing I ever use DHCP for is a laptop that might get lugged somewhere with internet services (library, hotel, those kinds of places) but that doesn't happen too often (maybe once every six months).
So, I'm wondering -- other than lugging a laptop around to public access points, what if any advantage is there to DHCP? If somebody brings a Windows laptop around, I'll plug it in to my router and that works just fine but outside of that I really can't see what advantage there might be; am I missing something?
Yes, you've missed the fact that 99% percent of users have never configured their network manually (IP, gateway and so in)., so for them DHCP is more "user-friendly" :-)
So, I'm wondering -- other than lugging a laptop around to public access points, what if any advantage is there to DHCP? If somebody brings a Windows laptop around, I'll plug it in to my router and that works just fine but outside of that I really can't see what advantage there might be; am I missing something?
As an example, here's my office's DHCP server configuration:
In both cases, everything is managed centrally: IP addresses as well as hostnames. So if one of the fifty-something students connects his or her laptop, I can be sure there's no conflicting IP address. And if some piece of hardware needs to be changed (which happens, I just changed "raymonde" and "bernadette" here in my office), all I have to change in the setup are the according MAC addresses in dhcpd.conf, and everything else stays pretty much the same. With the according DNS configuration (Bind as primary master), hosts can be resolved with their names.
Configuring everything statically on each host with an entry for every other machine in /etc/hosts is not only a nightmare in terms of sheer work, but you're also much more prone to conflicting addresses. Besides, nobody else can "just connect" to your network.
For small, slowly changing networks fixed IPs and hosts files are simpler and more robust than having (to rely on) a DHCP server.
For large and/or rapidly changing networks it is simpler to have a DHCP server (or, better, a failover pair of DHCP servers) and dynamic DNS; the complexity is outweighed by the advantages of having a single configuration file.
Nowadays DHCP is state of the art. Normally if you have a router in your home-network (or office) it provides also DHCP, why not use it? I've only configured my Server with a fixed IP-adress.
Static Addressing is useful if you need to track certain machines in a large environment such as a school or business and manage the endpoint machines, but in smaller networks DHCP works fine. Static mostly is now a fall-back/fail-safe in case DHCP doesn't work correctly.
Static Addressing is useful if you need to track certain machines ...
Static, documented IP addresses can enable more flexibility/control in setting up firewall rules, fancier routing schemes, and traffic logging. (along with MAC if appropriate) Not something most people would probably be concerned with at home however.
DHCP is for automatic network configuration, the static vs. dynamic ip address debate is pointless since dhcpd can assign both static and dynamic ip addresses.
DHCP basically saves you the admin and user the excruciating headache of knowing which IP address scheme is used, if the IP address is available, which subnet address is valid, the gateway address, etc. etc. etc...
In short... DHCP is, to an extent, idiot-proof network addressing.
I used to use manually set up static assignments, but got really tired of having to configure the network every time I wanted to hook a new device up to the network, do a trial OS install on some machine's spare partition, boot from a USB drive to do disk imaging or a standalone backup, etc. Now I have a DHCP server configured with fixed assignments for known MAC addresses and with dynamic assignment from a different part of the address space for unknown new devices. Makes life a whole lot easier.
Since I run my own local DNS service on a Slackware box in my local network, I have my DHCP server tell my DNS server what new machines have shown up in my network.
Everybody has a name and everybody uses the name. It makes life easier.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.