I've been asked a number of times to explain whether devices on the same subnet will separate subnets.
In this example I've got two PCs.
The one on the left will be configured with an IP address of tendered wondered wondered one and the
one on the right will be configured with an IP address of tendered one or two or two.
So here's the question Can these two hosts ping each other.
Are they in the same subnet.
It's a tricky question because you can't actually answer this question without knowing what the subnet
mask is.
You can't determine whether these two hosts on the same subnet.
If you don't know what the subnet mask is on this example rather than using a Windows PC I'm using Cisco
routers as my PCs in my G and his three typology.
Don't worry if you're not familiar with the Cisco Seelye I cover that in more detail in my CCN a course
but in this example what I'll Firstly do is name the route on the left right of one and the router on
the right name is routed to at the moment no IP addresses have been configured on the gigabit Zerah
interfaces of these routers so show IP interface brief.
Notice no IP address is configured on gigabit 00 on either router show IP interface gigabit 00 shows
us that to the interfaces down Internet Protocol processing is disabled.
In other words IP doesn't work.
So what we need to do is go on to the gigabit 00 interface and no shut it that essentially enables the
interface.
And then I need to configure an IP address on the interface.
So notice if I type IP address 10 1 1 1 and Precentor I'm told that that's an incomplete command.
The same is true on the.
All enabled interface.
And if I try and enable an IP address of 10 1 to 2 I'm told that that's an incomplete command.
We need to specify the subnet mask
so that on the side as well.
And notice now we're not top show IP interface gigabit 0 0 we are told that the IP address configured
on this interface is tendered one tutor to slash 24 on the side show IP interface gigabit 0 0.
We are told that the IP address is 10 to 1 and 1 1.
This is using Sajda notation 24 equates to 24 binary ones which is the equivalent of doing it this way
in dotted decimal notation.
So you say tomato or say tomato you say rodder what router with a router.
It's the same thing just a different way of phrasing it so 24 means 24 binary ones.
205 in decimal equates to 8 to binary ones.
So this is eight to binary ones plus eight to binary ones plus eight to binary ones which equates to
24 binary ones.
So this is the same as this what this is telling us is that the first 24 bits of the IP address is the
network portion.
In other words to 5:5 first octet is network 4 5 second octet is network 2 4 5 third octet is network.
This is the network portion of the address.
This is the host portion based on the binary zeroes in the subnet mosque on this site.
Show run interface gigabit 00.
This is the network portion.
This is the host portion.
So when a device wants to ping another device it needs to determine whether the other devices in the
same subnet as itself the way it does that is it looks at the subnet mask and determines if the network
portion of the address is the same or if it's different if it's the same then the device will send out
an op.
Now if Ethan it is used the device will send out an up to work out which Mac addresses associated with
the IP address.
If it's on a different subnet the device will typically forward the traffic to its default gateway.
Now in this example notice when we try to ping from a router one to rodded to the ping doesn't work
because these two devices on different subnets can rotate to acting as PC to ping right of one acting
as PC one.
No it can't and that's because they in different subnets for use the command de-bug IP packets on the
site and do the ping again.
We are told that the packets are unreadable.
The broader doesn't know what to do with the packets.
In other words it doesn't know where to forward the packets.
However if we change the subnet mask it's all configured the same IP address but use a slash 16 mosque.
So show IP interface gigabit 00.
Notice that slushed 16 and I'll just do that again.
So show IP interface gigabit 00 slushes 16 mosque show run interface gigabit 00.
Notice it's 2 4 5 2 4 5 0.0 and all do the same on the side IP address 10 1 1 1 2 4 5 2 4 5 0 0 so show
IP interface gigabit 0 0 notice say slash 16 mosque.
So again show IP interface but 00 IP address on the site is 10 1 1 1 slide 16 show run interface kickabout
0 0 IP address looks like this.
So can these two devices now ping each other
you've got a lot of debugs they so let's turn off the deep bugging and try again.
Notice the ping succeeds on the side ping 10 1 to 2 ping succeeds.
Now debugging on router just allows you to see what's going on in the background.
So it allows you to troubleshoot what's happening on your network.
So notice by just changing the subnet mask I was able to get these devices to ping each other because
I've now told them that they are in the same subnet
when traffic is sent and we using the debug will be able to see what's going on.
So notice here we had one failure one ping failed indicated by the dot and then four exclamation marks
told us that the pings succeeded.
We had an encapsulation failure Firstly because the device had to send out an op to determine the remote
PCs Mac address.
And then once that was done a full packet was sent so ofter up resolution the packets were sent out
onto the gigabit 00 interface to the destination 10 1 to 2
because these two devices are now in the same subnet.
They can ping each other.
They know that they in the same subnet because $10 one the network portion is the same on both sides.
I found it is very useful if it was a benefit to you.
Please like it and please subscribe to my YouTube channel.
I wish you all the very best.