On Thu, 2016-09-15 at 12:05 +0200, Peter Boy wrote:
you can manually assign fix IP addresses to network devices. You
router will find out by itself about IP addresses in use and won’t
offer them in the DHCP process.
How? And under what conditions? If I remember correctly, a DHCP server
doesn't check that an IP address is in use, other than what it already
knows about through its own database (this "checking if it's free"
behaviour depends on how the DHCP server was programmed - whether it
does any checks, or just assumes that it's the god of IP address
assignments). You'd have to rely on a client being given an address, it
trying it, and it refusing it if it (the client) finds an error (which
it may not do if the first client to have that IP doesn't respond, or
respond quick enough).
If by in-use, you mean currently in-use, then a DHCP server may or may
not know about some other device using that IP (and that may depend on
network topology), and may work around it. For instance, if my DHCP
server tried to give out 192.168.1.20 to some second device when it's
already in use on my LAN (but that first device wasn't given that
address by the DHCP server), it'll try to give out that IP to the second
device, and it's only network errors that are going cause a problem.
But, an address that another computer, for example, uses when its turned
on, but is currently turned off, is not currently in-use, even if you
did want it reserved.
If you want things to have predictable IPs, you do need to fix them, not
rely on good luck.
If you're mixing static and dynamic IPs, you really need to pre-program
the DHCP server to handle that. e.g. Tell the DHCP server that it can
freely assign IPs in a range (like 192.168.1.100 to 192.168.1.199) to
any random device, and you make sure that any static IPs that you set up
are outside of that range. That applies whether you manually configure
individual devices to use static IPs, or centrally use a DHCP server to
give predetermined IPs to specific devices.
On my LAN, I have four ranges of IP addresses within one subnet that I
reserve for different purposes, and the DHCP server is configured
Static IPs configured in important devices (e.g. servers, routers), that
need to be self-configuring, independent of any DHCP server that may not
be available as they boot up.
e.g. x.y.z.1 to x.y.z.50
Fixed IPs that are always assigned to the same devices by the DHCP
server, for the usual client machines on the LAN. I want these devices
to always have the same IP, for the sake of less headaches, but I want
to centrally manage them. So the DHCP server is set to always give out
the same IPs to the devices recognised by their MACs (network hardware).
e.g. 192.168.1.51 to 192.168.1.100
Random dynamic IPs available to irregularly connected devices., for
visiting, drop-in test machines, unimportant devices, that I don't care
what their address is. They're generally only clients, and nothing else
will need to connect *to* them. This lets random things (internet
radios, games, whatever), simply work when plugged in. This is the only
range that the DHCP is allowed to dole out randomly.
e.g. 192.168.1.101 to 192.168.1.200
Spare IPs, that I may use when dealing with debugging devices. I can
freely set a device to use an IP in this range, knowing that there's not
going to be a bunfight with the DHCP server, and that nothing else
should be using them.
e.g. 192.168.1.201 to 192.168.1.253
They're all on the same subnet, and can all work with each other. The
router (internet gateway) offers an isolated second subnet, so that
visitors could get onto the internet without any ability to mess with
the LAN (the router provides firewalling, as well as the network
addressing causing sub-net isolation).
e.g. 192.168.2.100 to 192.168.2.200
Networks can be as simple, or as complex as you need them to be. But
messy "I don't know what I'm doing, and I'll randomly try things that
seem to work" just causes all sorts of headaches, sometimes immediately,
sometimes quite later.
tim@localhost ~]$ uname -rsvp
Linux 3.19.8-100.fc20.i686 #1 SMP Tue May 12 17:42:35 UTC 2015 i686
All mail to my mailbox is automatically deleted, there is no point trying
to privately email me, I will only read messages posted to the public lists.
George Orwell's '1984' was supposed to be a warning against tyranny, not
a set of instructions for supposedly democratic governments.