# How to set MTU size in Linux and Windows > [!NOTE] > **WHAT TO EXPECT** > > **In this article**, users will learn how to choose an MTU size for a cloudSwXtch deployment, how to confirm that MTU is the cause of a problem, and how to change the MTU size on a Linux or Windows VM. Multicast streams often use packets larger than the operating system's default MTU of 1500 bytes. Other deployments need a deliberately smaller MTU. Either way, the value has to be chosen with the swXtch overhead in mind and applied consistently, because MTU is a property of every interface and every network segment the traffic crosses — not of the stream itself. ### MTU must be consistent across the whole path cloudSwXtch carries your multicast as UDP between the xNIC and the cloudSwXtch. Two facts drive every MTU decision: - **The smallest MTU on the path governs the whole stream.** A packet too large for any single hop is dropped at that hop. Path MTU Discovery does not apply to UDP multicast, so nothing negotiates a smaller size on your behalf, and nothing reports the failure back to the sender. The stream simply loses packets, or never arrives at all. - **swXtch encapsulation makes your usable payload smaller than the MTU.** The cloudSwXtch and the xNIC add their own header to every packet, so set the MTU **32 bytes above** the largest packet the application sends — to send a 1500-byte packet, set the MTU to 1532. An interface sized at exactly the application's packet size will drop traffic even though the two numbers appear to match. The largest packet the cloudSwXtch carries is 9216 bytes of IPv4 (9188 bytes of UDP payload). An MTU above 9216 + 32 gains nothing. #### Check every segment, not only the endpoints Before deployment, walk the full path a multicast packet takes and record the MTU of each element: | Segment | What to check | | --- | --- | | Application | The datagram size the application actually sends (payload plus IP and UDP headers) | | Endpoint NIC | The data interface on every producer and consumer, and `swx0` on xNIC Type 1 and Type 3 endpoints | | Kubernetes | The pod / CNI interface MTU, which is frequently lower than the node's | | cloudSwXtch | Both interfaces — control and data | | Cloud subnet | The MTU supported by that VNet or VPC and by the instance type in use | | Peering and gateways | VNet peering, VPN gateways, ExpressRoute / Direct Connect / Cloud Interconnect, transit and local gateways. Tunnelled paths commonly clamp well below 1500 | | Inline appliances | Firewalls and NVAs reached through a route table or UDR, NAT devices, load balancers | | swXtchBridge and on-premises | The bridge host, and the physical switches and routers between it and your on-premises endpoints | #### Then apply two rules 1. **Make every element agree.** Set the same MTU everywhere, or at minimum confirm that no element on the path is lower than the value you have chosen. 2. **Leave headroom — do not plan to use the whole MTU.** The 32 bytes are swXtch's own overhead and nothing else. Tunnels, overlays and encryption on any segment consume more, and a single cloud gateway can reduce the effective MTU by a few hundred bytes. Size the application's packets comfortably below the lowest MTU on the path rather than right at it, and re-check the path whenever the network changes: a new firewall, a new peering or a VPN cutover can shrink the path MTU with no change at all inside cloudSwXtch. ### How to tell whether MTU is the problem Suspect MTU when the endpoints are registered, and the multicast group is visible in `swx-top`, but the consumer receives nothing or shows a steady, non-zero missing count — and above all when the loss depends on packet size. #### Test with smaller packets The fastest test. Send the same stream at a small packet size, for example, 512 bytes. If the stream is clean when small and lossy at full size, the problem is MTU somewhere on the path, not throughput. #### Send a maximum-size packet with fragmentation forbidden From an endpoint, on Linux: ```shell ping -M do -s 1472 ``` On Windows: ```powershell ping -f -l 1472 ``` 1472 = 1500 − 28 bytes of IP and ICMP header; adjust the value for the MTU being tested. If the command reports that the packet needs to be fragmented, an element on the path is smaller than expected. > [!WARNING] > **NOTE** > > This tests the unicast ICMP path. Inline appliances may treat multicast UDP differently, so a successful `ping` is necessary but not sufficient. #### Capture the traffic Wireshark or tcpdump will show where packets stop arriving. Capture at successive points along the path and look for UDP length errors, as in the example below. ![MTU Size_discovery](../../assets/document360/3a5a314a28-mtu-size-discovery.png) > [!WARNING] > **NOTE** > > In this capture, Wireshark flags a UDP length error — a strong indication that the datagram is larger than some element on the path accepts. ### Change MTU size on Linux 1. First, **check** the current MTU size by running the following command: ```shell ip addr | grep mtu ``` ## Example output ```shell $ ip addr | grep mtu 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 3: eth1: mtu 3900 qdisc mq state UP group default qlen 1000 4: enP15351s2: mtu 3900 qdisc mq master eth1 state UP group default qlen 1000 5: enP9096s1: mtu 1500 qdisc mq master eth0 state UP group default qlen 1000 6: swx0: mtu 4096 qdisc mq state UNKNOWN group default qlen 10000 ``` As can be seen, the MTU size of `eth1` is 3900. Note also that the interfaces do not all agree: `eth0` is at 1500 while `eth1` is at 3900. Make sure the interface being changed is the one the multicast traffic actually uses, and that its accelerated-networking slave interface (`enP…`) follows it. 2. To TEMPORARILY change the MTU size, use: ```shell sudo ip link set dev mtu ``` This will last until the next reboot. ## Example command ```shell sudo ip link set dev eth1 mtu 2000 ``` The command will not give any output if correctly executed. So, it is recommended to validate with the command used in step 1. 3. **Validate** the change is set by running again: ```shell ip addr | grep mtu ``` ## Example output ```shell $ ip addr | grep mtu 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 3: eth1: mtu 2000 qdisc mq state UP group default qlen 1000 4: enP15351s2: mtu 2000 qdisc mq master eth1 state UP group default qlen 1000 5: enP9096s1: mtu 1500 qdisc mq master eth0 state UP group default qlen 1000 6: swx0: mtu 4096 qdisc mq state UNKNOWN group default qlen 10000 ``` As can be seen, the MTU size of eth1 is now 2000. > [!NOTE] > **PLEASE NOTE** > > For permanent changes, the procedure will vary depending on the Linux distro (roughly, RHEL-based or Debian-based), and the network manager used (like `netplan` on Debian-based and `nmcli` or `ifcfg` for RHEL-based). Please consult the network admin to get directives. ### Change MTU size on Windows #### Using PowerShell 1. **Check** the current InterfaceAlias and the MTU size by running: ```powershell Get-NetIPInterface -AddressFamily IPv4 ``` ## Example output ```powershell PS C:\Windows\System32> Get-NetIPInterface -AddressFamily IPv4 ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore ------- -------------- ------------- ------------ --------------- ---- --------------- ----------- 12 Local Area Connection* 4 IPv4 1500 25 Disabled Disconnected ActiveStore 18 Local Area Connection* 3 IPv4 1500 25 Enabled Disconnected ActiveStore 1 Loopback Pseudo-Interface 1 IPv4 4294967295 75 Disabled Connected ActiveStore ``` As can be seen, the MTU size of the local adapters (Local Area Connection\* X) is 1500. 2. **Set** the MTU Size using the following commands: ```powershell Set-NetIPInterface -InterfaceAlias "Interface Name" -NlMtuBytes ``` Where “Interface Name” is the InterfaceAlias of the Ethernet adapter to be set. Note that a successfully executed command won’t give any output. 3. **Validate** the MTU by running the same command used in step 1. #### Using Configuration 1. **Go** to the Network connection → “Control Panel\Network and Internet\Network Connections” ![MTU Size_windows set 2](../../assets/document360/6722e8007a-mtu-size-windows-set-2.png) 2. **Right-click** on the Ethernet adapter that the traffic is expected on and select Properties. ![MTU Size_windows set 3](../../assets/document360/42429dc97b-mtu-size-windows-set-3.png) 3. **Select** “Configure” ![MTU Size_windows set 4](../../assets/document360/933148271c-mtu-size-windows-set-4.png) 4. **Go** to Advanced, look for and select "Jumbo Packet": ![MTU Size_windows set 5](../../assets/document360/68681d764f-mtu-size-windows-set-5.png) 5. **Select** the desired size, for example "4088 Bytes", then select "OK". ![MTU Size_windows set 6](../../assets/document360/d4da8d8a78-mtu-size-windows-set-6.png) 6. In order to validate the changes, **use** PowerShell as explained above > [!WARNING] > **NOTE** > > On Windows, the adapter's **Jumbo Packet** setting and the IP interface MTU (`NlMtuBytes`) are two separate values. An MTU above 1500 will not take effect unless the adapter also has Jumbo Packet enabled at an equal or larger size, and some virtual adapters do not expose the option at all. After changing either one, always validate with `Get-NetIPInterface`.