EdwardKing presented these words - circa 8/19/08 9:39 PM-> > $sysctl net.inet.tcp.msl > net.inet.tcp.msl 30000 > > It is 30000ms or 30000s? >
It's ms, basically it is 30*hz (see tcp_timer.h). So it is by default, 30 secs. > I want to modify it,because I met with following question: > > There is a server and a client,when client send a message to server,server > can send a reply to client. The status of server and client is ESTABLISHED.Then I halt the client by press ctrl+c,I find the server status is CLOSE_WAIT and the client status is FIN_WAIT_2. Many minutes passed,I find the the server status still is CLOSE_WAIT and the client status still is FIN_WAIT_2. At last,the client status is disappeared,but the server status still is CLOSE_WAIT.Why the status of server isn't CLOSED? I am puzzled with it for a very long time. Would you tell the reason? This is going to require you digging into the TCP protocol (you can start with RFC-793 but I would also recommend some books on the subject, I prefer the Stevens book "TCP/IP Illustrated, Vol 1"). I've attached the TCP state diagram to this email for you. Let's look at what happens, we start with both the client and the server in the TCP state ESTAB Client Event Server ====== ====== ====== ESTAB ESTAB You issue a CTRL-C, causing the client to close the connection to the server. This causes the following: ESTAB->CLOSE ESTAB --> <FIN> CLOSE->FIN_WAIT_1 ESTAB The TCP layer moves the connection to CLOSE state and sends a FIN to start connection tear down. The server receives the FIN. ESTAB <ACK><-- FIN_WAIT_1 ESTAB->CLOSE_WAIT On the server the reception of the FIN causes the TCP layer to send an ACK of the FIN and moves the connection to the CLOSE_WAIT state. FIN_WAIT_1->FIN_WAIT_2 CLOSE_WAIT What should be happening is that now the server should send a FIN in response, but either 1) it fails too or 2) it is lost in between. Eventually, the TCP layer on the client times out the FIN_WAIT_2 state and moves the connection to the CLOSED state. However, the server cannot move out of the CLOSE_WAIT state since it hasn't seen the ACK to it's FIN. There is no TCP variable in the FreeBSD implementation to change this (that I know of). I have seen this happen at times when there is a buggy NAT firewall between you and the server that causes the FIN from the server to get dropped. If you have control of both sides, you can do packet traces using tcpdump to see if the FIN from the server is ever sent or receive. It is possible that your client is dropping the packet itself. Good luck, Patrick > > Thanks. > > ----- Original Message ----- > From: "Patrick Mahan" <[EMAIL PROTECTED]> > To: "EdwardKing" <[EMAIL PROTECTED]> > Sent: Wednesday, August 20, 2008 12:06 PM > Subject: Re: How to set TCP parameter? > > >> >> EdwardKing presented these words - circa 8/19/08 7:14 PM-> >>> Yes,I want to modify spent in the "TIME_WAIT" state? How to realize it? >>> >>> I use sysctl to view TCP parameter,but it failed >>> $sysctl TCP_TIME_WAIT_INTERVAL >>> sysctl: unknown oid 'TCP_TIME_WAIT_INTERVAL' >>> >>> Where is wrong? >>> >> There is no such variable in the TCP protocol implementation on FreeBSD >> (that I can see). Instead, you can try to modify the TCP Maximum Segment >> Lifetime (sysctl net.inet.tcp.msl). TIME_WAIT should wait a maximum of >> 2*msl before timing out. However, changing it can adversly affect other >> parts >> of the protocol. >> >> Why do you want to modify it? >> >> Patrick >> >>> ----- Original Message ----- >>> From: "Patrick Mahan" <[EMAIL PROTECTED]> >>> To: "EdwardKing" <[EMAIL PROTECTED]> >>> Cc: "FreeBSD" <freebsd-questions@freebsd.org> >>> Sent: Wednesday, August 20, 2008 9:59 AM >>> Subject: Re: How to set TCP parameter? >>> >>> >>>> EdwardKing presented these words - circa 8/19/08 6:17 PM-> >>>>> How to set TCP parameters,such as tcp_time_wait_interval? >>>>> >>>> You should use 'sysctl'. See 'man 8 sysctl'. >>>> >>>> However, I don't see any time wait variables available via sysctl. Are you >>>> trying to modify the time spent in the "TIME_WAIT" state? >>>> >>>> Patrick >>>> >>>>> Thanks >>>>> >>>>> >>>>> ---------------------------------------------------------------------------------------------- >>>>> Confidentiality Notice: The information contained in this e-mail and any >>>>> accompanying attachment(s) is intended only for the use of the intended >>>>> recipient and may be confidential and/or privileged of Neusoft >>>>> Corporation, its subsidiaries and/or its affiliates. If any reader of >>>>> this communication is not the intended recipient, unauthorized use, >>>>> forwarding, printing, storing, disclosure or copying is strictly >>>>> prohibited, and may be unlawful. If you have received this communication >>>>> in error, please immediately notify the sender by return e-mail, and >>>>> delete the original message and all copies from your system. Thank you. >>>>> ----------------------------------------------------------------------------------------------- >>>>> >>>>> _______________________________________________ >>>>> freebsd-questions@freebsd.org mailing list >>>>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>>>> To unsubscribe, send any mail to "[EMAIL PROTECTED]" >>>>> >>>>> >>> >>> ---------------------------------------------------------------------------------------------- >>> Confidentiality Notice: The information contained in this e-mail and any >>> accompanying attachment(s) is intended only for the use of the intended >>> recipient and may be confidential and/or privileged of Neusoft Corporation, >>> its subsidiaries and/or its affiliates. If any reader of this communication >>> is not the intended recipient, unauthorized use, forwarding, printing, >>> storing, disclosure or copying is strictly prohibited, and may be unlawful. >>> If you have received this communication in error, please immediately notify >>> the sender by return e-mail, and delete the original message and all copies >>> from your system. Thank you. >>> ----------------------------------------------------------------------------------------------- >>> >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to "[EMAIL PROTECTED]" >>> >>> > > > ---------------------------------------------------------------------------------------------- > Confidentiality Notice: The information contained in this e-mail and any > accompanying attachment(s) is intended only for the use of the intended > recipient and may be confidential and/or privileged of Neusoft Corporation, > its subsidiaries and/or its affiliates. If any reader of this communication > is not the intended recipient, unauthorized use, forwarding, printing, > storing, disclosure or copying is strictly prohibited, and may be unlawful. > If you have received this communication in error, please immediately notify > the sender by return e-mail, and delete the original message and all copies > from your system. Thank you. > ----------------------------------------------------------------------------------------------- > >
September 1981 Transmission Control Protocol Functional Specification +---------+ ---------\ active OPEN | CLOSED | \ ----------- +---------+<---------\ \ create TCB | ^ \ \ snd SYN passive OPEN | | CLOSE \ \ ------------ | | ---------- \ \ create TCB | | delete TCB \ \ V | \ \ +---------+ CLOSE | \ | LISTEN | ---------- | | +---------+ delete TCB | | rcv SYN | | SEND | | ----------- | | ------- | V +---------+ snd SYN,ACK / \ snd SYN +---------+ | |<----------------- ------------------>| | | SYN | rcv SYN | SYN | | RCVD |<-----------------------------------------------| SENT | | | snd ACK | | | |------------------ -------------------| | +---------+ rcv ACK of SYN \ / rcv SYN,ACK +---------+ | -------------- | | ----------- | x | | snd ACK | V V | CLOSE +---------+ | ------- | ESTAB | | snd FIN +---------+ | CLOSE | | rcv FIN V ------- | | ------- +---------+ snd FIN / \ snd ACK +---------+ | FIN |<----------------- ------------------>| CLOSE | | WAIT-1 |------------------ | WAIT | +---------+ rcv FIN \ +---------+ | rcv ACK of FIN ------- | CLOSE | | -------------- snd ACK | ------- | V x V snd FIN V +---------+ +---------+ +---------+ |FINWAIT-2| | CLOSING | | LAST-ACK| +---------+ +---------+ +---------+ | rcv ACK of FIN | rcv ACK of FIN | | rcv FIN -------------- | Timeout=2MSL -------------- | | ------- x V ------------ x V \ snd ACK +---------+delete TCB +---------+ ------------------------>|TIME WAIT|------------------>| CLOSED | +---------+ +---------+ TCP Connection State Diagram Figure 6. [Page 23]
_______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"