You've asked several things, let me try to unpick each and answer them in turn:
Currently, my DHCP server is handing out IPs in the 192.168.0.1/24 range. What would happen if I set a static IP on a device of e.g. 192.168.1.10?
Firstly we should establish what DHCP is (what problem it solves, and how it works).
Networks can be thought of as having multiple layers (see: OSI layers). IP addresses are a means of identifying who's who at the third layer (Layer 3, Network Layer). IP sits above both the Physical and Data Link layers (L1 and L2). The physical layer is what you "plug into" (literally plugged in the case of your typical Ethernet cable!) and the data link layer deals with how two or more devices may communicate over it.
So yes, two devices can communicate over your home network without IP addresses. They'd likely use "hardware addresses" (or MAC addresses), which are similar to IP addresses - but lower down the layers.
One of the many problems IP (Layer 3) resolves is traversal between physical networks. Not everything uses Ethernet - and we typically want to segregate physical and logical areas for security reasons (and in ways which are beyond the ability of Ethernet, for example).
IP sits atop Ethernet (and many other L2/L1 combinations) and gives every device one or more IP addresses as way of identifying them. Underneath, it still gets translated to the physical addresses.
But there's a minor management problem. We often don't want to deal with setting and changing IP addresses all the time, especially when we have devices joining/leaving our physical network all the time (like the mobile phone in your pocket).
DHCP is a network service/protocol which allocates and tracks IP addresses automatically on a given network. After joining a physical network and establishing a data link (layers 1 and 2), devices can "request" an IP address. Literally, they spew out a message to everyone connected to the same Layer 2 saying "Can anyone give me an IP address?"
Any listening DHCP server may respond. In your home example, it'll allocate a new device an IP address in the 192.168.0.1-254
range. It'll also remember that it's given that device that specific IP address (probably by logging the MAC address in a little registry), so as to ensure nobody else gets the same IP address by mistake.
Also, if the device disconnects and reconnects - the DHCP server can re-assign it the same IP address over and over - which helps higher layers not break unexpectedly.
Added note: In answering, I completely forgot the original question. "What happens if I statically allocate an IP address to device, used by the DHCP pool?". This has been dealt with accurately in another answer.
And just out of curiosity, what would happen if I set the IP to (1) something that exists elsewhere (e.g. on the www)
Now this is a great question. This is a part of the problem that IP (Layer 3) tries to resolve. How do two physically separate Layer 2 networks communicate with one another?
IP can traverse different Layer 2 networks. And it does. In fact, it traverses billions of them, all around the globe. That's worked for a pretty long time (IP version 4 - aka IPv4) as there were enough IP addresses to uniquely identify every connected device on the internet. (Inevitably however, the internet's growth has since outran the number of available IPv4 addresses - which is a separate topic - see IPv6!).
Those who invented IPv4 included technique called Network Address Translation, which allows multiple devices to "hide" behind one IP address. This means your house can be represented as a single IP address on the public internet, and all the devices in your house can have IP addresses also used in other people's houses.
That works on the assumption that everyone agrees to use a strict set of "private" IP address ranges in their houses (and business, etc). There's 3 sets - Class A, Class B, and Class C. One of those will look familiar to you (Class C) - it starts 192.168.x.y
.
We've all agreed that those IP addresses will never be used on the public internet. They're reserved for private networks. Network Address Translation allows your home router to hide all your private IP addresses (on your home network) behind a single public IP address on the Internet.
That brings us into the question of what do your home router do (beside provide a DHCP service for your house!).
Your router knows two things. It knows what your private (internal) IP network is. And it knows a route (path) to the public network (the Internet). That route to the Internet is provided by your ISP. Your router doesn't care what your ISP does, but it knows that traffic from your local network headed for the internet needs to go via your ISP. So it does that.
And this is another feature of DHCP. All your home devices, they need to know where the internet is too. They need to know the route. For them, they don't know anything about your ISP. They just know about your router. So they know this: any traffic originating from themselves, destined for the internet, has to be sent (routed) to your router.
You can see this actually - on Windows (assuming that's what you use), open a command prompt and type route print
. You'll see a list of IP address ranges and where your computer knows to send traffic destined for them. You should see a "default" route which looks like Dest: 0.0.0.0 ... Gateway: 192.168.0.1
. That's saying, "Anything which doesn't match any other rule should be sent to 192.168.0.1
, because they know what to do with it.
DHCP, beside allocating IP addresses, can also tell devices what the "default gateway" for the network is. And, your home router does that! When it sends a DHCP reply to a device, it specifies both a private IP address to use, and a default gateway (itself).
Now, to answer your question. Two things will happen.
Firstly, your home router will refuse to do anything with it - because the IP address is on the "wrong side" (it knows your private network should only have 192.168.0.1
addresses on it). But let's assume you've told your router that your private network is actually 8.8.8.0/24
instead. Well, OK, your router might not complain - in which case everything will work just dandy, until a device at your home tries to reach Google (at 8.8.8.8, for example!).
What'll happen is - your device will say "8.8.8.8
is local, I don't need to send it via my default gateway". The traffic will never reach the internet. Maybe another local device will get it instead. Who knows? Your router will also refuse to route it - because you've told it that IP address range is now private (not on the public internet).
or (2) something that the DHCP server has been asked to assign to another MAC?
In this scenario, undefined behavior will occur. IP ultimately sits atop OSI layers 2 and 1. It'll depend entirely on what happens at those layers - the traffic may or may not make it to the correct location - because you have multiple physical devices all thinking they're the same IP. Most operating systems (including Windows) try to detect this scenario (when they see unexpected traffic coming from another device with the same IP address as itself) and alert you.