Skip to content

Unnecessary network devices created #7791

Closed

Description

Version

Microsoft Windows [Version 10.0.22000.318]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1-microsoft-standard-WSL2

Distro Version

Debian GNU/Linux 11 (bullseye)

Other Software

No response

Repro Steps

Tools that show list of network interfaces discover unwanted devices: bond0, dummy0, etc

This is an unwanted side effect caused by bonding, dummy, etc being built into the kernel rather being loadable modules.
A workaround would be to add parameters to those modules to not have them create default devices.

Expected Behavior

I would expect:

$ ip -br a
lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP             192.168.126.91/20 fe80::215:5dff:feee:2fe/64

Actual Behavior

What I see when doing network device commands is.

$ ip -br a
lo               UNKNOWN        127.0.0.1/8 ::1/128
bond0            DOWN
dummy0           DOWN
tunl0@NONE       DOWN
sit0@NONE        DOWN
eth0             UP             192.168.126.91/20 fe80::215:5dff:feee:2fe/64

Diagnostic Logs

No response

Activity

  1. zer0-memory commented on Dec 3, 2021

    @zer0-memory

    This is an unwanted side effect caused by bonding, dummy, etc being built into the kernel rather being loadable modules.
    A workaround would be to add parameters to those modules to not have them create default devices.

    Do you know what settings I would have to change in the kernel to stop these from being created? I found the line in the config file to disable sit0, but I'm not sure about tunl0; I have to disable them as due to their abnormal MAC address length a program I'm using is getting a segfault since it tries reading their MAC address for license activation but tries reading beyond their length.

    Also, if you know a way to permanently set the MAC address of eth0 please let me know, its not essential but it would save me the work of creating a virtual interface and setting its MAC address to the one linked to my license key every time.

  2. Biswa96 commented on Dec 3, 2021

    @Biswa96

    Those network interfaces are enabled by default. Generally those do not interfere with eth0 or any network operations. If you want to remove those network interface you can use basic ip commands.

    sudo ip link delete dummy0
    sudo ip link delete bond0

    Or you can disable creation of dummy0 by recompiling Linux kernel with CONFIG_DUMMY disabled.

    It is possible to set a MAC address by creating a new virtual network and endpoint, detach the old one and attach the new one in WSL2.

  3. zer0-memory commented on Dec 3, 2021

    @zer0-memory

    Those network interfaces are enabled by default. Generally those do not interfere with eth0 or any network operations. If you want to remove those network interface you can use basic ip commands.

    sudo ip link delete dummy0
    sudo ip link delete bond0

    Or you can disable creation of dummy0 by recompiling Linux kernel with CONFIG_DUMMY disabled.

    It is possible to set a MAC address by creating a new virtual network and endpoint, detach the old one and attach the new one in WSL2.

    I'm only able to delete dummy0 and bond0 with ip link delete, I'm having a problem with sit0 and tunl0 though, they have the MAC address 00-00-00-00 which is an abnormal size as usually MAC addresses are in the form xx-xx-xx-xx-xx-xx; this is causing a segmentation fault on a program I'm trying to use.

    Do you know which settings I would need to disable in the kernel to disable the sit0 and tunl0 interfaces?

  4. shemminger commented on Dec 3, 2021

    @shemminger
    Author

    The root cause is that WSL kernel is monolithic and does not use kernel modules.
    Some of these drivers allow setting module parameters that might help. But these would have to go on kernel boot command line, not sure how to change that with WSL.
    Examples:

    • bonding.max_bonds=0
    • dummy.numdummies=0
    • fb_tunnels=2

    The first tells bonding not to make any devices by default. Second does same for dummy device.
    The last does:

    Controls if fallback tunnels (like tunl0, gre0, gretap0, erspan0,
    sit0, ip6tnl0, ip6gre0) are automatically created. There are 3 possibilities
    (a) value = 0; respective fallback tunnels are created when module is
    loaded in every net namespaces (backward compatible behavior).
    (b) value = 1; [kcmd value: initns] respective fallback tunnels are
    created only in init net namespace and every other net namespace will
    not have them.
    (c) value = 2; [kcmd value: none] fallback tunnels are not created
    when a module is loaded in any of the net namespace. Setting value to
    "2" is pointless after boot if these modules are built-in, so there is
    a kernel command-line option that can change this default. Please refer to
    Documentation/admin-guide/kernel-parameters.txt for additional details.
    
  5. Biswa96 commented on Dec 3, 2021

    @Biswa96

    Linux kernel command line options can be added in .wslconfig file. Create a .wslconfig file in %UserProfile% directory and add the lines like this

    [wsl2]
    kernelCommandLine = bonding.max_bonds=0 dummy.numdummies=0 fb_tunnels=2

    Run wsl.exe --shutdown to forcefully shutdown WSL2 VM and re-run the Linux distribution in WSL2.

  6. zer0-memory commented on Dec 5, 2021

    @zer0-memory

    Linux kernel command line options can be added in .wslconfig file. Create a .wslconfig file in %UserProfile% directory and add the lines like this

    [wsl2]
    kernelCommandLine = bonding.max_bonds=0 dummy.numdummies=0 fb_tunnels=2

    Run wsl.exe --shutdown to forcefully shutdown WSL2 VM and re-run the Linux distribution in WSL2.

    This removed the dummy0 and bond0 interfaces for me, but sit0 and tunl0 are still there. Are there any other settings that are needed to remove those?

  7. Biswa96 commented on Dec 5, 2021

    @Biswa96

    but sit0 and tunl0 are still there.

    Those do not have any MAC address.

    it tries reading their MAC address for license activation but tries reading beyond their length.

    Wait a second! It seems that the issue is with that software. Why does a software (or a spyware) scan all available network interfaces?

    I'm having a problem with sit0 and tunl0 though, they have the MAC address 00-00-00-00

    They don't have MAC address. Only bond0 and dummy0 have MAC address which are in valid format always.

  8. zer0-memory commented on Dec 5, 2021

    @zer0-memory

    but sit0 and tunl0 are still there.

    Those do not have any MAC address.

    it tries reading their MAC address for license activation but tries reading beyond their length.

    Wait a second! It seems that the issue is with that software. Why does a software (or a spyware) scan all available network interfaces?

    I'm having a problem with sit0 and tunl0 though, they have the MAC address 00-00-00-00

    They don't have MAC address. Only bond0 and dummy0 have MAC address which are in valid format always.

    It reads them for licensing purposes; this is the last few lines of the strace output from the application:

    ioctl(3, SIOCGIFHWADDR, {ifr_name="lo", ifr_hwaddr={sa_family=ARPHRD_LOOPBACK, sa_data=00:00:00:00:00:00}}) = 0
    ioctl(3, SIOCGIFHWADDR, {ifr_name="eth0", ifr_hwaddr={sa_family=ARPHRD_ETHER, sa_data=00:15:5d:55:c2:20}}) = 0
    ioctl(3, SIOCGIFHWADDR, {ifr_name="tunl0", ifr_hwaddr={sa_family=ARPHRD_TUNNEL, sa_data=00:00:00:00}}) = 0
    ioctl(3, SIOCGIFHWADDR, {ifr_name="sit0", ifr_hwaddr={sa_family=ARPHRD_SIT, sa_data=00:00:00:00}}) = 0
    read(4, "", 1024)                       = 0
    --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffffff600400} ---
    +++ killed by SIGSEGV +++
    Segmentation fault
    
    

    Is there something I can change in the config-wsl file for the kernel to remove these interfaces? I tried turning off CONFIG_NET_IPIP and CONFIG_IPV6_SIT but I get errors while compiling the kernel with those settings.

  9. shemminger commented on Dec 6, 2021

    @shemminger
    Author

    This is workaround that worked for me

    kernelCommandLine = bonding.max_bonds=0 dummy.numdummies=0 fb_tunnels=none
    

    Any license code that reads list of available network devices is broken. There is no way to be sure network device MAC address is not changed or will be the same under a whole range of scenarios.

    One could argue all DRM code is fundamentally flawed.

  10. benhillis commented on Dec 6, 2021

    @benhillis
    Member

    This is not an area I'm very experienced in, what would the implications be of setting max_bonds, numdummies, and fb_tunnels to zero / none? Would this break any existing workflow?

  11. shemminger commented on Dec 6, 2021

    @shemminger
    Author

    I doubt it would cause problems, these default devices are a legacy thing from early days of Linux (like 10+ yrs ago).
    Earlier versions of WSL kernel did not appear to have this.

  12. benhillis commented on Dec 6, 2021

    @benhillis
    Member

    Stephen Hemminger (@shemminger) - thanks for the context - I'll see if I can figure out why these got added.

  13. zer0-memory commented on Dec 8, 2021

    @zer0-memory

    I

    This is workaround that worked for me

    kernelCommandLine = bonding.max_bonds=0 dummy.numdummies=0 fb_tunnels=none
    

    Any license code that reads list of available network devices is broken. There is no way to be sure network device MAC address is not changed or will be the same under a whole range of scenarios.

    One could argue all DRM code is fundamentally flawed.

    I fixed my segfault, turned out that it wasn't caused by the extra network devices; I fixed it by adding "vsyscall=emulate" to my kernelCommandLine.

    For keeping the same MAC address, I ran echo "ip link set dev dummy0 address <mac address here>" >> ~/.bashrc to set the MAC address of the dummy0 interface to the one linked to my license every time WSL starts.

  14. romarowski commented on Apr 18, 2023

    @romarowski

    how would you go about recovering these extra networks if they suddenly disappeared?

  15. shemminger commented on Apr 18, 2023

    @shemminger
    Author

    These devices are not useful or used. Modern Linux distros handle device management using network manager or related infrastructure.

  16. romarowski commented on Apr 18, 2023

    @romarowski

    ok, but I need bond0 to verify my MATLAB license,

  17. zer0-memory commented on Apr 18, 2023

    @zer0-memory

    ok, but I need bond0 to verify my MATLAB license,

    Same here

  18. shemminger commented on Apr 18, 2023

    @shemminger
    Author

    Then make a dummy bond device with command line or with /etc/network/interfaces.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions