DEV Community

Cover image for Physical and Data Link Layer

Posted on

Physical and Data Link Layer

Physical Layer

It is more complex layer.
Focus is on moving 0s and 1s from one end of link to next.

It consist of devices need to transmit bits on computer networks.
We are always sending 0s and 1s in these layers.

Twisted pair cables

Copper wire twisted together. CAT 6 cable has 8 wires.
It allows for duplex communication (Information can flow on both side of cables)
Simplex communication - Data flows only in one direction.
Duplex communication - Telephone calls
Full duplex - Devices on both end communicate with each other.
Half duplex - Only one devices is communicating at a time.

Network port and patch panels

Twisted pair network cables uses port like RJ45 which is most common plug specification.

Network ports are connected to devices, switches has many network port.
Laptop, phones probably have no network ports.

Patch panel is device containing network ports.

Data link layer

Ethernet and MAC address

Protocol used to send data to individual devices is ethernet
This layers abstract how data travels.

Ethernet first used in 1983. It was used in LAN, switch and hubs lead collision domain.

This solved problem with carrier sense multiple access with collision detection (CSMA-CD)

CSMA/CD is used to determine when the communications channels are clear and when the device is free to transmit data.
If there's no data currently being transmitted on the network segment, a node will feel free to send data.
If it turns out that two or more computers end up trying to send data at the same time, the computers detect this collision and stop sending data.
Each device involved with the collision then waits a random interval of time before trying to send data again. This random interval helps to prevent all the computers involved in the collision from colliding again the next time they try to transmit anything

MAC Address

It is global unique identifier attached to individual network interface. It is a grouping of a hexadecimal number. These are globally unique. There are 2^48 possible MAC address possible,

A MAC address is split into two sections. The first three octets of a MAC address are known as the organizationally unique identifier or OUI. These are assigned to individual hardware manufacturers by the IEEE or the Institute of Electrical and Electronics Engineers.

The last three octets of MAC address can be assigned in any way that the manufacturer would like with the condition that they only assign each possible address once to keep all MAC addresses globally unique.

Unicast, multicast and broadcast

  • Unicast

Always meant for only one receiving address.

  • Multicast

It is send to all devices on local network segment.

  • Broadcast

It is send to every single device on LAN.

Ethernet Frame - data packet at ethernet level

A data packet represents any single set of binary data being set across network link.

It is highly structured information presented in a specific order.
All sections are mandatory and have a size.

  • Preamble is of 8 bytes, 7 bytes series of 1s and 0s. Last byte is SFD, start frame delimiter.

  • Destination MAC address
    Hardware address of destination

  • Source MAC address
    Where frame originated from

  • Ether type fields
    16 bit long used to describe protocol of frames.

  • VLAN header
    It is optional, means virtual LAN.
    Used to segregate different forms of traffic.

  • Data payload
    It is actual data being transported.
    It can be from 0 to 1500 bytes long.

  • Frame check sequence
    32 byte checksum value, performed by cyclical redundancy check uses polynomial operations.

If the checksum computed by the receiving end doesn't match the checksum in the frame check sequence field, the data is thrown out. This is because some amount of data must have been lost or corrupted during transmission.

Ethernet itself only reports on data integrity. It doesn't perform data recovery.

Thanks for reading <3

Top comments (0)