]> Cypherpunks.ru repositories - govpn.git/commitdiff
[DOC] What MTU is and how it is calculated
authorSergey Matveev <stargrave@stargrave.org>
Fri, 1 May 2015 16:58:17 +0000 (19:58 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 1 May 2015 16:58:17 +0000 (19:58 +0300)
Signed-off-by: Sergey Matveev <stargrave@stargrave.org>
cmd/govpn-client/main.go
cmd/govpn-server/main.go
doc/user.texi

index c4b4fe440842365309ad99054bc40aca9a80e106..6b7fac1307e8ba576c08a8aa35b90d8b4ea77017 100644 (file)
@@ -37,7 +37,7 @@ var (
        upPath     = flag.String("up", "", "Path to up-script")
        downPath   = flag.String("down", "", "Path to down-script")
        stats      = flag.String("stats", "", "Enable stats retrieving on host:port")
-       mtu        = flag.Int("mtu", 1500, "MTU")
+       mtu        = flag.Int("mtu", 1452, "MTU for outgoing packets")
        nonceDiff  = flag.Int("noncediff", 1, "Allow nonce difference")
        timeoutP   = flag.Int("timeout", 60, "Timeout seconds")
 )
@@ -87,6 +87,7 @@ func main() {
        knownPeers := govpn.KnownPeers(map[string]**govpn.Peer{remote.String(): &peer})
 
        log.Println(govpn.VersionGet())
+       log.Println("Max MTU on TAP interface:", govpn.TAPMaxMTU())
        if *stats != "" {
                log.Println("Stats are going to listen on", *stats)
                statsPort, err := net.Listen("tcp", *stats)
index cfcc45f4dee61a628cc1578a9af5d0f356b55b42..43c2722dbd4e6852f32709e634eecb151113b104 100644 (file)
@@ -36,7 +36,7 @@ var (
        bindAddr  = flag.String("bind", "[::]:1194", "Bind to address")
        peersPath = flag.String("peers", "peers", "Path to peers keys directory")
        stats     = flag.String("stats", "", "Enable stats retrieving on host:port")
-       mtu       = flag.Int("mtu", 1500, "MTU")
+       mtu       = flag.Int("mtu", 1452, "MTU for outgoing packets")
        nonceDiff = flag.Int("noncediff", 1, "Allow nonce difference")
        timeoutP  = flag.Int("timeout", 60, "Timeout seconds")
 )
@@ -121,6 +121,7 @@ func main() {
        ethSink := make(chan EthEvent)
 
        log.Println(govpn.VersionGet())
+       log.Println("Max MTU on TAP interface:", govpn.TAPMaxMTU())
        if *stats != "" {
                log.Println("Stats are going to listen on", *stats)
                statsPort, err := net.Listen("tcp", *stats)
index d2bc984635b43d7922a3b72401459cdaac855267..5f3bd59d5f38bbb9286223d0228b3c13d43e6fd6 100644 (file)
@@ -22,8 +22,12 @@ replayed ones. This option gives ability to create some window of
 allowable difference. That opens the door for replay attacks for narrow
 time interval.
 @item MTU
-Maximum transmission unit, maximum frame size that is acceptable on TAP
-interface.
+Maximum transmission unit for outgoing GoVPN's packets. It varies and
+depends on your environment. By default MTU equals to 1452 bytes: 40
+bytes per IPv6 and 8 bytes per UDP. So GoVPN's packets won't be larger
+than this value. It will print maximum acceptable value for TAP
+interface during startup. As a rule TAP's MTU is 42 bytes smaller: 26
+bytes overheard for transport message, 14 bytes Ethernet frame overhead.
 @end table
 
 Client needs to know his identification, path to the authentication key,
@@ -82,7 +86,7 @@ GNU/Linux IPv4 client-server example:
 server% echo "echo tap10" >> peers/CLIENTID/up.sh
 server% ip addr add 192.168.0.1/24 dev wlan0
 server% tunctl -t tap10
-server% ip link set mtu 1462 dev tap10
+server% ip link set mtu 1412 dev tap10
 server% ip addr add 172.16.0.1/24 dev tap10
 server% ip link set up dev tap10
 server% GOMAXPROC=4 govpn-server -bind 192.168.0.1:1194
@@ -93,7 +97,7 @@ client% umask 066
 client% echo MYLONG64HEXKEY > key.txt
 client% ip addr add 192.168.0.2/24 dev wlan0
 client% tunctl -t tap10
-client% ip link set mtu 1462 dev tap10
+client% ip link set mtu 1412 dev tap10
 client% ip addr add 172.16.0.2/24 dev tap10
 client% ip link set up dev tap10
 client% ip route add default via 172.16.0.1
@@ -110,7 +114,7 @@ FreeBSD IPv6 client-server example, with stats enabled on the server
 server% cat > peers/CLIENTID/up.sh <<EOF
 #!/bin/sh
 $tap=$(ifconfig tap create)
-ifconfig $tap inet6 fc00::1/96 mtu 1462 up
+ifconfig $tap inet6 fc00::1/96 mtu 1412 up
 echo $tap
 EOF
 server% ifconfig em0 inet6 fe80::1/64
@@ -120,7 +124,7 @@ server% GOMAXPROC=4 govpn-server -bind fe80::1%em0 -stats [::1]:5678
 @example
 client% ifconfig me0 inet6 -ifdisabled auto_linklocal
 client% ifconfig tap10
-client% ifconfig tap10 inet6 fc00::2/96 mtu 1462 up
+client% ifconfig tap10 inet6 fc00::2/96 mtu 1412 up
 client% route -6 add default fc00::1
 client% export GOMAXPROC=4
 client% while :; do