< All Cisco CCNA Notes

grieger | Cisco CCNA | Module 3 - Layer 2 Data Link

By: grieger | Related Course: Cisco CCNA | Published: April 3, 2018 | Modified: April 6, 2018
Join Cybrary

NotepadLayer 2 Broadcast/Collision Domains

Note: A data link is the complete link between 2 devices through the switch. The switch itself is transparent and is one data link. (Transparent Bridging) a broadcast domain is the area a broadcast is sent out to if sent by one device. All switches by default are on broadcast domain. routers break up broadcast domains and will drop a them. A hub is also a broadcast domain. Collision domains are areas of the network that if 2 devices transmit at the same time and are running a half duplex ethernet, the two frames can collide. Each port on a router and a switch are its own collision domain as is a hub. Collisions can only happen when running half duplex domain ethernet. Note: Ethernet is a layer 2 protocol that runs at 10 mps half duplex with Carrier Sense Multiple Access with Collision Detection (CSMACD) Half duplex is capable of bi-directional data but only one direction at a time. Full duplex is bu-directional simultaneously and simplex is only uni-directional. CSMACD, which is built in to the half duplex, sits and listens for communication coming in both directions. when it hears this it sends out a jamming signal to all the devices to stop transmitting for a determined amount of time, each being different lengths of time. Newer switches run full duplex so you don’t need CSMACD. If a hub is connected to a switch port, hubs are half duplex by design, you will have a bunch of collisions to devices on the hub. 


NotepadLayer 2 Data Link

The data link layer (2) controls communications on the immediate link between two devices.  The data in layer one is simply just electrical signal or changes in voltage. The data at layer two is in a test structure call PDU (protocol data unit). At layer two the PDU is called a frame. A frame needs a source and destination address. This is called the Media Access Control address (MAC). A MAC is made up of 48 bits in length and written in hex numbers. Hex numbers range from 1-9 and A-F. Example 0024.ABCD.1234, each character is 4 bits.

The first 24 bits is the OUI field (Organizational Unique Identifier). These are designated by a governing body and can’t be changed and are vendor specific. (Dell, Cisco, Arris, etc.) The last 24 bits the vendor can do whatever they want. 

The 7th bit is called the UL bit (Universal Local bit) Of the bit is off (0) it means it is universally unique. If it is on it means it has been assigned locally. 0224.ABCD.1234


NotepadLayer 2 MAC Addresses

PDU is the way the data is structured at layer 2. A frame contains in addition to other things 1)Destination MAC 2)Source MAC 3)Actual Data 4) FCS & CRC (Frame Check Sequence & Cyclic Redundancy Check) The FCS actually houses the CRC. The CRC does a calculation on the whole frame and stores it in the the FCS. If the receiving end FCS comes up with the same number the frame is accepted. If it is different it is corrupted and is deleted.

In the operation of a switch it has what is call the MAC Address Table (MAT) which stores the device or PC MAC address for the port it is connected to. A switch learns or populates its MAT by looking at the source MAC address in the frame being sent. Switches do their forwarding looking at the destination MAC address in the frame. If the destination MAC is not in the MAT it floods all the switch ports with the exception of the source port with the destination MAC. The devices that do not match the destination MAC to their on MAC will drop the frame. Only the one that matches will accept it. As soon as the device replies back the switch will add the MAC to its assigned port in the MAT. The switch will not flood again for that MAC address because it learned which port it is on.

There is a difference between flooding and broadcasting a switch. A broadcast frame has all f’s (actually all 1’s) in the destination frame. A flooding frame send the destination MAC to all ports exception the source port. This is called uni-cast or 1 to 1 transmission as opposed to broadcast which is 1 to every other port. A broadcast MAC will never exist in a MAT because it only holds uni-cast addresses.


NotepadLayer 2 virtual Local Area (LAN)

Virtual switches are virtual switches inside the main physical switch. Benefits are 1)saving money and 2) Vlans can transverse several multiple switches. Vlan 1 and 1002 through 1005 are already on a switch by default and cannot be deleted. By default all  on a switch belong to Vlan 1. The number of Vlans you can have on a switch, depending on the type of switch and platform, range from 1 to 4094. Note: Vlan 1 through 1005 are called normal range Vlans. Vlan 1006 through 4094 are considered extended range Vlans.

Vlan Configuration: On a Vlan there are 2 ways to configure the switch. 1) the old way and 2) the new way. On the old way you enter (Switch# Vlan Database) + enter and the switch is changed to (Switch (vlan)# Vlan). If for instance you want the Vlan to be 50, you can add 50 also add the name (test). Example (Switch (vlan)# Vlan name test) + enter and it will become Vlan 50. You can then exit (Switch (Vlan)# Exit) + enter, then you can check your configuration (Switch# show Vlan brief). The new way you need to be in the configuration mode for the switch (Switch(config)#). From the config to configure Vlan 100 you would enter (switch(config)# Vlan 100) + enter (Switch(config-Vlan)#) and now you are configuring the switch for the Vlan database. You can then name it (Switch(config)# do show Vlan brief)


NotepadLayer 2 VLAN Configuration

(Switch#show vlan) + enter to show VLAN database.

(Switch#show vlan brief) + enter to show VLAN brief summary

To create VLAN 100 with the old method (Switch#vlan ?) + enter. By entering the ? it will tell you to type database (Switch#vlan database) + enter = (Switch(vlan)#). At this point to create VLAN 100 type (vlan ?) and it will prompt you for the number <1-1005>. (Switch(vlan)#vlan 100 ?) + enter. At his point you can add a name but it is not required. Example: (name TEST) + enter = (Switch(vlan)# 100 name TEST) + enter then exit. To see the created configuration use the (Switch#show vlan brief) + enter.

To create a VLAN under the new method = (Switch#conf t) + enter. to add VLAN 200 + (Switch(config)#vlan 200) + enter = (Switch(config-vlan)#). You can then add the name (name Cisco) = (Switch(config-vlan)#name Cisco) + enter then exit. this will take you back one mode to check your new configuration (Switch(config)#do show vlan brief) then exit.

Note: In the new method you have to add (do) before show vlan briefs. 

(Switch#show flash) to show the flash directory. The vlan.dat file in the flash directory is where the VLAN 100 and 200 configs are stored. To delete VLAN 100 and 200 (Switch#conf t) + (Switch(config)#) then add (no vlan 100). Do the same to delete VLAN 200. 

Note: In almost all cases by putting the word (no) in front of a specified command that is created, it will delete it. Also not that the (↑) arrow key scrolls backward.


NotepadLayer 2-MAC Address Table LAB

On Cisco devices Fa (Fa0/0) means fastEthernet. On the command line interface (CLI) of the switch, if you type  show MAC address-table (Switch# show MAC address-table) and it will show the learned MAC addresses on the switch. The type (dynamic) just means the MAC was automatically learned. To verify the MAC is correct, go to the devices CLI  connected to the switch port and type show interface fastEthernet (rl># show interfaces fastEthernet). Note: (bia) stand for burnt in address for the MAC. It can be the same as the MAC or can be different in some cases.


< All Cisco CCNA Notes
Join Cybrary

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel