Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: network problem: packet loss #1070

Open
q-hp-true opened this issue Feb 28, 2025 · 6 comments
Open

[Bug]: network problem: packet loss #1070

q-hp-true opened this issue Feb 28, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@q-hp-true
Copy link

Operating system

kubernetes1.27

Description

When I deploy the project in k8s, some network problem occur.
I find the author says that the packet loss bugs has been fixed due to calico mtu different from windows.
but the situation happens agin.

My physical network adapter mtu is 1500
My calico mtu is 1480

in the windows container, the mtu of adapter "dockerbridge" is 1500, and the other adapter mtu is 1480.
I try to change the mtu in windows container by ip link set xxx mtu xxx and restart the adpapter. the network problem of packet loss again. such as I can't access the internet or the internet connection is too slow.

Docker compose

apiVersion: v1
kind: Pod
metadata:
name: windows
labels:
name: windows
spec:
containers:

  • name: windows
    image: dockurr/windows
    env:
    • name: VERSION
      value: "11"
    • name: RAM_SIZE
      value: "4G"
    • name: CPU_CORES
      value: "2"
    • name: DISK_SIZE
      value: "64G"
      ports:
    • containerPort: 8006
    • containerPort: 3389
    • containerPort: 3389
      protocol: UDP
      securityContext:
      capabilities:
      add:
      • NET_ADMIN
        privileged: true
        volumeMounts:
    • mountPath: /storage
      name: storage
    • mountPath: /dev/kvm
      name: dev-kvm
    • mountPath: /dev/net/tun
      name: dev-tun
      terminationGracePeriodSeconds: 120
      volumes:
  • name: storage
    persistentVolumeClaim:
    claimName: windows-pvc
  • hostPath:
    path: /dev/kvm
    name: dev-kvm
  • hostPath:
    path: /dev/net/tun
    type: CharDevice
    name: dev-tun

Docker log

No logs. but I found the packet when I use wireshark analysis the data captured by tcpdump.

Screenshots (optional)

No response

@q-hp-true q-hp-true added the bug Something isn't working label Feb 28, 2025
@q-hp-true
Copy link
Author

@kroese
Sir, can you give me some advices ? I try a lot to slove the problem, but useless.
Thanks a lot .

@kroese
Copy link
Contributor

kroese commented Mar 1, 2025

I have no clue, sorry. I never used Kubernetes myself.

@q-hp-true
Copy link
Author

Thanks for your reply. I resolve it by set mtu 1480 in windows rather than pod.
The mtu shoud be 20 less than physical interfaces due to calico rules in Kubernetes, however, It's useless when you set mtu in pod.

@kroese
Copy link
Contributor

kroese commented Mar 3, 2025

@q-hp-true Very interesting info. I just discovered I can configure the MTU for the network adaptor by setting host_mtu=xx in the QEMU parameters. So I can easily make an extra variable called "MTU": 1480 so you can set the value in your compose file.

The advantage is that you dont have to configure it in Windows anymore, but we can include that setting in the example kubernetes file.

This would solve the problem for other people in the future. But an even better solution is to detect the MTU value from the bridge interface automaticly, and set the same value for MTU. That way people dont even have to specify it in their kubernetes file, because it will automaticly match.

However, I have no Kubernet environment to test this. So can you please execute:

cat /sys/class/net/dockerbridge/mtu

and

cat /sys/class/net/net0/mtu

from inside the container and tell me what you get?

@kroese kroese reopened this Mar 3, 2025
@q-hp-true
Copy link
Author

Image
The problem is that I set mtu before in this pod and it's useless, but I use the command "ip link set xxx mtu ... ip link set xxx up/down"
So I set mtu in windows today and the packet packet loss problem solved !

@kroese
Copy link
Contributor

kroese commented Mar 3, 2025

Okay based on your help I created a new version of the container (v4.17), which should automaticly detect the correct MTU and configure it in Windows WITHOUT you manually changing it in Windows yourself.

So if you have the time, please test if you do fresh installation of Windows with v4.17 and not change anything, it will work without the packetloss issue now. Then we know for certain that its fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants