LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   DHCP vs. Fixed IP (http://www.linuxquestions.org/questions/slackware-14/dhcp-vs-fixed-ip-4175436549/)

tronayne 11-10-2012 08:01 AM

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?

zk1234 11-10-2012 08:12 AM

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" :-)

kikinovak 11-10-2012 09:39 AM

Quote:

Originally Posted by tronayne (Post 4826481)
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:

Code:

# /etc/dhcpd.conf
authoritative;
default-lease-time 86400;
max-lease-time 86400;
option broadcast-address 192.168.2.255;
option subnet-mask 255.255.255.0;
option routers 192.168.2.254;
option domain-name-servers 192.168.2.1;
option domain-name "microlinux.montpezat";

subnet 192.168.2.0 netmask 255.255.255.0 {
        range 192.168.2.100 192.168.2.200;
}

host alphamule {
        hardware ethernet 00:1D:92:B2:F3:9E;
        fixed-address 192.168.2.2;
        option host-name "alphamule";
}

host bernadette {
        hardware ethernet 00:0d:61:a6:e7:1e;
        fixed-address 192.168.2.3;
        option host-name "bernadette";
}

host raymonde {
        hardware ethernet 00:20:ed:b8:e8:ec;
        fixed-address 192.168.2.4;
        option host-name "raymonde";
}

host betadine {
  hardware ethernet 00:19:DB:44:C5:94;
  fixed-address 192.168.2.5;
  option host-name "betadine";
}

host buzz-wired {
  hardware ethernet 00:0B:97:96:3C:E1;
  fixed-address 192.168.2.6;
  option host-name "buzz";
}

host buzz-wireless {
  hardware ethernet 00:13:CE:EE:20:3A;
  fixed-address 192.168.2.6;
  option host-name "buzz";
}

host bebette-wired {
  hardware ethernet 00:27:19:F1:BC:3A;
  fixed-address 192.168.2.7;
  option host-name "bebette";
}

host bebette-wireless {
  hardware ethernet 00:19:E0:83:3A:C1;
  fixed-address 192.168.2.7;
  option host-name "bebette";
}

host jukebox {
  hardware ethernet 00:30:1B:AF:43:D3;
  fixed-address 192.168.2.8;
  option host-name "jukebox";
}

And here's part of our school's configuration for DHCP:

Code:

# /etc/dhcpd.conf
authoritative;
default-lease-time 86400;
max-lease-time 86400;
option broadcast-address 192.168.2.255;
option subnet-mask 255.255.255.0;
option routers 192.168.2.1;
option domain-name-servers 192.168.2.1;
option domain-name "scholae.sainthippo";

subnet 192.168.2.0 netmask 255.255.255.0 {
        range 192.168.2.10 192.168.2.90;
}

host poste1 {
        hardware ethernet 00:30:05:55:ba:23;
        fixed-address 192.168.2.101;
        option host-name "poste1";
}

host poste2 {
        hardware ethernet 00:30:05:55:db:06;
        fixed-address 192.168.2.102;
        option host-name "poste2";
}

host poste3 {
        hardware ethernet 00:30:05:55:dc:47;
        fixed-address 192.168.2.103;
        option host-name "poste3";
}

host poste4 {
        hardware ethernet 00:30:05:45:a7:08;
        fixed-address 192.168.2.104;
        option host-name "poste4";
}

host poste5 {
        hardware ethernet 00:30:05:53:45:6c;
        fixed-address 192.168.2.105;
        option host-name "poste5";
}

host poste6 {
        hardware ethernet 00:30:05:55:dc:37;
        fixed-address 192.168.2.106;
        option host-name "poste6";
}

host poste7 {
        hardware ethernet 00:30:05:56:27:a7;
        fixed-address 192.168.2.107;
        option host-name "poste7";
}

host poste8 {
        hardware ethernet 00:30:05:4b:82:fd;
        fixed-address 192.168.2.108;
        option host-name "poste8";
}

host poste9 {
        hardware ethernet 00:30:05:53:53:ba;
        fixed-address 192.168.2.109;
        option host-name "poste9";
}

host poste10 {
        hardware ethernet 00:30:05:4b:81:d0;
        fixed-address 192.168.2.110;
        option host-name "poste10";
}

host bigbrother {
        hardware ethernet 00:16:41:37:4a:c8;
        fixed-address 192.168.2.200;
        option host-name "bigbrother";
}

host littlesister {
        hardware ethernet 00:16:41:37:7f:d7;
        fixed-address 192.168.2.201;
        option host-name "littlesister";
}

host oldbox {
        hardware ethernet 00:0d:61:ae:6b:8f;
        fixed-address 192.168.2.250;
        option host-name "oldbox";
}

host surfingscholae {
        hardware ethernet 30:46:9a:01:99:2e;
        fixed-address 192.168.2.253;
        option host-name "surfingscholae";
}

host babar {
        hardware ethernet 00:0c:76:25:eb:39;
        fixed-address 192.168.2.254;
        option host-name "babar";
}

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.

Cheers,

Niki

catkin 11-10-2012 10:09 AM

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.

markush 11-10-2012 12:52 PM

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.

Markus

ReaperX7 11-10-2012 01:33 PM

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.

TracyTiger 11-12-2012 07:27 PM

Network Control
 
Quote:

Originally Posted by ReaperX7 (Post 4826628)
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.

XGizzmo 11-12-2012 08:24 PM

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.

ReaperX7 11-12-2012 08:38 PM

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.

rknichols 11-12-2012 09:12 PM

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.

frankbell 11-13-2012 08:24 PM

I use static IP addresses for my file server and my printer, so it's easy for me to connect to them from other computers.

Everything else is DHCP.

Richard Cranium 11-13-2012 09:43 PM

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.


All times are GMT -5. The time now is 08:11 AM.