TCP Sequence and Acknowledgment Number Flashcards

Predict TCP Seq and Ack from short original traces. Work through byte ranges, SYN and FIN arithmetic, cumulative ACKs, and Wireshark relative numbers.

Om denne bunke

A TCP receiver gets 24 in-order data bytes starting at Seq=6100. Which byte comes next? These 38 flashcards give networking students and beginners short, original traces to work through one question at a time.

Start by turning a starting Seq and a payload length into byte positions, the sender's next Seq, and the receiver's next Ack. Work backwards from ACKs to find which bytes they cover and where a gap begins. Then follow the two directions of a TCP connection through data, ACK-only segments, a three-way handshake, and FIN. Later traces ask how a gap holds the cumulative ACK and what happens when the missing bytes arrive, which Seq a retransmission reuses, and how to read or convert Wireshark's relative numbers when the capture includes the handshake.

These are byte-position drills. ACK and retransmission timing, SACK blocks, window sizes, and sequence number wraparound each need rules beyond the byte arithmetic used here.

The traces follow RFC 9293 and use Wireshark's relative sequence number display. The original questions, answers, arrangement, and description are available under CC0 1.0 to the extent rights apply.

Kort i denne bunke

  1. Kort 1

    Spørgsmål

    A TCP data segment has Seq=6400 and 37 payload bytes, with no SYN or FIN. What sequence number does its last payload byte occupy?

    Svar

    6436. The first byte is 6400, so the last is 6400 + 37 - 1.

  2. Kort 2

    Spørgsmål

    B expects TCP byte 1800 from A and has nothing buffered beyond it. B accepts 64 payload bytes starting there, with no FIN. What Ack does B send?

    Svar

    Ack=1864. B has bytes 1800–1863 in order and expects 1864 next.

  3. Kort 3

    Spørgsmål

    A sends 35 new TCP payload bytes at Seq=4210, with no SYN or FIN. What Seq does A use when it next sends new data on this connection?

    Svar

    Seq=4245. The 35 bytes occupied positions 4210–4244 in A's stream.

  4. Kort 4

    Spørgsmål

    A TCP segment from B to A has the ACK flag set and shows Seq=9142, Ack=2768. Whose byte stream does the Ack refer to?

    Svar

    A's stream, from A to B. B puts its own sequence position in Seq and its next expected position from A in Ack.

  5. Kort 5

    Spørgsmål

    A TCP segment covers payload byte positions 3092 through 3122, inclusive. How many payload bytes does it carry?

    Svar

    31 bytes. Count both endpoints, so 3122 - 3092 + 1 = 31.

  6. Kort 6

    Spørgsmål

    B has received some of A's TCP payload in order and sends Ack=6731. No FIN has arrived. What is the last contiguous payload byte position of A's stream that this ACK covers?

    Svar

    6730. The ACK points one position beyond the contiguous data.

  7. Kort 7

    Spørgsmål

    A sends an ordinary TCP ACK-only segment with Seq=7350, Ack=1906. What Seq does A use when it sends its first new data after that ACK?

    Svar

    Seq=7350, the same as the ACK-only segment. An ACK with no payload, SYN or FIN uses no sequence space.

  8. Kort 8

    Spørgsmål

    B expects TCP byte 3500 from A. It receives 42 payload bytes at Seq=3500, then 23 more at Seq=3542. Neither segment carries a FIN and B has no later bytes buffered. What Ack would cover both segments?

    Svar

    Ack=3565. B has one continuous run of 42 + 23 bytes from 3500.

  9. Kort 9

    Spørgsmål

    The first TCP handshake segment is a SYN with the ACK flag clear. A trace shows a raw acknowledgment field of 0. What has this segment acknowledged?

    Svar

    It carries no acknowledgment. The ACK flag must be set for the acknowledgment field to have meaning.

  10. Kort 10

    Spørgsmål

    B expects TCP byte 8150 from A and has no later bytes buffered. B accepts one complete data segment from 8150 with no FIN and replies with Ack=8226. How many payload bytes did that segment carry?

    Svar

    76 bytes. The entire segment was received in order, so its payload length is 8226 - 8150.

  11. Kort 11

    Spørgsmål

    B's next TCP send position is 5521. A sends B 80 bytes, which B receives in order. B now sends a data reply. What Seq does B use?

    Svar

    Seq=5521. Receiving A's data moves B's acknowledgment of A, while B's Seq starts at B's own send position.

  12. Kort 12

    Spørgsmål

    B's TCP Ack for A advances from 2301 to 2397 during a data-only exchange. Can you tell from those two values how many segments carried the newly acknowledged bytes?

    Svar

    No. The ACK advance covers 96 bytes of A's stream, and those bytes could have arrived in one segment or several.

  13. Kort 13

    Spørgsmål

    A opens a TCP connection with a SYN at Seq=4260 and no payload. What Ack does B send in the SYN-ACK?

    Svar

    Ack=4261. The SYN takes one position in A's sequence space.

  14. Kort 14

    Spørgsmål

    A sends two TCP data segments, 40 bytes at Seq=7100 and 30 bytes at Seq=7140, with no FIN. B sends Ack=7154. How many bytes of the second segment does that ACK cover?

    Svar

    14 bytes. The ACK covers positions 7140–7153 of the second segment.

  15. Kort 15

    Spørgsmål

    B sends an ordinary TCP ACK-only segment at Seq=6024. B then receives more in-order data from A and sends another ACK-only segment, with no sends in between. What Seq does B use for the second ACK?

    Svar

    Seq=6024. B has sent no new payload or sequence-consuming control since the first ACK.

  16. Kort 16

    Spørgsmål

    B expects TCP position 9180 from A and accepts an in-order FIN with Seq=9180 and no payload. What Ack does B send for it?

    Svar

    Ack=9181. The FIN occupies one position even with zero payload bytes.

  17. Kort 17

    Spørgsmål

    A starts a TCP handshake with a SYN at Seq=6820 and B replies with a SYN-ACK at Seq=12400. The handshake carries no payload. What is A's Seq on the final ACK?

    Svar

    Seq=6821. A's SYN used one position in A's own sequence space.

  18. Kort 18

    Spørgsmål

    B expects TCP byte 5800 from A. Before it gets that byte, B receives and buffers 28 payload bytes starting at Seq=5840. If B sends an ACK before it accepts any more data, what Ack does it carry?

    Svar

    Ack=5800. The later bytes are buffered, and 5800 is still the first missing byte.

  19. Kort 19

    Spørgsmål

    B has been sending Ack=4080 for A on an open TCP connection. B now sends 32 bytes of its own data at Seq=7400 with the ACK flag set. B has received no new bytes or FIN from A. What Ack goes on B's data segment?

    Svar

    Ack=4080. B's payload uses B's sequence space, while B's Ack still tracks what B expects from A.

  20. Kort 20

    Spørgsmål

    A full TCP handshake in Wireshark shows both peers' SYNs at Seq=0 with relative sequence numbers enabled. What does the displayed zero mark for each peer?

    Svar

    That peer's initial sequence number, shown as zero. Each direction has its own starting point.

  21. Kort 21

    Spørgsmål

    A sends a SYN at Seq=2610 and receives B's SYN-ACK at Seq=15390. Neither carries payload. What Ack does A put in its final TCP handshake segment?

    Svar

    Ack=15391. A is acknowledging B's SYN, which occupied position 15390 in B's stream.

  22. Kort 22

    Spørgsmål

    A's TCP data segment carrying bytes 7408–7440 fails to reach B. A later retransmits exactly those 33 bytes in a segment with no SYN or FIN. What Seq does the retransmission carry?

    Svar

    Seq=7408. The same bytes keep their original sequence numbers.

  23. Kort 23

    Spørgsmål

    On an established TCP connection, A sends a segment at Seq=4860 with 19 payload bytes and a FIN. Which sequence position does the FIN occupy?

    Svar

    4879. The payload occupies 4860–4878, and the FIN comes immediately after it in sequence space.

  24. Kort 24

    Spørgsmål

    B sends TCP Ack=3104 to A and has buffered all bytes 3140–3168. Those are the first bytes B has beyond the gap. Which byte positions are missing between the contiguous data and that buffered block?

    Svar

    3104–3139, inclusive. The gap starts at Ack and ends just before the first buffered byte.

  25. Kort 25

    Spørgsmål

    With the complete TCP handshake captured, Wireshark shows A's SYN at relative Seq=0. Its raw Seq is 43160. What relative Seq will Wireshark show for a later A segment with raw Seq=43373?

    Svar

    Seq=213. Subtract A's raw SYN position, 43373 - 43160.

  26. Kort 26

    Spørgsmål

    B initially sends TCP Ack=4608 to A. B later sends Ack=4763. Only data advances A's sequence space between those two points. Which byte positions did the second ACK newly cover?

    Svar

    4608–4762, inclusive. Start at the old Ack and stop one before the new Ack.

  27. Kort 27

    Spørgsmål

    An established TCP connection carries these two data segments. A expects TCP byte 9040 from B and accepts B's entire reply. Neither segment carries a FIN, and A has no later bytes from B buffered.

    A → B  Seq=1120             72 payload bytes
    B → A  Seq=9040  Ack=1192   58 payload bytes
    

    What Ack does A send back?

    Svar

    Ack=9098. Add the 58 in-order bytes to B's starting Seq of 9040.

  28. Kort 28

    Spørgsmål

    B expects TCP byte 2700 from A and has kept all bytes 2790–2829 in its buffer. B now receives and accepts 55 payload bytes at Seq=2700. What Ack does B send?

    Svar

    Ack=2755. The new bytes fill 2700–2754 and leave a gap before the buffered block.

  29. Kort 29

    Spørgsmål

    B has sent TCP data through byte 3962. A sends a FIN and B acknowledges it with an ACK-only segment. B stays open for sending. What Seq does B use for its next new payload?

    Svar

    Seq=3963. A's FIN takes a position in A's stream, and B's ACK-only reply uses none of B's positions.

  30. Kort 30

    Spørgsmål

    B expects TCP byte 6240 from A. B receives a duplicate copy of bytes 6200–6239, which it already has. If B sends an ACK for this arrival, what Ack does it carry?

    Svar

    Ack=6240. The duplicate covers only positions B had already received in order.

  31. Kort 31

    Spørgsmål

    B expects TCP position 5540 from A. It accepts a segment there with 27 payload bytes and a FIN. What Ack does B send after accepting both the data and the FIN?

    Svar

    Ack=5568. Add 27 for the payload and one for the FIN.

  32. Kort 32

    Spørgsmål

    B expects TCP byte 4800 from A. B keeps bytes 4840–4874 and 4875–4903 in its out-of-order buffer. It then receives and accepts all of 4800–4839. What cumulative Ack does B send now?

    Svar

    Ack=4904. The newly received bytes join both buffered blocks into one continuous run through 4903.

  33. Kort 33

    Spørgsmål

    Wireshark captured both TCP SYNs. A's raw SYN Seq is 51000 and B's is 87000. A later sends B a segment that Wireshark shows with relative Ack=97. What raw Ack is in A's segment?

    Svar

    Ack=87097. A's Ack refers to B's stream, so add 97 to B's raw SYN position.

  34. Kort 34

    Spørgsmål

    During a TCP data exchange, B sends A the same cumulative Ack=6900 after two successive arrivals. Did B's in-order byte range from A grow between those ACKs?

    Svar

    No. Both ACKs still point to 6900, the next byte B expects from A.

  35. Kort 35

    Spørgsmål

    A opens a TCP connection with a SYN. B replies with a SYN-ACK. Whose initial sequence number goes in the Seq field of B's reply?

    Svar

    B's. Each peer announces its own initial sequence number in its SYN.

  36. Kort 36

    Spørgsmål

    B expects TCP byte 5600 from A. Bytes 5650–5699 arrive out of order and B discards them. B then accepts bytes 5600–5649, and no other data arrives. What Ack does B send?

    Svar

    Ack=5650. B has the first block in order. The discarded block is still missing at 5650.

  37. Kort 37

    Spørgsmål

    A and B have an established TCP connection. A sends the new data shown below. Before it reaches B, A also receives the segment shown from B.

    A → B  Seq=2240             36 payload bytes
    B → A  Seq=9480  Ack=2240   20 payload bytes
    

    Neither segment carries a FIN. A was expecting byte 9450 from B, so it buffers B's later bytes. A's next segment is a pure ACK. What Seq does A use on that ACK?

    Svar

    Seq=2276. A's send position advanced by 36 bytes. The gap in B's stream affects A's Ack field.

  38. Kort 38

    Spørgsmål

    B sends a TCP ACK with Ack=7794 after accepting A's FIN in order. This ACK covers A's stream exactly through the FIN. What sequence position did A's FIN occupy?

    Svar

    7793. The FIN occupied the position just before B's next expected sequence number.

Two rows of ceramic tiles, with an amber tile above a gap in the top row.

38 kort

TCP Sequence and Acknowledgment Number Flashcards

Studer denne bunke gratis

Nibomo åbner, så du kan gå i gang med at lære.

Lignende bunker