Dynamic and Static IP Addressing
Dynamic and Static IP Addressing
It has to have a subnet mask and it has to have the default gateway.
The old fashioned way is statically you literally go up to the machine you find the
right configuration screen and you type all this information in.
Now there are two terms one of them is DHCP or Dynamic Host Configuration Protocol
and the Linux people tend to use the term boot p.
So either one of these terms are pretty much interchangeable and what it means is
that when your computer first boots up in the morning it doesn't have any IP
information at all.
So I've got this is my computer right here and it's turned off right now.
You haven't seen this in previous episodes but this is going to be like Windows
server or something like that.
Now you'll notice that they're all on one broadcast domain they're all hugging off
the same switch.
Now this DHCP server can be special software sitting on certain computers but most
home routers also have DHCP server capability your individual computers need to be
D.H. the clients.
Now assuming that the DHCP servers are running this is pretty much what takes place
when you first boot this computer up.
He will begin sending out a broadcast called a DHCP discover and now at this point
your computer doesn't have an IP address or any IP settings at all.
So it just sends out a broadcast on the MAC address of all F's to all these
computers and it's looking for DHCP server.
Now I'm going to say that I've got DHCP server software running on this is a
Windows server system.
But when this guy gets it he knows this guy's MAC address.
So what he's going to do is send a unicast traffic straight back to him with what's
known as a DHCP offer.
So we start off with the DHCP discover which is a broadcast and then a DHP offer
which is a unicast right back to it.
Now when your computer hears that what he's then going to do is going to go OK I'll
take that and he'll send what's known as a DHCP request back to the DHCP server.
When he does this he's basically telling the DHC the server Yep I'm going to take
this information that you're giving me and I'm going to use it once the DHCP server
hears that he sends a DHCP acknowledgment which says OK we're going to do it.
And once this takes place the DHCP server will store all of this information in
there and he'll keep track of all of the different clients that are out there that
are using DHCP So the important thing to appreciate about DHCP is that you've got
to have a DHCP server.
Anybody who's got a home router almost all those have DHCP servers built in.
And we also have DHCP servers that run with just about every different operating
system too.
So the trick is number one if you're going to be using DHCP only have one DHCP
server.
Remember DHCP servers are designed to respond to broadcast so if you have two
running and they're passing out different information that would be what we call a
bad thing.
Secondly the other thing you need to appreciate is that DHCP servers have to be
within the broadcast domain.
You can't have a DHCP server outside of your network that your network responds to.
Now understanding that lets go through the process of watching DHCP And what I want
to do is let's take a look at a Windows server and a Windows client and a home
router and see how it all interconnects.
One of the fun things about working here in a home office is I've got all these fun
toys all over the place.
Upstairs I've got Windows servers and I've got routers and all kinds of stuff
laying around and it's a great way to show you guys DHCP.
Now to show you DHCP I actually had to plug into my wired network because for
security reasons you cannot configure any of my routers or servers over a wireless
network.
Good idea.
Now for this particular example I'm going to be using Windows 8 but you can do this
with any operating system.
There'll be a couple of small variances and I'll show you as they come up.
OK.
So as we type in IP config you're going to see now right here is my wired network
card.
I know it says external virtual switch but I'm running virtual machines so don't
worry about that it's a Windows 8 thing.
What's important here is that you'll see that I have a default gateway a subnet
mask and an IP address.
Now what I want to show you when we go into control panel real quick
and in Windows 8 it's network and sharing center and we're going to go to change
adapter settings and I've got to go to this virtual switch and I'm going to go to
properties
and let's go down to our IP settings now they call it IP version 4.
So we're just going to go to TCP/IP IPv4 for and this is what I want to show you.
Notice it says obtain an IP address automatically also says obtain DNS server
address automatically.
So do Macs so does Linux pretty much any computer when you first install it
assuming it finds a network card you have good drivers.
I literally have to go in and type these addresses in but I don't want to because
I'm lazy and love DHCP so I'm going to leave this right now as obtain everything
automatically I'll just hit cancel and hit cancel here.
And you can see that I have good IP information now what I'm going to do now is
going to clear the screen.
I to do an IP config slash all and we're going to get a little bit more information
here.
Oh by the way on a Linux machine and on many Mac machines you can just type I f
config and get basically the exact same results.
OK.
So you can see when I type it in this way we see a little bit more information for
example it tells me my DHCP server is when I need to 168 15 1.
And there's my IP address and all that type of stuff with this information.
The DHCP server is one entity 168 Fatina out one but it's also my default gateway.
Guess what.
This is my router and like most home routers we can access that just by opening up
a web browser.
And I'm just going to type in the IP address just like we saw there.
In fact a lot of even more serious routers all have a web interface.
So I'm going to go ahead and log in I've logged in before and here I am inside the
router itself.
At this point the only thing I'm interested in is the DHCP part.
So we're going to look on what they call the landside on this particular router
that's what they call it.
So what I want you to look at is that when I first set this router up by default it
had an IP address like 192 160 1.1.
I changed it to 15 1 and I said it's subnet mask is a whack 24 you see that right
there.
And on most of these home servers they want to make life as easy as possible.
So if I disable it then there is no DHCP there is one other little kind of cool
feature called DHCP relay earlier in this episode.
I said that your DHCP server has to be within your broadcast domain.
And what it'll do is that when it hears any DHCP requests it will forward it to
that DHCP server based on whatever IP address he type in there.
First of all if you're going to DHCP server it has to have a chunk of IP addresses
to pass out.
So it says the starting address is going to pass out as 192 168 one hundred.
A lot of times you want to use a bigger number because like for example 2 1 6 8 15
one is your gateway.
Maybe you've got servers at 192 160 15:3 that kind of thing.
But there's no law of physics here you just type in some value and then it says how
many do you want me to pass out.
And in this case I only pass out five I don't pass out a lot of DHCP IP addresses
and I do that as a security issue.
OK.
The client lease time when you connect as a client to a DHCP server you have a
certain amount of time where you have to reapply that lease and by default with
this guy.
Zero minutes means one day and that's that's unique to this particular router.
If we wanted to we could also type in DNS servers now DNS is the part of the
Internet that allows you to type in www.youtube.com and actually turn that into an
IP address.
And what's happening here is that my router is actually using the DNS server that
I'm connected to through my ISP in this case Comcast.
And even though I haven't typed anything in it just grabs its own DNS server and it
passes that out to everybody.
All right.
So here's that external virtual switch again and you'll see I don't have any IP
information here.
I forgot that I still have my wireless card working so I do have some other stuff
for pretend like you don't see any of that.
OK.
I can do IP config slash renew assuming that I have a DHC server it's complaining
about other connections not the one that I'm worried about.
It reconnects.
Ignore the.
There it is.
Now you have to keep in mind that the DHCP servers that we see on these little home
routers are actually very simplistic.
We can make it a lot more powerful but to do that I need to fire up a really big
heavy duty DHCP server and let's take a look at the windows 2012s server.
DHCP server.
It comes with Windows 2012 server with Windows servers versions you get a lot of
extra utilities and one of them is a DHCP server.
So let's take a look at a more serious DHCP server would look like.
First of all when you set up a DHCP server what you do is you have to create what's
known as a scope.
So let's actually go through the process going to kill the scope and let's just
take it from the top.
So what I'm going to do is create a new scope and this little wizard comes up.
So I'm going to call it Fred this lips and we call it Fred the scope.
Now keep in mind I've already turned off the other DHCP server it would be a bad
thing to have both of these running.
So 100.
And now it's going to ask what subnet do I want to pass out so I can do 24 in that
kind of cool.
So I've already set up two pieces now I can also put in what are called exclusions.
For example if there's somewhere within that scope range there's a particular IP
address that I want to keep away from the scope I could type that in here.
So for example I could type in 182 168 15 dot 102 to 1 and to 168 15 102.
And if I had somebody in the 102 then it wouldn't pass that out.
If you use exclusions though that shows that you have set up your DHCP properly
because you should have a nice broad range that nobody's going to stomp on the next
thing is the least duration.
The only downside that can run into problems is that if you're in a environment
where you have like a bunch of laptops like if you're in a coffee shop you probably
want to set your lease time to just maybe a couple of hours as people are moving in
and out.
You could literally run out of DHCP the leases because people don't connect
disconnect properly.
But will believe it is a that's good for most desktops and now it says Do you want
to do options.
And now here's where you can do all kinds of stuff like for example this is where
we put in the default gateway we've got to do that one.
Now we can put in DNS information here for example if we wanted everybody who
joined to become a member of special dot total seven dot com I could do that here
or I could just make life easy and I could just add a couple of DNS servers here.
It's going to try to validate that and it's going to discover that I made it up.
I'm sorry
I don't want to see this little time out and play golf.
OK.
Now there's other stuff with names like when servers and things like that.
So now we've actually turned the scope on and it will start working.
In order for DHCP to work you're going to have to have a server and a client.
The servers are going to manifest well in smaller networks that's usually going to
be some little home router and on larger more sophisticated networks you tend to
use things like the DHC server that comes with Windows Server for example.
Macs do.
The important thing is that within a broadcast domain unless you're doing weird
things you should only have one DHCP server running.
Keep in mind it's going to have to set up a pool of IP addresses to pass out.
It's going to have to give a subnet mask default gateway and usually a DNS server
too as well to access that DHCP server.
All you have to do from your client side is well if you're doing it right.
Once you plug in your computer should automatically pass out all that IP
information and you can verify it by typing IP config in Windows have config on a
Linux system whatever it might be and actually see that you've got those settings.
Now that's how DHCP works and everything's pretty and works well.
I'm going to save it for the next episode to talk about what happens when DHCP gets
ugly.
DHCP Relay enables a single DHCP server to service more than one broadcast domain
The great thing about DHP is that it's simple and reliable and assuming you've got
it set up initially properly it'll pretty much run for years and you won't even
think about it.
The downside is that when DHP does go down because you're not thinking about the as
an issue it can sometimes be kind of hard to diagnose.
The big thing to keep in mind more than anything else is that all DHC problems
manifest in the same way you're going to open up a web browser and because you
don't have a legitimate IP address or default gateway or DNS you're not going to be
able to get on the Internet.
So with that in mind let's figure out how to deal with DHCP.
All right so here I got my Windows system and I've actually shut off all the DHC
servers on my network so to prove to you that I'm really not on the Internet
it's go to Google.
Thud.
OK.
So clearly I'm not on the Internet right now so what I'm going to do is I'm going
to go to a command prompt and I want to show you what happens when you don't have a
DHCP server.
Look at the IP address though it's 169 from 254 226 to 10.
That doesn't look anything like the my network which is 192 168 15 something.
APIPA stands for automatic private IP addressing APIPA is built into all of your
DHCP clients and it's designed as a fallback if you can't find a DHCP server.
So if you get a 169 2:54 APIPA address that's telling you right off that your
client cannot connect to a DHCP server.
If you run into this issue the first thing you're going to have to assume is that
your client isn't plugged didn't right.
Somehow you have a layer one disconnect between you and your DHCP server.
So are you plug into your switch is your switch plugged into the DHCP server.
Assuming you're plugged in and everything's looking good then you're going to have
to assume there's a problem with the DHCP server itself.
And in that case you're just going to have to know the DHCP server network plus
does not test you on a bunch of different DHCP servers.
But it does expect you to appreciate things like a DHCP server Well it should exist
on your broadcast domain someplace.
Does it have all the IP information and all that set up properly and make sure it's
up and cooking.
I guarantee you there will be network plus questions that says which of these four
isn't APIPA address and you better check the right one.
169 254 that's all you've got to remember the last two values are spun up
automatically for each client.
So what will happen is that if you lose your DHCP server and you've got a bunch of
Windows systems Oh they can still share folders and printer probably still works.
Now in order to show you this I had to have a little fun on my network.
But the trick here is I went to you to see you were going to type an IP config.
Now what I want you to look at is right here.
Now all of a sudden I have what looks like a legitimate IP address but do you see
it.
And what we have here is what we call a rogue a DHCP server one of the things that
drives me crazy about users is that they don't know the network ID for their own
network.
I mean come on one of the first thing you do when you set up a network is you fire
up an IP config and at least know what your default gateway is and your subnet mask
you say OK my network at Mike Meyers house is 192 168 15 whack 24.
Now all of a sudden when we fired this up it's not 192 168 15 anymore is it.
What's happening here probably is I have two DHCP the servers one of them is the
legitimate one and one is it.
Now if you have two DHCP servers going simultaneously they will compete.
It's particularly notorious on a wireless network because it's so easy to take one
of these little wireless routers you plug it into a wall.
The moment you plug this in pretty much all of these wireless routers from the
factory will start spewing out.
Usually it's one or two 168 one addresses or one on to 168 0 addresses and that
could wreak havoc on people who are trying to connect to your other wireless
device.
So any time you see an IP address you're DHCP is picking up an IP address that is
not what you know it to be.
Oh and good luck particularly with wireless trying to find them sometimes
physically just trying to find that wireless router that's spewing out all of this
bad information can be a challenge but at least you know that that's where the
issue comes from.
Now these are the big base problems you're going to be running into on the network.
Plus in terms of DHCP issues more than anything else I need to be able to recognize
that APIPA address like that and secondarily make sure that you know what your
network idea is because then if somebody's weird comes up with a different one you
know you have got a rogue.
If you get an APIPA address, check to see if you are connected to a DHCP server
If you are connected to a DHCP server and still get an APIPA address, make sure the
DHCP server is working
If you get an IP address other than your correct network ID, you may have a rogue
DHCP server