Friday, April 7, 2017

Ethernet frame and Ethernet Packet

MAC is 6pairs of hex symbols - each hex symbol is 4bits:
4x2:4x2:4x2:4x2:4x2:4x2
8:8:8:8:8:8
8x6=48bits 48bits are 6bytes

Ethernet frame is data-link layer and consists of (sizes are in bytes):
6                   -> destination MAC
6                   -> source MAC
4(Optional)  -> 802.1Q tag
2                   -> type (IPv4 or IPv6)
46-1500        -> data
4                   -> FCS
Ethernet frame overall size:
1) 802.3 frame:
header (6+6+2)+data(46-1500)+trailer(4) -> 64-1518
2) 802.1Q frame:
header (6+6+4+2)+data(46-1500)+trailer(4) -> 68-1522

Ethernet packet is physical layer and consists of (sizes are in bytes ):
7                           -> preamble (7 same bytes each equals 10101010)
1                           -> SFD (Start Frame Delimiter - 10101011)
64|68-1518|1522  -> either 802.3 or 802.1Q Ethernet frame
Ethernet packet overall size:
1) with 802.3 frame:
(7+1)+(64-1518 ) -> 72-1526
2) with 802.1Q frame:
(7+1)+(68-1522)  -> 76-1530

Also 12byte IPG (Inter Packet Gap) is used as minimal pause between Ethernet packets.

So Ethernet payload is 46-1500 bytes and Ethernet overhead is:
1) for Ethernet frame - 6+6+2+4=18 bytes or 22 bytes if 802.1Q is used
2) for Ethernet packet - Ethernet frame overhead (18 or 22) + 8 -> 26 - 30
3) if we'll also take IPG into consideration -> 12 + (26|30) -> 38 - 42


Wednesday, April 5, 2017

Twisted pair cable pinouts (Ethernet)

Cable pairs and RJ-45 pinouts and TIA/EIA colour schemes:

Speaking frankly RJ45 is not the correct name of the connector, correct name of the jack (Ethernet connector) is 8P8C and RJ45 is telephony standard name. 8P8C means 8pins 8connected. In the RJ45 standard central pair was used for for a single telephony pair.

1 - Blue pair - pins 4-5 (middle pins - were used for Voice in RJ45 telephony standard)
2 - Orange pair - pins 1-2 (TIA/EIA 568-B) or pins 3-6 (TIA/EIA 568-A)
3 - Green pair -  pins 3-6 (TIA/EIA 568-B) or pins 1-2 (TIA/EIA 568-A)
4 - Brown pair - pins 7-8

        __3or2__
2or3  |               |
|   |   |    1p     |      4p
|   |   |    |  |   |    |   |
1  2  3  4  5  6  7  8 

Blue pair is the only pair  which pins start with solid colour (blue), all other pairs pinning start with mixed colour (white-mix).
Blue and Brown pairs are always on the same place, so wee need only to remember pins for Orange and Green pair. We can use mnemonic trick - if pins 3 and 6 (close to Blue pair) are Orange (2nd pair) then it's TIA/EIA 568-A, because A is the first letter in the alphabet and pairs go in the proper order - 1st Blue and then 2nd Orange. If pins 3 and 6 (close to Blue pair) are Green (3d pair) then it's TIA/EIA 568-B, because pairs are not in the proper order - 1st Blue and then 3d Green.

DTE / DCE

DTE and DCE are descriptions of the role of an Ethernet interface of the device (so the same device can have both DTE and DCE interfaces):
1- DTE (Data Terminal Equipment) - typically downstream device (user end).
2- DCE (Data Communication Equipment) - typically upstream device (network end).

DTE devices: PC, server, router WAN ports
DCE devices: hub, switch, router LAN ports

DTE devices mostly use pins 1&2 to transmit and 2&3 to receive.
DCE devices mostly use pins 2&3 to transmit and 1&2 to receive.