From b334dbf2c624302a4188c2e27dea42481e039259 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adri=C3=A1n=20Ro=C5=A1inec?= <rosinec@ics.muni.cz>
Date: Fri, 2 Dec 2022 13:00:47 +0100
Subject: [PATCH] MTU details

---
 content/cloud/faq/index.md | 42 ++++++++++++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/content/cloud/faq/index.md b/content/cloud/faq/index.md
index 89ee757..c4a4053 100644
--- a/content/cloud/faq/index.md
+++ b/content/cloud/faq/index.md
@@ -40,10 +40,44 @@ Furthermore, IP addresses allocated from *public-muni-147-251-124-GROUP* and *pu
 using only *public-cesnet-78-128-251-GROUP* and *private-muni-10-16-116* for group projects.
 Follow instructions at [changing the external network](/cloud/network) in order to change your public network.
 
-## Issues with network stability in Docker
-OpenStack instances use 1442 bytes MTU (maximum transmission unit) instead of standard 1500 bytes MTU. The instance itself can set up correct MTU with its counterpart via Path MTU Discovery. Docker needs MTU set up explicitly. Refer documentation for setting up
-1442 MTU in [Docker](https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/) or
-[Kubernetes](https://docs.projectcalico.org/v3.5/usage/configuration/mtu).
+## Issues with network MTU (Docker, kubernetes, custom network overlays)
+OpenStack compute server instances should use 1442 bytes MTU (maximum transmission unit) instead of the standard 1500 bytes MTU. The instance itself can set up the correct MTU with its counterpart via Path MTU Discovery. Docker needs MTU set up explicitly. Refer documentation for setting up 1442 MTU in [Docker](https://docs.docker.com/v17.09/engine/userguide/networking/default_network/custom-docker0/) or [Kubernetes](https://docs.projectcalico.org/v3.5/usage/configuration/mtu) or change the configuration with the steps below.
+
+### Changes in Docker daemon
+```sh
+# edit docker configuration
+sudo vi /etc/docker/daemon.json
+
+# MTU 1442 or lower
+{
+  "mtu": 1442
+}
+
+# then restart docker
+sudo systemctl restart docker
+```
+
+### MTU detection
+You can use following bash function to detect end-to-end maximum packet size without packet fragmentation.
+
+```sh
+# detect_mtu <host>
+#   measure end-to-end MTU
+function detect_mtu() {
+  local endpoint_host="$1"
+  
+  for i_mtu in `seq 1200 20 1500` `seq 1500 50 9000`; do
+    if ping -M do -s $(( $i_mtu - 28 )) -c 5 "${endpoint_host}" >/dev/null; then
+      echo "Packets of size ${i_mtu} work as expected"
+    else
+      echo "Packets of size ${i_mtu} are blocked by MTU limit on the path to destination host ${endpoint_host}!"
+      break
+    fi
+  done
+}
+# execute
+detect_mtu www.nic.cz
+```    
 
 ## Issues with proxy in private networks
 OpenStack instances can either use public or private networks. If you are using a private network and you need to access the internet for updates etc.,
-- 
GitLab