Okay. So next I'm going to talk about a specific kind of addressing protocol called Dynamic Host Configuration Protocol. As you might be able to guess from its name, it's about configuring hosts automatically. What it's about is it's about configuring host automatically to use the network. So it automatically assigns a host IP address, subnet mask, DNS server, default gateway and all these sorts of things. It's everything you need to know to communicate on a new network. It's a protocol that runs on UDP, which is a transport protocol. Clients listen on port 68, and servers listen on port 67. So this is actually a very interesting design decision for DHCP. Because if you think about it, why is this protocol layer four? UDP is a layer four protocol, but all these operations have to do with layer two, right? When you walk into a new network, you need to broadcast and discover stuff. That can all happen at layer two, right? Why are we using layer four? In fact, isn't it really silly to use layer four? We can't even communicate on the network yet. Our layer three isn't set up, we don't have IP addressing yet. So the reason why this was done, and this wasn't always done, there's earlier versions of DHCP which were actually at layer two. But the reason why it got moved up the stack, is because sometimes we needed to do this across LANs. In the old days, we'd have to have a DHCP server per LAN and then that got annoying. So what we're able to do is we're actually able to do DHCP across multiple hops using some tricks, and we'll see what those tricks are. That's the motivation for this, that's why we do this at the transport layer. You might be also wondering, how can we even send packets at layer three when we don't have our IP address yet? That's actually easy to solve. When this protocol first starts up, you just use 0.0.0.0 as your source address because that address happens to be in broadcast and IP. So you can respond back to the broadcast address. We'll see how all this works in a minute. But the way DHCP works, is it gives out this information to new hosts that join the network. Now if you think about it, you can't just give out this information forever because it'll get stale. Information changes over time. You might need to renumber your network and change IP addresses. There might be other hosts that come in, you might need to give them the IP addresses. You might change who your DNS server is, where your DNS server goes, then you want to appoint a host somewhere else and so on. So to deal with staleness, you don't just give out this information. You give it out for a certain period of time, you time it out. So DHCP has a notion of a lease time. You give out this information with a lease. When the lease expires, it's on the host to renew it and get new information. So this information is cached at the host and is considered stale after the lease time expires, at which point it's removed and then those can optionally make another request to get updated information. If you want to look this up, this is all defined in RFC. RFC is a document which defines a protocol specification, created by the IETF. These RFCs have numbers. The RFC number for DHCP is 2131. So you can do a Google search for RFC 2131 and this will come up right away. So to see how this actually works, let me go through a specific example. So as you have a client, which might be a laptop or an IoT device, and it wants to get connection information from the network. Well, what we're going to do is when we set up our network, we're going to place a DHCP server on it. This DHCP server might exist on a router or it might be a separate stand alone box. But whatever it is, it's going to maintain a pool of addresses, available IP addresses and it's going to give those out to clients when they connect. So what the client is going to do is when it first connect to a network, it's going to realize, I have a connection to a new network and I need an IP address to communicate on it. So it's going to send out a message saying, "Can anyone give me an IP address?" It's going to be broadcast out. Now the thing is, it's not just going to ask for an IP address. It's also going to ask for other configuration information like, what the subnet mask is and things like that. But there'll be one message to ask for all this stuff. So the client's going to broadcast it out using a DHCP discover message. So DHCP has a set of message types in the protocol, and the discover message is what is used to request a DHCP server to respond back with this information. So the client will send a DHCP discover message. When the DHCP server receives it, it'll lookup in available address out of its pool and other configuration information, and it'll send it back to the client. It'll say, "Sure, you can use 10.0.0.3, that one's available. So it will give an offer back to the client. It'll send a DHCP offer message. So the client will sit there, it'll receive the DHCP offer message. The DHCP protocol actually allows multiple servers to exist on your network, so it might actually get multiple offers back, that's fine. What it'll do, it'll sit there and receive one or more offers. It'll pick one. It'll send another message where it'll request use of that address. It'll say, "Okay, I would like to use 10.0.0.3." The corresponding DHCP server will receive that and it'll send another message back saying, "Okay, you can use that address." So this is like a two-phase commit if you're familiar with that protocol. It's like you offer an address and then you confirm use of that address. You need two separate phases for safety. At that point, the client has the information it needs. It has the IP address. So it has the ability to communicate on the network. So it's done. Later on it might say, "I'm done with the address." Maybe you chose a shutdown under Windows and you're turning off the computer. If it's going to be nice, it's going to release that address. It's going to send a message back to the DHCP server saying, "I'm going to release that address." The server will receive that and return the address back to the available pool. Now the thing is, the client may not do a release, if the client crashes or something like that, or if it moves with a radio range of your network, it might not be able to send a release. So releases are not required, but they're a nice optimization to the protocol because it's good practice to give back address that you're not using. Okay, so this is how DHCP works. It is a mechanism to assign configuration, information to host. So we discuss how it works. Next, we're going to talk about art which is another address resolution protocol that's widely used in practice.