1 00:00:00,000 --> 00:00:00,610 2 00:00:00,610 --> 00:00:02,950 I thought it would be useful to demonstrate 3 00:00:02,950 --> 00:00:05,260 the actual process of a switch learning 4 00:00:05,260 --> 00:00:07,390 the layer 2 addresses of the devices 5 00:00:07,390 --> 00:00:08,660 that are connected to it. 6 00:00:08,660 --> 00:00:10,690 And although the vendors vary and the commands 7 00:00:10,690 --> 00:00:13,300 may be slightly different on displaying information 8 00:00:13,300 --> 00:00:15,400 about the dynamically learned MAC addresses, 9 00:00:15,400 --> 00:00:17,350 the concept remains the same regarding 10 00:00:17,350 --> 00:00:21,010 the layer 2 switches learning, dynamically, the MAC addresses 11 00:00:21,010 --> 00:00:23,920 of those devices that are connected to the switch. 12 00:00:23,920 --> 00:00:27,430 So in our topology, we have these three PCs on these three 13 00:00:27,430 --> 00:00:28,930 ports on the switch. 14 00:00:28,930 --> 00:00:31,825 And these three PCs have these respective IP addresses 15 00:00:31,825 --> 00:00:32,860 at layer 3. 16 00:00:32,860 --> 00:00:35,260 And they have these three respective layer 2 addresses, 17 00:00:35,260 --> 00:00:36,760 or at least the last four characters 18 00:00:36,760 --> 00:00:39,220 of those MAC addresses, at layer 2. 19 00:00:39,220 --> 00:00:42,340 So when we start off, if these PCs have been absolutely quiet, 20 00:00:42,340 --> 00:00:45,850 not one single frame, we can look at the MAC address table 21 00:00:45,850 --> 00:00:48,640 and the switch, if these PCs have not sent any frames, 22 00:00:48,640 --> 00:00:51,970 should not yet know about any of their respective MAC addresses 23 00:00:51,970 --> 00:00:53,610 on any of these ports. 24 00:00:53,610 --> 00:00:55,240 However, once we generate some traffic, 25 00:00:55,240 --> 00:00:56,740 we should be able to go back and see 26 00:00:56,740 --> 00:00:58,900 this table is being populated. 27 00:00:58,900 --> 00:01:00,560 So we're going to begin on the switch. 28 00:01:00,560 --> 00:01:03,160 Now this happens to be a switch module that's 29 00:01:03,160 --> 00:01:05,630 a module inside of a router, a Cisco router. 30 00:01:05,630 --> 00:01:08,140 And so based on even the type of Cisco switch you have, 31 00:01:08,140 --> 00:01:10,420 the commands may be slightly different to show 32 00:01:10,420 --> 00:01:11,830 the MAC address table. 33 00:01:11,830 --> 00:01:13,900 So on this switch module in this router 34 00:01:13,900 --> 00:01:15,790 the command to show the MAC address table 35 00:01:15,790 --> 00:01:19,340 is show mac-address-table. 36 00:01:19,340 --> 00:01:21,210 So we'll enter that and press Enter. 37 00:01:21,210 --> 00:01:23,800 And at the moment, the switch knows about itself. 38 00:01:23,800 --> 00:01:25,630 It has a management interface. 39 00:01:25,630 --> 00:01:27,220 But it hasn't dynamically learned 40 00:01:27,220 --> 00:01:32,080 about any of the PCs that are connected to ports 1/1, 1/2, 41 00:01:32,080 --> 00:01:34,240 or 1/3 yet. 42 00:01:34,240 --> 00:01:36,040 Let's fix that right now. 43 00:01:36,040 --> 00:01:39,380 Let's bring up a console window for PC 1. 44 00:01:39,380 --> 00:01:43,630 And if we simply do a ping of PC 2 and a ping of PC 3, 45 00:01:43,630 --> 00:01:46,412 if they reply back to PC 1, that's going 46 00:01:46,412 --> 00:01:48,370 to allow the switch to learn all three devices' 47 00:01:48,370 --> 00:01:50,890 MAC addresses because each of the devices, 48 00:01:50,890 --> 00:01:53,500 when they respond and use their source layer 2 MAC address, 49 00:01:53,500 --> 00:01:55,500 the switch goes, boom, gotcha. 50 00:01:55,500 --> 00:01:57,680 And it will add that to the MAC address table. 51 00:01:57,680 --> 00:02:03,700 So here on PC 1, let's do a ping over to 10.0.0.22. 52 00:02:03,700 --> 00:02:05,504 That's the IP address of PC 2. 53 00:02:05,504 --> 00:02:06,170 That looks good. 54 00:02:06,170 --> 00:02:11,510 And let's also do a ping over to PC 3 at 10.0.0.33. 55 00:02:11,510 --> 00:02:13,250 Press Enter. 56 00:02:13,250 --> 00:02:14,660 That looks good as well. 57 00:02:14,660 --> 00:02:16,580 We'll let that complete. 58 00:02:16,580 --> 00:02:18,290 And then let's go back to the switch. 59 00:02:18,290 --> 00:02:19,490 And now we're just going to use the Up Arrow 60 00:02:19,490 --> 00:02:22,280 key to do the same command again to look at the MAC address 61 00:02:22,280 --> 00:02:23,857 table, and press Enter. 62 00:02:23,857 --> 00:02:25,940 And we can now see that the switch has dynamically 63 00:02:25,940 --> 00:02:29,450 learned three MAC addresses on three respective ports. 64 00:02:29,450 --> 00:02:33,770 PC 1, ending in 6800, being learned off port Fa1/1, 65 00:02:33,770 --> 00:02:35,570 or fast ethernet 1/1. 66 00:02:35,570 --> 00:02:39,800 PC 2's MAC address of 6801, learned off of port 1/2. 67 00:02:39,800 --> 00:02:43,890 And PC 3's MAC address ending in 6802, dynamically 68 00:02:43,890 --> 00:02:45,920 learned off switch port 1/3. 69 00:02:45,920 --> 00:02:48,410 And the beautiful thing now is that if the switch needs 70 00:02:48,410 --> 00:02:51,590 to forward frames to any of those MAC addresses, 71 00:02:51,590 --> 00:02:53,120 it knows exactly how to do it. 72 00:02:53,120 --> 00:02:55,160 And it can forward those frames directly 73 00:02:55,160 --> 00:02:57,110 based on the learning it did as opposed 74 00:02:57,110 --> 00:03:00,704 to just sending a frame to all other ports on the switch. 75 00:03:00,704 --> 00:03:02,120 In this Nugget, we've demonstrated 76 00:03:02,120 --> 00:03:04,490 how a switch can dynamically learn the layer 77 00:03:04,490 --> 00:03:06,620 2 addresses of those devices that are 78 00:03:06,620 --> 00:03:08,660 connected to the switch ports. 79 00:03:08,660 --> 00:03:10,790 I hope this has been informative for you. 80 00:03:10,790 --> 00:03:14,410 And I'd like to thank you for viewing.