From owner-freebsd-questions@FreeBSD.ORG Wed Jul 30 04:50:30 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C44D3106567A for ; Wed, 30 Jul 2008 04:50:30 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 427F78FC25 for ; Wed, 30 Jul 2008 04:50:29 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl151-101.kln.forthnet.gr [62.1.242.101]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id m6U4oImt014925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 30 Jul 2008 07:50:24 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m6U4oILj047946; Wed, 30 Jul 2008 07:50:18 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m6U4oGs0047780; Wed, 30 Jul 2008 07:50:16 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: perryh@pluto.rain.com References: <488fe865.x7NyNic2A5pcZPCL%perryh@pluto.rain.com> <87ljzkdm3x.fsf@kobe.laptop> Date: Wed, 30 Jul 2008 07:50:16 +0300 In-Reply-To: <87ljzkdm3x.fsf@kobe.laptop> (Giorgos Keramidas's message of "Wed, 30 Jul 2008 07:36:34 +0300") Message-ID: <87hca8dlh3.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: m6U4oImt014925 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.014, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.39, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-questions@freebsd.org Subject: Re: setting the other end's TCP segment size X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2008 04:50:30 -0000 On Wed, 30 Jul 2008 07:36:34 +0300, Giorgos Keramidas wrote: > On Tue, 29 Jul 2008 21:04:53 -0700, perryh@pluto.rain.com wrote: >>> [TCP] splits traffic to 'segments' using its own logic ... >> >> Is there a simple way for a FreeBSD system to cause its peer >> to use a transmit segment size of, say, 640 bytes -- so that >> the peer will never try to send a packet larger than that? >> >> I'm trying to get around a network packet-size problem. In >> case it matters, the other end is SunOS 4.1.1 on a sun3, and >> I've been unable to find a way to limit its packet size >> directly. > > Setting the interface MTU should do it, i.e.: > > ifconfig re0 mtu 640 > > Not all interfaces support setting the MTU and some may have > range restrictions though. In particular, this seems to work with my wlan0 interface, but not with my re0 interface. The wlan0 interface correctly limits the maximum TCP segment size to 500 bytes when I set the MTU: # ifconfig wlan0 | fgrep mtu wlan0: flags=8843 metric 0 mtu 1500 # ifconfig wlan0 down; ifconfig wlan0 mtu 50 up Then a tcpdump to save SSH traffic to a particular host, and a dump of the resulting pcap shows: # tcpdump -s 2000 -l -vvv -w save.pcap 'host a.b.c.d port 22' Got 42^C # echo ` tcpdump -n -l -vvv -r save.pcap 2>/dev/null | \ sed -e 's/.* length //' -e 's/).*//' ` | fmt 60 60 52 91 52 91 500 500 340 356 52 52 76 204 196 500 260 52 68 52 100 100 116 116 500 132 52 500 84 52 500 196 52 84 116 100 164 436 52 100 132 52 This should work for *both* sides of the connection because of the initial maximum segment size negotiation between the two TCP hosts. See for example the two first packets of the capture I mentioned above, and look for the 'mss' option: 07:38:19.554338 IP (tos 0x0, ttl 64, id 44805, offset 0, flags [DF], proto TCP (6), length 60) 192.168.1.???.53468 > X.Y.Z.W.22: S, cksum 0x20d6 (correct), 4195632487:4195632487(0) win 65535 07:38:19.591065 IP (tos 0x0, ttl 54, id 39804, offset 0, flags [DF], proto TCP (6), length 60) X.Y.Z.W.22 > 192.168.1.???.53468: S, cksum 0x7f2f (correct), 901580944:901580944(0) ack 4195632488 win 65535 The MSS advertised is less than 500 to leave some space for the IP and TCP headers, but the full IP datagram _length_ that I displayed in the fmt(1) output above shows that the full MTU is used some times for the IP datagrams sent or received.