1 00:00:00,580 --> 00:00:02,800 Now, what about subnet masks? 2 00:00:02,980 --> 00:00:06,410 I've mentioned subnet masks a few times. 3 00:00:06,430 --> 00:00:08,140 What is a subnet mask? 4 00:00:08,170 --> 00:00:09,430 What does it do? 5 00:00:09,700 --> 00:00:18,070 Well, a subnet mask is used to determine which part of an IP address is the network portion and which 6 00:00:18,070 --> 00:00:20,590 part of the address is the host portion. 7 00:00:20,950 --> 00:00:28,390 This allows a PC, for example, to determine whether a device that it wants to communicate with is 8 00:00:28,390 --> 00:00:31,600 a remote device or a local device. 9 00:00:32,110 --> 00:00:33,550 So here's an example. 10 00:00:33,550 --> 00:00:42,070 We have a PC with IP address, 10.1, 1.1 and another PC with an IP address of 10.1 to 2.1. 11 00:00:42,520 --> 00:00:49,930 When the PC on the left wants to forward traffic to the PC on the right with IP address 10.1 to 2.1, 12 00:00:49,960 --> 00:00:56,920 does the PC forward the traffic onto the local segment or does it forward it to its default gateway? 13 00:00:57,520 --> 00:01:04,989 If these two devices are in the same subnet, they can communicate directly without the use of a default 14 00:01:04,989 --> 00:01:05,710 gateway. 15 00:01:06,130 --> 00:01:12,910 But if they're on different subnets, the PCs will forward their traffic to their default gateways, 16 00:01:12,910 --> 00:01:18,970 which will do the inter VLAN routing if they're on the local LAN or local area network as an example 17 00:01:18,970 --> 00:01:23,920 or route the traffic if the traffic is forwarded to a traditional router. 18 00:01:24,160 --> 00:01:31,750 So a layer three switch may do the routing between two VLANs or a router may route the traffic between 19 00:01:31,750 --> 00:01:35,270 these two devices if they are in different subnets. 20 00:01:35,290 --> 00:01:42,790 But how would you determine if these two devices are on the same subnet or if they're on different subnets? 21 00:01:43,090 --> 00:01:47,410 Now, I'm going to explain this in more detail in the next few minutes. 22 00:01:47,740 --> 00:01:58,810 But as an example, 10.1, .1.1 and 10.1 or 2.1 are in the same subnet if they're using a slash 16 mask. 23 00:01:59,080 --> 00:02:06,880 However, if they're using a slash 24 mask, that means that the devices are on different subnets. 24 00:02:07,180 --> 00:02:09,759 So let me explain that in more detail. 25 00:02:09,789 --> 00:02:17,410 A network mask allows a device to determine once again which portion of the address is the host portion 26 00:02:17,620 --> 00:02:21,040 and which portion of the address is the network portion. 27 00:02:21,370 --> 00:02:29,110 This allows a local PC as an example to determine whether the device it wants to communicate with is 28 00:02:29,110 --> 00:02:34,930 on a remote network and is thus reachable via the default gateway. 29 00:02:35,140 --> 00:02:43,240 Or if the device is on the local subnet and therefore does not require the use of a default gateway. 30 00:02:43,420 --> 00:02:49,780 So if PCA and PCB are in the same subnet, no default gateway is required. 31 00:02:49,930 --> 00:02:57,310 But if they're on different subnets, then a default gateway would typically be required to do the routing 32 00:02:57,310 --> 00:02:59,260 between the two PCs. 33 00:02:59,440 --> 00:03:02,590 So that's essentially what a network mask does. 34 00:03:03,070 --> 00:03:11,530 Now, as I've explained, plus A, B and C, networks have default masks, which are also known as natural 35 00:03:11,530 --> 00:03:14,680 masks in a Class A address. 36 00:03:14,830 --> 00:03:19,470 The first octet is the network in a Class B address. 37 00:03:19,480 --> 00:03:26,650 The first two octets are network and with a class C address, the first three octets are the network 38 00:03:26,650 --> 00:03:27,400 portion. 39 00:03:27,700 --> 00:03:35,410 I'll explain more complicated subnet masks in the subnet videos, but let's first start with some simple 40 00:03:35,410 --> 00:03:36,370 examples. 41 00:03:37,030 --> 00:03:45,410 In this example, we have a Class A network that hasn't been submitted in a Class A network. 42 00:03:45,430 --> 00:03:49,600 The default mask is 255.0.0.0. 43 00:03:49,840 --> 00:03:58,930 So if we look at a address such as 10.1, 1.1 and convert that into binary, it's going to look as follows. 44 00:03:59,640 --> 00:04:06,210 Now look at the following mosque 255 in binary equates to eight binary ones. 45 00:04:06,390 --> 00:04:10,980 Zero in decimal equates to eight binary zeros. 46 00:04:11,100 --> 00:04:20,010 So converting the mosque into binary shows us that the network portion consists of contiguous ones or 47 00:04:20,010 --> 00:04:23,640 continuous ones, starting from the left hand side. 48 00:04:24,150 --> 00:04:33,600 A one in binary in the network mosque indicates network a zero in binary in the network mosque indicates 49 00:04:33,600 --> 00:04:34,320 host. 50 00:04:34,440 --> 00:04:41,100 So in this example, this portion of the address is a network and this portion of the address is host. 51 00:04:41,130 --> 00:04:49,200 Hence this device with IP address 10.1 1.1 is on network ten .0.0.0. 52 00:04:49,230 --> 00:04:52,950 This is the network portion and this is the host portion. 53 00:04:53,100 --> 00:04:58,920 This device with IP address ten .1.1.1 is on network ten. 54 00:04:59,250 --> 00:05:06,780 So when working out the network and host portions of an address, follow these two simple rules. 55 00:05:06,780 --> 00:05:15,690 Any address bits that have a corresponding mosque but set to one in binary represents the network. 56 00:05:16,020 --> 00:05:23,580 Any address bits that have a corresponding mosque but set to zero represents the host. 57 00:05:23,580 --> 00:05:28,890 So one in binary means network zero in binary means host. 58 00:05:29,340 --> 00:05:35,790 So in this example, ten is the network because there are ones in the mosque in binary. 59 00:05:35,790 --> 00:05:39,210 So the network ID is set to ten notice. 60 00:05:39,210 --> 00:05:42,180 These octets are populated by binary zeros. 61 00:05:42,180 --> 00:05:43,650 That means host. 62 00:05:43,800 --> 00:05:48,180 So the host ID is equal to 1.1.1. 63 00:05:48,180 --> 00:05:50,700 So in summary, the network is ten. 64 00:05:50,730 --> 00:05:54,630 The host portion of the address is 1.1.1. 65 00:05:54,960 --> 00:05:56,280 He has another example. 66 00:05:56,280 --> 00:06:05,040 Remember any address bits that have a corresponding mosque but set to one in binary represents network. 67 00:06:05,040 --> 00:06:13,020 Any address bits that have a corresponding mosque but set to zero in binary represent node ID. 68 00:06:13,140 --> 00:06:17,670 So here we've got a class A address 1.1.1.1. 69 00:06:17,670 --> 00:06:19,620 But note the difference. 70 00:06:19,620 --> 00:06:25,260 The network mosque in this case is 255225500. 71 00:06:25,440 --> 00:06:31,620 So converting 1.1.1.1 to binary gives us the following. 72 00:06:32,070 --> 00:06:39,960 Taking the network mosque and converting that to binary gives us the following notice 255 equates to 73 00:06:39,960 --> 00:06:45,750 eight binary ones, which therefore means that this portion of the address is a network. 74 00:06:45,750 --> 00:06:49,020 So the network ID is 1.1. 75 00:06:49,020 --> 00:06:55,230 And looking at the remaining part of the address, which is populated with binary zeros in the network 76 00:06:55,230 --> 00:07:00,420 mosque, means that 1.1 is the host portion of the address. 77 00:07:00,660 --> 00:07:10,350 In other words, the network is 1.1.0.0 with a host portion of 1.1 on that network. 78 00:07:10,620 --> 00:07:14,580 The mosque is 255.255.020. 79 00:07:14,790 --> 00:07:22,080 In this example, it's easy to see the network portion of the address because we have 255.255 in the 80 00:07:22,080 --> 00:07:23,340 network mosque. 81 00:07:23,490 --> 00:07:29,490 Just be aware that things can get a lot more complicated than what we're seeing in these examples. 82 00:07:29,490 --> 00:07:33,060 You'll see that when we get to the subnet videos. 83 00:07:33,120 --> 00:07:39,210 These two examples are simple because it's easy to recognize which portion is a network and which portion 84 00:07:39,210 --> 00:07:41,430 is host in the subnet videos. 85 00:07:41,430 --> 00:07:44,850 I'm going to show you much more complicated examples. 86 00:07:44,970 --> 00:07:51,630 And in those examples it's more difficult to determine which portion is network and which portion is 87 00:07:51,630 --> 00:07:52,260 host. 88 00:07:52,530 --> 00:07:59,250 So in summary, how does a device know whether another device is local or remote to itself? 89 00:08:00,030 --> 00:08:06,360 So the first thing it will do is check the network portion of its local address and then compare that 90 00:08:06,360 --> 00:08:08,640 to the address of the other host. 91 00:08:08,670 --> 00:08:15,120 If the network portion of the address is the same, the local device knows that the other device is 92 00:08:15,120 --> 00:08:16,470 local to itself. 93 00:08:16,620 --> 00:08:22,890 If the network portion is not the same, the local device knows that the other device is remote.