Skip to content

Instantly share code, notes, and snippets.

@madkoding
Last active December 10, 2023 20:56
Show Gist options
  • Save madkoding/15e58a2530b2c6daf08894e7238ca19e to your computer and use it in GitHub Desktop.
Save madkoding/15e58a2530b2c6daf08894e7238ca19e to your computer and use it in GitHub Desktop.
Fix Hyper-V UDP packet loss in linux (Minecraft Bedrock server issues)

Persistent Disabling of TCP/UDP Checksum Offloading in a Virtual Machine

This guide provides a method to persistently disable TCP/UDP checksum offloading on eth0 in a virtual machine, ensuring the changes remain effective even after a reboot. (Usually to fix issues for Minecraft Bedrock Server)

Steps

1. Install ethtool

First, ensure that ethtool is installed. If it's not installed, you can install it using the following command:

sudo apt-get install -y ethtool

2. Disable Checksum Offloading

Run the following command to disable TCP/UDP checksum offloading on eth0:

sudo ethtool -K eth0 tx off

3. Create a Startup Script

To make this change persistent across reboots, create a script that will run at startup:

Create the Script

SCRIPT_PATH="/etc/network/if-up.d/disable-checksum-offload"

cat << EOF | sudo tee "$SCRIPT_PATH"
#!/bin/sh
ethtool -K eth0 tx off
EOF

Make the Script Executable

Change the script's permissions to make it executable:

sudo chmod +x "$SCRIPT_PATH"

4. Verify

After rebooting your virtual machine, the script will automatically run, disabling the checksum offloading on eth0.

With these steps, you have successfully set up your virtual machine to persistently disable TCP/UDP checksum offloading on eth0, ensuring that this configuration persists across reboots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment