TCP/IP Protocol Suite

In this tutorial we will be implementing the TCP/IP protocol suite using verilog/VHDL to be implemented on an actual FPGA board, we will discuss The various terms associated with the protocol including CSMA/CD, Error detection and checking techniques, CRC etc. This tutorial is long and complex so I would also include part of my youtube videos for demonstration purposes.Full verilog code and logism circuits will be provided all through the course. The tutorial is intended for people with knowledge of Logism and Verilog or VHDL coding with interest in serial communication protocols.

1.0 What is a Protocol ?
A protocol is a set of rules that govern how systems communicate. For networking they govern how data is transferred from one system to another.

Protocol Stacks
It is possible to write a single protocol that takes data from one computer application and sends it to an application on another computer.- A Single stack Protocol The problem with this approach is that it very inflexible, as any changes require changing the entire application and protocol software. The approach used in networking is to create layered protocol stacks. Each level of the stack performs a particular function and communicates with the levels above and below it.

What is a Protocol Suite ?
A protocol suite is a collection of protocols that are designed to work together. The TCP/IP protocol suite is a collection of protocols that are used on the Internet. It is commonly known as TCP/IP because the foundational protocols in the suite are the Transmission Control Protocol (TCP) and the Internet Protocol (IP) and specifies how data should be packetized, addressed, transmitted, routed and received. This functionality is organized into four abstraction layers, which classify all related protocols according to the scope of networking involved. From lowest to highest, the layers are the

→ link layer the Link Layer, provides mechanisms for indicating which device the communications are to and from on the circuit, which device is allowed to transmit next, controlling the flow of information to deal with limited capacities, and detecting bit errors.

→ the internet layer, provides internetworking between independent networks;

→ the transport layer, its main role of the transport layer is to provide the communication services directly to the application processes running on different hosts. Two major protocols at this layer are the TCP and UDP (User Datagram Protocol).

→ the application layer, provides process-to-process data exchange for application. It is the closest layer to the end user which means that the application layer and end user can interact directly with the software application. The IEEE specifies Ethernet addressing in standard 802.2, as part of the Media Access Control (MAC) sublayer, so these addresses are often called MAC addresses .

1.2 Types of Ethernet addresses
The MAC address comprises of a 48-bit number. Within the number the first 24 bits identify the manufacturer and it is known as the manufacturer ID or Organizational Unique Identifier (OUI) and this is assigned by the registration authority. The second half of the address is assigned by the manufacturer and it is known as the extension of board ID. There are three types of MAC address; unicast, multicast, and broadcast.

Unicast MAC address → A unicast MAC address is the unique address uses for sending a packet from a single transmitting device to a single destination device.

Multicast MAC address → represents a group of devices in a LAN. A frame sent to a multicast address will be forwarded to a group of devices on the LAN. Multicast frames have a value of 1 in the least-significant bit of the first octet of the destination address. This helps a network switch to distinguish between unicast and multicast addresses. One example of an Ethernet multicast address would be 01:00:0C:CC:CC:CC, which is the address used by CDP (Cisco Discovery Protocol). The online games also use multicast addresses, where many players connected remotely but playing the same game. Another use of the multicast address is in distance learning through video conferencing, where many students connected to the same class.

Broadcast MAC address → Frames sent to a broadcast address will be delivered to all devices on the LAN. The broadcast address has the value of FFFF.FFFF.FFFF (all binary ones). The switch will flood broadcast frames out all ports except the port that it was received on.

1.3 The Ethernet Frames.
The Ethernet frame is defined in the Data link layer. A typical ethernet frame is given above, The basic frame consists of seven elements split between three main areas; an Ethernet header (Preamble, SFD, Destination, Source, and Type), Encapsulated data (Data and Pad), and an Ethernet trailer (FCS).

  • Preamble → Ethernet frame starts with (7-8)Bytes Preamble,The 64-bit preamble allows the receiver to synchronize with the signal; it is a sequence of alternating 0s and 1s which indicates starting of the frame and allow sender and receiver to establish bit synchronization. Initially, PRE (Preamble) was introduced to allow for the loss of a few bits due to signal delays. But today’s high-speed Ethernet don’t need Preamble to protect the frame bits. PRE (Preamble) indicates the receiver that frame is coming and allow the receiver to lock onto the data stream before the actual frame begins.
  • Start of frame delimiter (SFD) → This is a 1-Byte field which is always set to 10101011. SFD indicates that upcoming bits are starting of the frame, which is the destination address. Sometimes SFD is considered the part of the Preamble, this is the reason Preamble is described as 8 Bytes in many places. The SFD warns station or stations that this is the last chance for synchronization. The SFD (Start Frame Delimiter) field is 1 byte long. It contains a string of 1 byte. This byte also stores the same pattern, except the last bit. In the last bit, it stores 1 instead of the 0. The following image shows both fields with their related bytes respectively. The SFD byte indicates the receiving device that the next byte is the destination MAC address of the Ethernet frame.
  • Destination MAC address → This field is 6 bytes long. It contains the MAC address of the destination device. MAC address is 6 bytes or 48 bits (1 byte = 8 bits, 6x8 = 48bits) long. For convenience, usually, it is written as 12-digit hexadecimal numbers (such as 0000.0A12.1234). The destination MAC address allows the receiving device to determine whether an incoming frame is intended for it or not. If a frame is not intended for the receiving device, the receiving device discards that frame. This field contains the address of station for which the data is intended. The left most bit indicates whether the destination is an individual address or a group address( types of MAC address discussed above). An individual address is denoted by a zero, while a one indicates a group address.
  • Source MAC address → This field is also 6 bytes long. It contains the MAC address of the source device. As Source Address is always an individual address (Unicast), the least significant bit of first byte is always 0. It helps the receiving device in identifying the source device. The following image shows an example of both types of address in the frame.
  • Length /Packet Type → The type field helps to determine which protocol in the upper (network) layer of the destination computer to to send the received packet. This field allows the sender computer to insert the information of the upper layer protocol. Through this information, the data link layer of the destination computer can easily determine the upper layer protocol to which it should hand over the received frame.
  • Data and Pad field → This is the place where actual data is inserted, also known as Payload. This field stores the encapsulated data of the upper layer. This field has a size limit of 46 bytes (minimum) to 1500 bytes (maximum). Due to this limit, the network (upper) layer can't pack more or less data in a single packet (encapsulated data of the upper layer). If data is less than the minimum requirement, padding is added. If data is more than the maximum limit, extra data is packed in the next packet. Later implementations allowed for so-called ‘jumbo’ frames up to 9,000 bytes long to facilitate certain types of large traffic flows such as file transfers and video links.
  • FCS (Frame Check Sequence) → This field is 4 bytes long. This field stores a 4 bytes value that is used to check whether the received frame is intact or not. The sender device takes all fields of the frame except the Preamble, SFD (Start Frame Delimiter), and FCS field, and runs them through an algorithm, known as the CRC (Cyclic Redundancy Check). The CRC algorithm generates a 4-byte result, which is placed in this FCS field. When the destination device receives a frame, it takes the same fields and runs them through the same algorithm. If the result matches with the value stored in the FCS field, the frame is considered good and is processed further. If both values do not match, the frame is considered bad and is dropped.
  • Interpacket gap → of idle line state before transmitting the next packet. After the Ethernet data frame itself there is an interframe gap of a minimum of 12 bytes of data.

Note: According to section 3.3 of the IEEE 802.3 standard, each octet of the Ethernet frame, with the exception of the FCS, is transmitted low-order bit first.

1.4 Ethernet Runt and Giant Frames

The total size of the ethernet frame must be between 64 bytes and 1,518 bytes (not including the preamble). A frame shorter than the minimum 64 bytes but with a valid CRC is called as a runt. In most cases, such frames arise from a collision or a damaged network card. Any frame which is received and which is greater than the maximum frame size, is called a "giant". A "giant" is longer than 1518 bytes yet have a valid CRC. Both runts and giants are considered as invalid ethernet frames.

1.5 Ethernet Data Transmission Modes

  • Full duplex transmission → Another option that is allowed by the Ethernet MAC is full duplex with transmission in both directions. This is only allowable on point-to-point links, and it is much simpler to implement than using the CSMA/CD approach as well as providing much higher transmission throughput rates when the network is being used. Not only is there no need to schedule transmissions when no other transmissions are underway, as there are only two stations in the link, but by using a full duplex link, full rate transmissions can be undertaken in both directions, thereby doubling the effective bandwidth..
  • Half-duplex transmission → This access method involves the use of CSMA/CD and it was developed to enable several stations to share the same transport medium without the need for switching, network controllers or assigned time slots. Each station is able to determine when it is able to transmit and the network is self organising.

1.6 CSMA/CD protocol

CSMA/CD stands for Carrier Sense Multiple Access with Collision Detection. For example, one node-A wants to transmit the data to node-B connected on Ethernet medium. The software running on node-A sends the data to NIC (Network Interface Card) to build the packet. The packet is stored in the RAM of NIC and node-A monitors the bus. If no carrier is present on the Ethernet network, node-A transmits the packet over the medium. The data is broadcasted to all the PCs connected on the Ethernet bus. All the receiving nodes compare destination Ethernet address and whoever nodes' Ethernet address matches it will accept the packet from the medium and rest of the others will discard the packet. Whenever any one of the nodes transmits the information on the bus, all the PCs detect what is known as carrier. Carrier is nothing but the data transmitted over the bus at some rate as specified by Ethernet standard. If collision is detected when two or more nodes try to transmit at the same time then nodes will wait for some random period of time and will transmit again. This protocol is referred as CSMA/CD. The CSMA/CD protocol used for Ethernet and a variety of other applications falls into three categories. The first is Carrier Sense. Here each station listens on the network for traffic and it can detect when the network is quiet. The second is the Multiple Access aspect where the stations are able to determine for themselves whether they should transmit. The final element is the Collision Detect element. Even though stations may find the network free, it is still possible that two stations will start to transmit at virtually the same time. If this happens then the two sets of data being transmitted will collide. If this occurs then the stations can detect this and they will stop transmitting. They then back off a random amount of time before attempting a retransmission. The random delay is important as it prevents the two stations starting to transmit together a second time.

1.7 How is Data Communicated from one Machine to Another ?

To communicate data from one machine to another on the circuit, the transmitting station's Ethernet software takes a block of data and puts the Media Access Control sublayer (MAC) address of the desired destination device on the front of the block, along with the source MAC address, control information, framing and the FCS at the end of the block, creating the frame. Next, the transmitting machine checks if any other machines are using the circuit. If so, the transmitting station must wait. When the circuit is free, the transmitting station signals the MAC frame one bit at a time by flashing a light on and off on Optical Ethernet, by changing the voltage up and down on a copper LAN cable, or transmitting a modem signal using a radio on a wireless connection. All devices on the circuit receive the frame, verify if there are errors, then compare the destination MAC address from the frame to the MAC address on their LAN interface. If they are the same, then the device knows it should react to the frame. The result is to move a block of data from one machine to another machine on the same physical circuit. This is the purpose of Ethernet, MAC addresses and frames.

John Doe
8:17:11pm On 2019.02.9
I love this guy , he makes it look so easy.
John Doe
3:9:32am On 2019.02.12
was really helpful in my CISSP preparation..
John Doe
9:2:10am On 2019.04.17
Would you please cover the following topics? - TCP congestion control - Virtual Circuit Subnet - Datagram Subnet - Leaky bucket and Token Bucekt - Tunneling - Go back N, Selective Repeat.
John Doe
10:58:42pm On 2019.02.12
John Doe
5:6:45pm On 2019.02.25
I have a question about the name of the Packet. I found some books called it Datagram..
John Doe
10:17:00pm On 2022.06.27
Wvmwtm ATFL is located just at the anterior tip of the distal fibula. - generic 5mg cialis best price Celadrin Singapore Jguwqe Corbis Burstein Collection. <a href=>Cialis</a> Trsift .
John Doe
01:05:59am On 2022.06.29
Flqqmf prix du levitra 10 mag - canadian pharmacy cialis 20mg cialis plus efficace que viagra Cpkkab The functional AR proteins in human CC tissue were characterized by Traish et al. Yltxcm <a href=https://newfasttadalafil.
John Doe
06:37:26pm On 2022.09.14
free 60 minute trial phone chat gay local chat to gay <a href="">gay chat 877-***-7000 </a>.
John Doe
02:56:10am On 2022.09.16
gay masturbate chat <a href=>miai chat gay</a> gay rulette chat.
John Doe
07:41:11am On 2022.09.19
Inoltre, ГЁ molto facile prendere il Cialis Original <a href=>cialis buy online usa</a>.
John Doe
02:13:20am On 2022.09.20
auto essay writer <a href=>cheap essay</a> can someone write my essay.
John Doe
09:27:49pm On 2022.09.20
custom essay online <a href=>buy essay writing</a> best writing paper.
John Doe
11:28:58am On 2022.09.23
essay writing service cheap <a href=>reviews of essay writing services</a> help on essays.
John Doe
01:08:02am On 2022.09.25
essay service review <a href=>custom essay service</a> write my essay wikipedia.
John Doe
08:06:37pm On 2022.09.25
i need help writing a essay <a href=>essay writing service law</a> discount essay writing service.
John Doe
03:45:35pm On 2022.09.26
help with writing essays <a href=>macbeth essay help</a> best essay writer company.
John Doe
10:53:17am On 2022.09.27
top 5 essay writing services <a href=>expert essay writers</a> essay writers.
John Doe
12:02:02pm On 2022.09.27
slang daylight divert <a href=></a> <a href= ></a> similar heroin dump .
John Doe
06:47:23am On 2022.09.28
essay paper help <a href=>college admission essay writing service</a> how to write my college essay.
John Doe
02:43:59am On 2022.09.29
order custom essay <a href=>customer service essay</a> best essay writing.
John Doe
10:22:35pm On 2022.09.29
cheap custom essay papers <a href=>essays help</a> best essay website.
John Doe
05:16:08pm On 2022.09.30
help me essays <a href=>buy essays online safe</a> can i get someone to write my essay.
John Doe
11:47:44am On 2022.10.01
college essay community service <a href=>auto essay writer</a> need help writing scholarship essay.
John Doe
07:20:36am On 2022.10.02
essay writer website <a href=>top rated essay writing service</a> essay writer service.
John Doe
04:05:13am On 2022.10.03
essay online help <a href=>custom essays no plagiarism</a> looking for someone to write my essay.
John Doe
02:00:02am On 2022.10.04
where to buy essays <a href=>essay writing homework help</a> best rated essay writing service.
John Doe
08:30:35am On 2022.10.06
iddaa 2 3 sistem ne kadarmersin sehirler arasi otobus <a href="">tarot falД± bak 3 kart aЕџk</a> 2019 baДџkurback ingilizce ne demek az tv canlД± izle.
John Doe
01:53:28am On 2022.10.07
custom essays toronto <a href=>essay writer service review</a> buy essay paper.
John Doe
01:53:31pm On 2022.10.09
usa essay writing services <a href=>i need help writing my essay</a> essay about military service.
John Doe
08:14:30pm On 2022.10.11
college essay help online <a href=>buy essays cheap</a> essay homework help.
John Doe
11:12:31am On 2022.10.13
best cheap essay writing service <a href=>academic essay writing services</a> essays on the help.
John Doe
03:11:16am On 2022.10.14
<a href="">Türkiye Haberleri</a>.
Jane Doe
12:14:47am On 2022.10.29 yvigmloflq [url=]uyvigmloflq[/url] <a href="">ayvigmloflq</a>
John Doe
12:48:44pm On 2022.11.05
Petersburgh, Florida 33711 1 20 2017 <a href=>cheapest cialis available</a> The ratio of VDR to total protein in DIAm was reduced by 59 in Vdr fl fl actin iCre mice treated with TAM, compared with Vdr fl fl actin iCre.
John Doe
05:38:20am On 2022.11.16
helping others essays <a href=>custom essay writing service toronto</a> who can i pay to write my essay.
John Doe
07:49:26am On 2022.11.19
help writing college essays <a href=>custom written essay</a> help essay 123.
John Doe
10:40:37pm On 2022.11.21
pay to write my essay <a href=>top 5 essay writing services</a> write my essay services.
John Doe
07:33:56am On 2022.11.23
essay correction service <a href=>looking for someone to write my essay</a> help write essay for me.
John Doe
03:14:11pm On 2022.11.24
writing custom essays <a href=>essay writer helper</a> essay paper writing help.
John Doe
12:29:20am On 2022.11.26
admission essay editing service <a href=>custom order essays</a> online essay editing service.
John Doe
09:43:54am On 2022.11.27
essays about community service <a href=>help me write a descriptive essay</a> essay proofreading service.
John Doe
06:56:03pm On 2022.11.28
i need help with writing an essay <a href=>customized essay writing</a> essay editing service reviews.
John Doe
09:04:44am On 2023.01.25
design and technology gcse coursework <a href=>coursework moderation</a> coursework writing help.
Jane Doe
11:38:36pm On 2023.02.21 syrrbddnsy [url=]usyrrbddnsy[/url] <a href="">asyrrbddnsy</a>
Jane Doe
08:18:49pm On 2023.04.09 [url=]ufvhrkfoclc[/url] <a href="">afvhrkfoclc</a> fvhrkfoclc
Jane Doe
04:48:55am On 2023.09.26 [url=]ucefixvzbk[/url] cefixvzbk <a href="">acefixvzbk</a>