5

Please let me know where the gaps in my understanding are. There are many gaps, so please do not hesitate to fill them in or correct them.

To my knowledge, what happens on the hardware level when receiving a packet and triggering ARP, IP, or another process is the following:

  1. A signal is sent to the the router and is detected by the a UART or DUART.
  2. The DUART sends an interrupt to the CPU so that it can change the bit stream into read-able bytes.
  3. The bytes that the UART has converted from the signal (in the form of a 11 bits: 1 start bit, 8 bits for data, and 2 stop bits) are then sent to the Serial Interface adapter driver.
  4. The device driver for the serial interface adapter is then triggered from the HD and brought into the RAM memory.
  5. The device driver makes "virtualization" of the serial interface. This virtualization of the serial interface adapter takes the bytes that were received and puts them in a "frame" format that will be able to be understood by a process like ARP. For instance, it might put it in an ethernet frame.
  6. The virtualizations of the serial inferface are in a buffer (queue). When the virtualization is at the front of the queue, the device driver calls the correct process (again ARP, IP, etc) depending on the "protocol type" of the packet.
  7. The CPU then calls that program into RAM from the HD and writes to the "heap" that the process was assigned so that it can make sense of the packet and do what it needs to with the packet.

Places I know are very fuzzy are the role of the Serial Interfaces Adapter's device driver and the role of the queue. Also, I know that all operations are being driven by the CPU, I just thought it would be a little redundant to repeat it in each step.

Please let me now what is wrong with my understanding or any steps I am missing when describing what happens at the hardware level of a router when receiving a packet.

4

I'm not sure why you are stuck on ARP (Address Resolution Protocol). It is not used in receiving bits on the wire. It resolves a layer-3 address into a layer-2 address in order to build a layer-2 frame, but when receiving, you are stripping off the layer-2 frame. Some things, like serial interfaces, may not use ARP or frames the way ethernet does.

The process inside a router, or other device, will vary greatly, depending on the vendor, model, and OS. For instance, many modern routers do much of what you describe in hardware using ASICs (Application Specific Integrated Circuits).

First, read up on the OSI model and learn about the layers. It is theoretical, but it gives you an idea of how things work in independent layers. Understand how the independent layers work with each other, then concentrate on the specific mechanics inside each one.

  1. Layer-1 is the bits on the wire and the hardware to encode/decode them.
  2. Layer-2 is where frames and MAC addresses are.
  3. Layer-3 is where packets and IP addresses are.
  4. Layer-4 is where segments and ports (layer-4 addresses) are.
  5. Higher layers are off-topic here.

When an application wants to send data to an application in another host, it requests a connection (use of a particular port) with a layer-4 protocol, such as TCP or UDP.

The layer-4 protocol divides the data into datagrams called segments, and it applies the segment headers, including layer-4 source and destination addresses, such as TCP or UDP ports, to the segments.

The layer-4 segments are sent to layer-3 where packet headers, including the layer-3 source and destination addresses, such as IP addresses, are applied.

The layer-3 packets are sent to layer-2 where frame headers, including the layer-2 source and destination addresses, such as MAC addresses, are applied. In order to get the destination layer-2 address, layer-2 must resolve the layer-3 destination address into a layer-2 address. This is where ARP (Address Resolution Protocol) may come into play. Layer-2 first checks its ARP cache for the resolution. If it doesn't find it there, it will send an ARP request for the destination host to reply with its layer-2 address. If the layer-3 address is on a different layer-3 network, it will use the layer-2 address of the layer-3 gateway.

Layer-2 will then pass the frames on to the layer-1 hardware for serialization, and to put the resulting bits on the wire.

When the receiving host (or gateway) gets the bits, it deserializes them, and de-encapsulates the frames, packets, and segments, passing the resulting data up to the receiving application. Note: ARP is only needed for sending, not receiving since all the addressing is already included in the received data.

If the receiver is a gateway (router), it will de-encapsulate the frames since they are only useful for the local LAN. The router will then inspect the layer-3 headers for the destination layer-3 addresses, and look in its routing table to see if it has next hops for the packets. If the router has no next hop for a packet, it will discard the packet, otherwise it will switch that packet to the next interface and repeat the process of encapsulating the packet into a frame for the new LAN to the next hop. The new frame will then be serialized into bits for the next link. Some routers only have hardware queues, and some have user-definable queues which may be sized according to the type of traffic. There may be priority queues which get served first. Packets may be randomly dropped in order to prevent queues from filling up, or they may just drop any packets when the queue is full.

Discussion beyond what I have described may be either device-specific, or too broad for this site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.