tcp

jernej horvat j at aufbix.org
Mon May 14 22:50:01 CEST 2001


Da boste vedeli kaj nastavljate s sysctl:

net/ipv4/tcp_ecn = 0
net/ipv4/tcp_sack = 1
net/ipv4/tcp_syncookies = 1
net/ipv4/tcp_timestamps = 1
net/ipv4/tcp_window_scaling = 1
net/ipv4/tcp_rfc1337 = 0




Maximum Segment Size (MSS): The Maximum Segment Size (MSS) was defined in RFC 
793; it is used to exchange Maximum Transfer Unit (MTU) / Maximum Receive 
Unit (MRU) sizes during the TCP three-way handshake. Basically, both ends of 
the connection will state the maximum IP datagram size that they can handle 
without using fragmentation, and the lower of the two values will be used by 
both ends. If the MSS option is omitted by one or both ends of the 
connection, the value 536 bytes will be used (per RFC 1122). The MSS is only 
negotiated during the SYN and SYN/ACK packets in the TCP three-way handshake, 
so the MSS option should only be seen in those packets. 

Window Scale (WSCALE): Window size is a standard TCP header field, not a TCP 
option. The window size is used to record how many bytes of buffer space the 
host has available for receiving data. Because the window size field is only 
16 bits long, this limits the maximum window size to 65,535 bytes. At one 
time, this was sufficient, but it no longer is. The Window Scale (WSCALE) 
option was defined in RFC 1072; it was then redefined in RFC 1323. The Window 
Scale value is used to shift the window size field's value up to a maximum 
value of approximately a gigabyte. Like the MSS option, the WSCALE option 
should only appear in SYN and SYN/ACK packets during the handshake. However, 
if both ends of the connection do not use the WSCALE option, the window size 
will remain unchanged.

Timestamp (TIMESTAMP): Another TCP option that is frequently used is the 
Timestamp option, which was first defined in its current form in RFC 1323. 
Its purpose is to track the round-trip delivery time for data in order to 
identify changes in latency that may require acknowledgment timer 
adjustments. Timestamps can only be used if both ends of the connection agree 
to use them, as you'll see shortly. Unlike the MSS and WSCALE options, 
Timestamp options are typically used throughout a TCP session, so if they are 
being used, you should see them in most of the packets.

The Timestamp option has two timestamp fields: the Timestamp Value and the 
Timestamp Echo Reply. When a host first timestamps a packet in a connection, 
it puts the timestamp in the Timestamp Value field and leaves the Timestamp 
Echo Reply field set to 0 (generally), and it sends the packet to the other 
host. When that host receives the packet and prepares to acknowledge it, it 
essentially takes the timestamp from the old packet's Timestamp Value field 
and inserts it in the new packet's Timestamp Echo Reply field, and puts a new 
timestamp in the Timestamp Value field. So the Timestamp Value field always 
contains the latest timestamp, while the Timestamp Echo Reply field contains 
the previous timestamp.

No Operation (NOP): The No Operation (NOP) TCP option, defined in RFC 793, is 
used to provide padding around other options. The length of the TCP header 
must be a multiple of 4 bytes; however, some of the options are not 4 bytes 
long. So if there are 3 bytes of options, a NOP will be added to the options 
in order to pad them to a length that is a 4-byte multiple. If there were 2 
bytes of options, two NOPs would be used. NOPs are sometimes used between 
options, particularly if an option needs to start on a certain byte boundary, 
so it is not unusual to see several NOPs throughout a set of TCP options.

Selective Acknowledgments: The concept of selective acknowledgments was 
defined in RFC 1072 and redefined in RFC 2018. Normally, when a host 
acknowledges data, it can only acknowledge the packets up to and including 
the packet number immediately before a missing packet. This means that if a 
thousand packets are received but the second one is missing, the host can 
only acknowledge the receipt of the first packet, so the sender would have to 
resend all packets from number 2 through 1000. By using selective 
acknowledgments, the receiver could acknowledge the receipt of the packets 
from 3 through 1000, so the sender would only have to resend packet 2. 

There are two TCP options relating to selective acknowledgments:

Selective Acknowledgment Permitted (SackOK): This option simply says that 
selective acknowledgments are permitted for this connection. SackOK must be 
included in the TCP options in the SYN and SYN/ACK packets during the TCP 
three-way handshake, or it cannot be used. 

Selective Acknowledgment Data: This option contains the actual acknowledgment 
information for a selective acknowledgment. It lists one or more pairs of 
sequence numbers, which define ranges of packets that are being acknowledged.

-- 
Soap and education are not as sudden as a massacre, but they are more
deadly in the long run.
		-- Mark Twain



More information about the lugos-bla mailing list