Saturday 9 March 2013

1. Ethernet Basics


Wiring

As we all know, to form a network connection between two or more devices, first we must ensure the physical connectivity (OSI Layer 1) is working. For Ethernet LANs, there 2 common types of Category 5 (Cat 5 or Cat 5e) cabling, which are Straight-through cable and Cross-over cable. Straight-through cable uses the same T568A pinouts on both ends or T568B pinouts on both ends while Cross-over cable uses T568A and T568B pinouts on each ends. Please refer below figure for pinouts details. This figure is a 4-pair UTP Cabling with RJ-45 pinouts.


When should we use Cross-over?
If the same type of devices are being connected to each other directly using a UTP cable, Cross-over cable must be used. The reason is, one pair of cable shouldn't be transmitting and receiving bits on both ends. Either one end must transmit while the other end receives on the same cable, or vice versa in order to form a successful physical connection.

For instance, Switch A is connected to Switch B. Both switches are transmitting using pair at pins 3,6 and receive on pins 1,2. Therefore, pair at pins 3,6 (transmit) on switch A needs to connect to pins 1,2 (receive) on switch B.

But nowadays, ethernet switches are much more intelligent. Switches are equipped with Auto-MDIX - Auto Medium-dependent Interface Crossover) sensor. With this sensor, they can figure out when there's a wrong cable installed. Switches automatically swap the transmit/receive pins to solve the cabling problem.

Auto-negotiation

What is an auto-negotiation? Auto-negotiation is a capability of a switch to determine the speed and duplex setting either half or full on its port. By default, it is enabled on most of Cisco switches.

Speed

Switches can sense the speed of Ethernet segments by using a few methods. Cisco switches sense the speed by using the Fast Link Pulses (FLP) of the auto-negotiation process. However, if auto-negotiation is disabled on either end of the cable, the switch detects the cable anyway based on the incoming electrical signal. If the speed mismatched on both end, it will bring the interface physically down (down/down).

Duplex

Switches detect duplex setting using auto-negotiation only. But if auto-negotiation is disabled on either end, the switch without duplex configured will assume the default. By default, 10Mbps and 100Mbps interfaces use HDX (half-duplex), while 1000Mbps/1Gbps interface uses FDX (full-duplex). 

How to disable auto-negotiation? You can disable auto-negotiation by statically entering speed and duplex setting on the switch interface.

HDX: Provides communications in both directions, but only one direction at a time.
FDX: Provides communications in both directions simultaneously


CSMA/CD

Carrier Sense Multiple Access with Collision Detection - CSMA/CD functions to minimise collisions on ethernet segments. When collisions detected, CSMA/CD will define how the frame sender to recognise the collision and how or when to retransmit the frames again without causing any collision.

CSMA/CD steps:
1. A device with frame to send listens until Ethernet segment is not busy.
2. When the Ethernet is not busy, the sender begins sending the frame.
3. After the sender sent the frame, it listens to make sure no collision occurs.
4. If there's a collision, all stations that sent a frame send a jamming signal to ensure that all stations recognise the collision.
5. After the jamming signal is complete, each sender of the original collided frames randomises timer and wait for that long to retransmit its frame.
6. After all timers expire, the original sender will begin with step 1.

Collision domain: is a set of devices that can send frames that collide with frames sent by other devices in the same set of devices.

An example of a collision domain is a network hub, because hubs:
1. Operates solely at layer 1.
2. Repeats all signals to improve cable distance.
3. Forward signals received on a port out to all other ports. Therefore, causing collisions. 


Figure above demonstrates collision domain(s) of a hub and a switch.

However, unlike hubs, switches does not operate in a single collision domains. When switches receives multiple frames on different switch ports, they store the frames in memory buffer to prevent collision. Switches generally operates at layer 2 of OSI layer.

Ethernet Frames

Actually, there's nothing interesting about ethernet frames. But, here they are?

Ethernet Addresses 

MAC Addresses are 6 bytes long, with hexadecimal format. There are 3 types of Ethernet Addresses:
  • Unicast Address: Represents a single LAN interface address.
  • Broadcast Address: Represents all devices that resides in the same LAN.
  • Multicast Address: Represent some subset of all devices inside the same LAN.
Unicast Address
When an Ethernet NIC needs to send a frame, it puts its own globally unique Unicast Address in the Source Address field of the header. If it wants to send a frame to a single device on the LAN, the sender will also put the receiver's unicast MAC Address in the Ethernet header's Destination Address field. 

Broadcast Address
If the sender wants to send the frame to every device on the LAN, it sends the frame to the FFFF.FFFF.FFFF Broadcast Address as the destination.

Multicast Address
Multicast Address is used to communicate with some of devices in a LAN, not all like broadcast. For instance, if 10 out of 100 devices in a LAN want to watch the same video streaming application using an IP multicast-based application, the application can send a single multicast frame to a particular multicast address. The 10 interested devices will prepare themselves by listening for frames sent to that particular multicast address.

00-40-96-01-A0-45

Above is the MAC address format, and example of Cisco device' MAC address. The first 3 bytes of a MAC address is known as Organizationally Unique Identifier - OUI. OUI is assigned to each vendor, therefore making each vendor has its own or its own sets of unique OUI.

LAN Switch Forwarding Behaviour

Switches forward frames when necessary, and do not forward when there is no need to do so, thus reducing resources. To accomplish this, switches perform 3 actions:


  1. Learn MAC addresses by examining the source MAC address of each received frame.
  2. Decide when to forward a frame.
  3. Create a loop-free environment with other switches using Spanning Tree Protocol.


Switch Internal Processing

Switches internal processing algorithms vary among vendors and models. 
  • Store-and-forward : Switch fully receives all bits in the frame (store) before forwarding the frame (forward). This allows the switch to check the FCS before forwarding, ensuring the frame is error free.
  • Cut-through : First bit can be sent out before the final bits in the incoming frames are received. This does not allow switch to discard frames that fail the FCS, but reduce latency.
  • Fragment-free : Same as cut-through, but the switch waits for 64 bytes to be received before forwarding the first bytes of the outgoing frame.
To be continued..

-Soulpower

2 comments: