Today we’re going to talk about Layers 2 and 3 of the OSI reference model.
First layer 2, the Data Link Layer.
Strait from Wikipedia:
Logical Link Control Sublayer
The uppermost sublayer is Logical Link Control (LLC). This sublayer multiplexes protocols running atop the data link layer, and optionally provides flow control, acknowledgment, and error recovery. The LLC provides addressing and control of the data link. It specifies which mechanisms are to be used for addressing stations over the transmission medium and for controlling the data exchanged between the originator and recipient machines.
Media Access Control Sublayer
The sublayer below it is Media Access Control (MAC). Sometimes this refers to the sublayer that determines who is allowed to access the media at any one time (usually CSMA/CD). Other times it refers to a frame structure with MAC addresses inside. There are generally two forms of media access control: distributed and centralized. Both of these may be compared to communication between people:
- In a network made up of people speaking, i.e. a conversation, we look for clues from our fellow talkers to see if any of them appear to be about to speak. If two people speak at the same time, they will back off and begin a long and elaborate game of saying “no, you first”.
The Media Access Control sublayer also determines where one frame of data ends and the next one starts. In a snail-mail network, each letter is one frame of data, and one can tell where it begins and ends because it is inside an envelope. One might also specify that a letter will begin with a phrase like “Dear Sir”, and ends with a phrase like “Yours faithfully”.
Direct communication between a router and a PC, or a PC and another PC, uses MAC addresses for communication. Also used is CSMA/CD, or Carrier Sense Multiple Access/Collision Detection. When a packet is about to be sent out on a network the wire is checked for a signal to see if anybody else is transmitting data over the wire. Kind of like the way you look both ways before proceeding past a stop sign on a street.
If another transmission takes place at the same time, the voltage on the line will spike and be detected by all those on the wire. A 32 bit long jam signal is then sent out, and all network devices start the Backoff Algorithm. This basically makes every computer shut up for a random period of time. The first one with the lowest random waiting time interval will then attempt to send data after their waiting period is up. If a client experiences more than 15 failed attempts to transmit data due to collisions, it will proceed to let the upper OSI layers deal with the problem.
These days, almost nobody uses Hubs, and instead use switches and routers. Switches dynamically create dedicated virtual pipes between computers on a network. This way they can send and receive data between each other without worry of a collision occurring. The ability to both send and receive data at the same time is called Full Duplex communication. Half Duplex is where you can send and receive, but only one at a time.
There’s also the ARP request. Basically, if a computer is trying to send data to another computer on a local area network (LAN), it knows what the IP address is, but not the MAC address, it will send out a broadcast ARP request asking for the MAC of the target IP address. The target host will see it’s own IP address with a ? in the target MAC address field, and reply to the source MAC to say, “Hey, my MAC is xx:xx:xx:xx:xx:xx” The source host will then proceed to send data using the targets MAC address. Other hosts on the network, when they hear packets destined for a MAC address other than a broadcast address or their own MAC address, will discard the packet.
Layer 3 – The Network Layer
The purpose of the network layer is mostly to handle end to end transmission of a packet over the Internet…. Here. Think about these terms real quick:
City and Zip = Network IP Address
Street = Host IP
Name = MAC Address
This isn’t absolutely accurate, but you get the idea (I hope). If you can imagine what the Postal Service basicly does, then you can handle the above.
An IP address is made up of 32-bits (one’s and zero’s). This string of numbers is represented to us humans in decimal as 4 seperate octats. An example of a common local IP address is 192.168.1.1 — This address is actually two addresses. Part of it is the Network IP, and the other part is the Host IP. This is determined by the Subnet Mask being used. The default subnet mask for 192.168.1.1 is 255.255.255.0, or “24 bit”. It’s 24 bit because 255.255.255.0 in binary looks like 11111111.11111111.11111111.00000000.
Don’t hurt yourself thinking about this too much right now. Just know that 192.168.1.0 is the Network IP to us, and the .1 at the end of it is the part of the address that pertains to the target computer (host).
The three most common IP address ranges seen are:
- Class A – First Octet of the IP address ranges between 1 – 127 with a default 8-bit (255.0.0.0) subnet mask.
- Class B – 128 – 191 with a default 16-bit (255.255.0.0) subnet mask.
- Class C – 192 – 223 with a default 24-bit (255.255.255.0) subnet mask.
IP Fragmentation is something that occurs when packets of data must traverse a network whose Maximum Transmission Unit is smaller than the size of the packet. Data that is fragmented will stay fragmented into smaller chunks until they all arrive at the destination for reassembly.
That’s all for now.