Options

Calculating Seq & Ack number

fluk3dfluk3d Member Posts: 141 ■■■□□□□□□□
I'm having a brain fart when trying to figure out how to calculate the seq & ack number after the 3-way handshake has been established. I started looking @ Understanding TCP Sequence and Acknowledgment Numbers - Packet Life however; it lost me. Does anyone have a simple explanation with an example preferably

thank you
"Imagination is more important than knowledge." - Albert Einstein

Comments

  • Options
    fluk3dfluk3d Member Posts: 141 ■■■□□□□□□□
    Essentially after starring at my book if someone can confirm

    the next ack is calculated by
    sequence number + length = confirmation of ack
    "Imagination is more important than knowledge." - Albert Einstein
  • Options
    RoguetadhgRoguetadhg Member Posts: 2,489 ■■■■■■■■□□
    I think you're talking about Sliding windows?

    The Acknowledgement will say "Thank you I got the packet of X, go ahead and send me X and Y more."

    It bounces around though.

    It's like like how copying a file on windows will say "5 Hours" but then it'll cut down to "15 minutes", or may go back up to "2 Hours" depending on what the resources are available to send the information.

    If memory serves me right that is. I don't have my ICND1 book with me.

    Edit 1:
    1. SYN: The active open is performed by the client sending a SYN to the server. It sets the segment's sequence number to a random value A.
    2. SYN-ACK: In response, the server replies with a SYN-ACK. The acknowledgment number is set to one more than the received sequence number (A + 1), and the sequence number that the server chooses for the packet is another random number, B.
    3. ACK: Finally, the client sends an ACK back to the server. The sequence number is set to the received acknowledgement value i.e. A + 1, and the acknowledgement number is set to one more than the received sequence number i.e. B + 1.
    From different sources, including wiki (take it as it is), the server doesn't know what number will be next.

    Edit 2:
    Im seeing from here that your original answer is correct: http://www.rhyshaden.com/tcp.htm
    • Host 2 receives the SYN with the Sequence number A and sends a SYN segment with its own totally independent ISS number B in the Sequence number field. In addition, it sends an increment on the Sequence number of the last received segment (i.e. A+x where x is the number of octets that make up the data in this segment) in its Acknowledgment field. This Acknowledgment number informs the recipient that its data was received at the other end and it expects the next segment of data bytes to be sent, to start at sequence number A+x. This stage is aften called the SYN-ACK. It is here that the MSS is agreed.
    • Host 1 receives this SYN-ACK segment and sends an ACK segment containing the next sequence number (B+y where y is the number of octets in this particular segment), this is called Forward Acknowledgement and is received by Host 2. The ACK segment is identified by the fact that the ACK field is set. Segments that are not acknowledged within a certain time span, are retransmitted.
    So yeah... I would assume you're correct. I've quickly skimmed different websites to find a correct answer for you. So yep, you're right. After the initial connect [Random, sometimes obscenely high, number high generated?], it's incremented upwards.

    Sources:
    http://support.novell.com/techcenter/articles/nc2001_05e.html
    http://stackoverflow.com/questions/692880/tcp-how-are-the-seq-ack-numbers-generated
    http://support.microsoft.com/kb/169292
    http://ask.wireshark.org/questions/2145/how-do-tcp-sequence-and-acknowledgement-numbers-work
    http://ssfnet.org/Exchange/tcp/tcpTutorialNotes.html

    I hope these help you some. There's a lot of information to read through if you're interested more. Although, like everything on the internet - it may not be true.
    In order to succeed, your desire for success should be greater than your fear of failure.
    TE Threads: How to study for the CCENT/CCNA, Introduction to Cisco Exams

  • Options
    fluk3dfluk3d Member Posts: 141 ■■■□□□□□□□
    Thanks for looking into that !
    "Imagination is more important than knowledge." - Albert Einstein
Sign In or Register to comment.