Increasing TUN_MTU_MIN to make connection establishment faster
Hi all,
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why TUN_MTU_MIN is set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in function
static void tls_init_control_channel_frame_parameters(const struct frame *data_channel_frame,
struct frame *frame)
....
/* set dynamic link MTU to minimum value */ frame_set_mtu_dynamic (frame, 0, SET_MTU_TUN);
We were debugging slow connection establishment on links with higher RTT (>200ms), which takes about 7seconds. We tracked the problem down to certificate handshake on a control channel, where client and server need to exchange certificates which are about 3KiB each, and because the enforced low MTU during tls init, and the fact that there are at maximum 4 unacknowledged packets on wire (CONTROL_SEND_ACK_MAX), it takes quite a lot of round trips to transfer it (it is clearly visible in wireshark, that the openvpn fragments are exactly of 100Bytes).
I tried to increase the TUN_MTU_MIN to 1000 (which should be safe on nowadays Internet), which immediately helped.
Before I make the change on our servers, I would like to understand whether I may not break something by doing so.
Thank you
Jiri Horky
Am 31.03.15 um 10:04 schrieb Jiri Horky:
Quoted 23 lines
Hi all,
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in functionstatic void tls_init_control_channel_frame_parameters(const struct frame
*data_channel_frame,
struct frame *frame)
....
/* set dynamic link MTU to minimum value */frame_set_mtu_dynamic(frame, 0,SET_MTU_TUN);We were debugging slow connection establishment on links with higher RTT (>200ms), which takes about 7seconds. We tracked the problem down to certificate handshake on a control channel, where client and server need to exchange certificates which are about 3KiB each, and because the enforced low MTU during tls init, and the fact that there are at maximum 4 unacknowledged packets on wire (
CONTROL_SEND_ACK_MAX), it takes quite a lot of round trips to transfer it (it is clearly visible in wireshark, that the openvpn fragments are exactly of 100Bytes).
Quoted 6 lines
I tried to increase the
TUN_MTU_MINto 1000 (which should be safe on nowadays Internet), which immediately helped.Before I make the change on our servers, I would like to understand whether I may not break something by doing so.
At least for IPv6 the minimum mtu of 1000 should be more than fine (IPv6 MTU MUST be at 1280).
When 56k modems were still common, they often used a MTU of 576, so for a 56k this would break.
But setting to 576 should be fine, from RFC 791:
All hosts must be prepared
to accept datagrams of up to 576 octets (whether they arrive whole or in fragments). It is recommended that hosts only send datagrams larger than 576 octets if they have assurance that the destination is prepared to accept the larger datagrams.
Arne
Quoted 37 lines · Arne Schwabe
Am 31.03.15 um 10:04 schrieb Jiri Horky:
Quoted 23 lines
Hi all,
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in functionstatic void tls_init_control_channel_frame_parameters(const struct frame
*data_channel_frame,
struct frame *frame)
....
/* set dynamic link MTU to minimum value */frame_set_mtu_dynamic(frame, 0,SET_MTU_TUN);We were debugging slow connection establishment on links with higher RTT (>200ms), which takes about 7seconds. We tracked the problem down to certificate handshake on a control channel, where client and server need to exchange certificates which are about 3KiB each, and because the enforced low MTU during tls init, and the fact that there are at maximum 4 unacknowledged packets on wire (
CONTROL_SEND_ACK_MAX), it takes quite a lot of round trips to transfer it (it is clearly visible in wireshark, that the openvpn fragments are exactly of 100Bytes).Quoted 6 lines
I tried to increase the
TUN_MTU_MINto 1000 (which should be safe on nowadays Internet), which immediately helped.Before I make the change on our servers, I would like to understand whether I may not break something by doing so.
At least for IPv6 the minimum mtu of 1000 should be more than fine (IPv6 MTU MUST be at 1280).
When 56k modems were still common, they often used a MTU of 576, so for a 56k this would break.
Quoted 7 lines
But setting to 576 should be fine, from RFC 791:
All hosts must be prepared
to accept datagrams of up to 576 octets (whether they arrive whole or in fragments). It is recommended that hosts only send datagrams larger than 576 octets if they have assurance that the destination is prepared to accept the larger datagrams.
Thanks Arne.
Actually, it should be probably set to somehow smaller value, as there is a IP/UDP + openvpn headers overhead involved. But 500 should be more than fine and it should make the connection establishment much much faster.
Quoted 13 lines
Arne
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Quoted 23 lines · Jiri Horky
Hi all,
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in functionstatic void tls_init_control_channel_frame_parameters(const struct frame
*data_channel_frame,
struct frame *frame)
....
/* set dynamic link MTU to minimum value */frame_set_mtu_dynamic(frame, 0,SET_MTU_TUN);We were debugging slow connection establishment on links with higher RTT (>200ms), which takes about 7seconds. We tracked the problem down to certificate handshake on a control channel, where client and server need to exchange certificates which are about 3KiB each, and because the enforced low MTU during tls init, and the fact that there are at maximum 4 unacknowledged packets on wire (
CONTROL_SEND_ACK_MAX), it takes quite a lot of round trips to transfer it (it is clearly visible in wireshark, that the openvpn fragments are exactly of 100Bytes).
Quoted 6 lines
I tried to increase the
TUN_MTU_MINto 1000 (which should be safe on nowadays Internet), which immediately helped.Before I make the change on our servers, I would like to understand whether I may not break something by doing so.
Just to summarize what was said on the IRC chat as well.
The frame_set_mtu_dynamic() sets the *dynamic* MTU on the *control channel*. That should never go below TUN_MTU_MIN.
It's good that you've found a potential bug, which is improved by increasing the TUN_MTU_MIN. However, I believe it is wrong to just increase that value and be happy. We need to understand better why the dynamic MTU on the control channel isn't set to a higher value in the TLS handshake process.
You mentioned you saw in your logs:
Control Channel MTU parms [ L:1558 D:138 EF:38 EB:0 ET:0 EL:0 ]
The D: field says here the dynamic MTU is starting at 138, while the L:
is the link MTU. Could you please enable debug logging and set verbosity level to 7 and see if you find any "MTU DYNAMIC mtu=" messages in your log file? That should give an indication if the dynamic MTU is changing at all.
Signature · 3 lines
kind regards, David Sommerseth
Quoted 43 lines · David Sommerseth
Quoted 23 lines · Jiri Horky
Hi all,
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in functionstatic void tls_init_control_channel_frame_parameters(const struct frame
*data_channel_frame,
struct frame *frame)
....
/* set dynamic link MTU to minimum value */frame_set_mtu_dynamic(frame, 0,SET_MTU_TUN);We were debugging slow connection establishment on links with higher RTT (>200ms), which takes about 7seconds. We tracked the problem down to certificate handshake on a control channel, where client and server need to exchange certificates which are about 3KiB each, and because the enforced low MTU during tls init, and the fact that there are at maximum 4 unacknowledged packets on wire (
CONTROL_SEND_ACK_MAX), it takes quite a lot of round trips to transfer it (it is clearly visible in wireshark, that the openvpn fragments are exactly of 100Bytes).Quoted 6 lines
I tried to increase the
TUN_MTU_MINto 1000 (which should be safe on nowadays Internet), which immediately helped.Before I make the change on our servers, I would like to understand whether I may not break something by doing so.
Just to summarize what was said on the IRC chat as well.
The
frame_set_mtu_dynamic()sets the *dynamic* MTU on the *control channel*. That should never go belowTUN_MTU_MIN.It's good that you've found a potential bug, which is improved by increasing the
TUN_MTU_MIN. However, I believe it is wrong to just increase that value and be happy. We need to understand better why the dynamic MTU on the control channel isn't set to a higher value in the TLS handshake process.You mentioned you saw in your logs:
Quoted 7 lines
Control Channel MTU parms [ L:1558 D:138 EF:38 EB:0 ET:0 EL:0 ]The D: field says here the dynamic MTU is starting at 138, while the L:
is the link MTU. Could you please enable debug logging and set verbosity level to 7 and see if you find any "MTU DYNAMIC mtu=" messages in your log file? That should give an indication if the dynamic MTU is changing at all.\
Actually, this is exactly why I am asking here - to better understand why it is enforced to MIN value in tls init.
Here is the log from client:
hotgeorge ~ # tail -n 10000 /var/log/messages | grep openvpn | grep -i MTU
<ar 31 14:42:30 hotgeorge openvpn[719]: tun_mtu = 1500 Mar 31 14:42:30 hotgeorge openvpn[719]: tun_mtu_defined = ENABLED Mar 31 14:42:30 hotgeorge openvpn[719]: link_mtu = 1500 Mar 31 14:42:30 hotgeorge openvpn[719]: link_mtu_defined = DISABLED Mar 31 14:42:30 hotgeorge openvpn[719]: tun_mtu_extra = 0 Mar 31 14:42:30 hotgeorge openvpn[719]: tun_mtu_extra_defined = DISABLED Mar 31 14:42:30 hotgeorge openvpn[719]: mtu_discover_type = -1 Mar 31 14:42:30 hotgeorge openvpn[719]: mtu_test = 0 Mar 31 14:42:30 hotgeorge openvpn[719]: MTU DYNAMIC mtu=0, flags=1, 0 -> 138 Mar 31 14:42:30 hotgeorge openvpn[719]: Control Channel MTU parms [ L:1558 D:138 EF:38 EB:0 ET:0 EL:0 ] Mar 31 14:42:30 hotgeorge openvpn[719]: MTU DYNAMIC mtu=1450, flags=2, 1558 -> 1450 Mar 31 14:42:30 hotgeorge openvpn[719]: Data Channel MTU parms [ L:1558 D:1450 EF:58 EB:135 ET:0 EL:0 AF:3/1 ] Mar 31 14:42:30 hotgeorge openvpn[719]: Local Options String: 'V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-client' Mar 31 14:42:30 hotgeorge openvpn[719]: Expected Remote Options String:
'V4,dev-type tun,link-mtu 1558,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA1,keysize 256,key-method 2,tls-server'
Jirka H.
Hi,
Quoted 3 lines · Jiri Horky
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in function
I'm not sure if you've been following the list and/or git master commits, but we have somehing in master for a while now...
commit fc91d4b0071178e298052078431fb86f03be84fc (master)
Author: Steffan Karger Date: Tue Jun 30 21:44:56 2015 +0200
Increase control channel packet size for faster handshakes
Signed-off-by: Steffan Karger <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9841
Signed-off-by: Gert Doering <[email protected]...>... and as far as we can see, this "just works" (and OpenVPN 3 on iOS and Android also uses larger packets for the control channel, so we're just following suit here).
So, if you run git master, you already have it :-) - and if you run 2.3.x, you can just cherry-pick the patch, it should apply easily.
(It will eventually hit 2.3.9 or 2.3.10, but I want to wait for a bit more feedback from the "early testers")
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi Gert,
thanks for the information. I see you effectively increased the size to 1.2k which, as far as I know, will not work for people with dial ups. Surprisingly, it seems there is still some 3% [1] of people having that type of Internet connection.
I wonder, if you considered this or not, or if there is a mean in OpenVPN code which will make OpenVPN work even in these case (without user interaction).
Regards
Jiri Horky
[1] http://time.com/3856066/aol-verizon-deal-dial-up-internet/
Quoted 35 lines · Gert Doering
Hi,
Quoted 3 lines · Jiri Horky
continuing yesterday's IRC discussion. I would like to ask whether you can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in functionI'm not sure if you've been following the list and/or git master commits, but we have somehing in master for a while now...
commit
fc91d4b0071178e298052078431fb86f03be84fc(master)Author: Steffan Karger Date: Tue Jun 30 21:44:56 2015 +0200Increase control channel packet size for faster handshakes Signed-off-by: Steffan Karger <[email protected]...> Acked-by: Gert Doering <[email protected]...> Message-Id: <[email protected]...> URL: http://article.gmane.org/gmane.network.openvpn.devel/9841 Signed-off-by: Gert Doering <[email protected]...>... and as far as we can see, this "just works" (and OpenVPN 3 on iOS and Android also uses larger packets for the control channel, so we're just following suit here).
So, if you run git master, you already have it :-) - and if you run 2.3.x, you can just cherry-pick the patch, it should apply easily.
(It will eventually hit 2.3.9 or 2.3.10, but I want to wait for a bit more feedback from the "early testers")
gert
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 24.08.2015 20:18, Gert Doering wrote:
OpenVPN Android also uses this patch (and Gert's faster connect patch) for two weeks now and bad reports about the new version (apart from a lot of broken config with extra arguments ... :( )
Arne
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
iEYEARECAAYFAlXbfzUACgkQe8+cMNS4zRf0AACcDSs8JwyWKFY2rKOHnyOint5y FyMAn1YcL7dr+bEPshPWiYyQLHzxJPOa
=WYOi
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 1 line · Gert Doering
Hi, > > On Tue, Mar 31, 2015 at 10:04:25AM +0200, Jiri Horky wrote: >>
continuing yesterday's IRC discussion. I would like to ask whether you
Quoted 2 lines
Quoted 2 lines
can think of a reason why
TUN_MTU_MINis set to only 100 bytes, and maybe more importantly, why this value is effectively enforced in
function > > I'm not sure if you've been following the list and/or git master > commits, but we have somehing in master for a while now... > > commit fc91d4b0071178e298052078431fb86f03be84fc (master) > > Author:
Steffan Karger > Date: Tue Jun 30 21:44:56 2015 +0200 > >
Increase control channel packet size for faster handshakes > >
Doering <[email protected]...> > Message-Id:
<[email protected]...> > URL:
http://article.gmane.org/gmane.network.openvpn.devel/9841 >
as we can see, this "just works" (and OpenVPN 3 on iOS > and Android also uses larger packets for the control channel, so we're > just following suit here). >
OpenVPN Android also uses this patch (and Gert's faster connect patch) for two weeks now and bad reports about the new version (apart from a lot of broken config with extra arguments ... :( )
Arne
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
iEYEARECAAYFAlXbhfkACgkQe8+cMNS4zRcDgQCgqWq2swsrCjleyNDV/5pAJFpx x5IAoM9j/ZH1Tbu3BC4GvlFbUkZU85Yn
=IRXC
-----END PGP SIGNATURE-----
Hi,
Quoted 2 lines · Jiri Horky
thanks for the information. I see you effectively increased the size to 1.2k which, as far as I know, will not work for people with dial ups.
If that wouldn't work, openvpn data transfers would not work either - but surprisingly, they do :-) - data packets are 1500+ bytes in size, unless specifically told (--link-mtu) to be smaller. We do cap the control channel MTU to a smaller value to give particularily broken setups (like, 1400 MTU *and* broken fragments) the chance to push smaller --link-mtu from the server.
"Dial-Up", per se, does not imply a smaller-than-1500 MTU - some folks do that, for "performance reasons" (reducing MTU actually reduces performance, as it increases TCP overhead, but what do I know against glossy computer magazine advice...), but even a 574 byte MTU will still work *if* fragmentation works.
Which it normally does in this combination - fragmentation tends to break if stupid NAT routers are involved, but "dialup with modem links and 574 mtu" is usually not connected to a NAT router but modem->PC...
But as I said - I'm waiting for feedback.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi Gert,
thanks for clarifying this.
Cheers
Jirka H.
Quoted 26 lines · Gert Doering
Hi,
Quoted 2 lines · Jiri Horky
thanks for the information. I see you effectively increased the size to 1.2k which, as far as I know, will not work for people with dial ups.
If that wouldn't work, openvpn data transfers would not work either - but surprisingly, they do :-) - data packets are 1500+ bytes in size, unless specifically told (--link-mtu) to be smaller. We do cap the control channel MTU to a smaller value to give particularily broken setups (like, 1400 MTU *and* broken fragments) the chance to push smaller --link-mtu from the server.
"Dial-Up", per se, does not imply a smaller-than-1500 MTU - some folks do that, for "performance reasons" (reducing MTU actually reduces performance, as it increases TCP overhead, but what do I know against glossy computer magazine advice...), but even a 574 byte MTU will still work *if* fragmentation works.
Which it normally does in this combination - fragmentation tends to break if stupid NAT routers are involved, but "dialup with modem links and 574 mtu" is usually not connected to a NAT router but
modem->PC...But as I said - I'm waiting for feedback.
gert