cyyself / wg-bench

WireGuard Benchmark using netns and iperf3
68 stars 27 forks source link

Unable to run wg-bench test on OpenWrt #31

Closed sppmasterspp closed 3 months ago

sppmasterspp commented 4 months ago

I cannot run this test on OpenWrt. I get this error https://forum.openwrt.org/t/a-wireguard-comparison-db/187586/145?u=sppmaster Additionally even after running cleanup I have this remaining. I believe it was created by the script and will disappear after reboot but I think it's better to be removed by the cleanup too. image

I've tried to run one-line script too unsuccessfully. Got this error.

root@QNAP:~# sh <(wget -O - https://raw.githubusercontent.com/cyyself/
wg-bench/master/openwrt-benchmark.sh)

Redirecting output to 'wget-log'.

Packages:
Wireguard already installed
Iperf3 already installed
ip-full already installed
kmod-veth already installed
Installed psmisc...
Installing psmisc (23.7-r1) to root...
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages/psmisc_23.7-r1_aarch64_cortex-a53.ipk
Configuring psmisc.

Routers details:
{
        "kernel": "6.6.30",
        "hostname": "QNAP",
        "system": "ARMv8 Processor rev 4",
        "model": "QNAP 301w",
        "board_name": "qnap,301w",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r26276+1-ac6cd6a535",
                "target": "qualcommax/ipq807x",
                "description": "OpenWrt SNAPSHOT r26276+1-ac6cd6a535"
        }
}
Cannot open init namespace: No such file or directory
RTNETLINK answers: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
setting the network namespace "wg-bench" failed: Invalid argument
iperf3: error - unable to connect to server - server may have stopped running or use a different port, firewall issue, etc.: Operation timed out
setting the network namespace "wg-bench" failed: Invalid argument
root@QNAP:~#

Is there a way to troubleshoot this?

cyyself commented 4 months ago

It should relate to kernel configuration changes on ipq807x target on openwrt since kernel v6.6, which may turn off something like CONFIG_NAMESPACES. I have one router with an ipq807x target. But I'm too busy these days to do this troubleshooting in person. Maybe you can have a check first.

sppmasterspp commented 4 months ago

It should relate to kernel configuration changes on ipq807x target on openwrt since kernel v6.6, which may turn off something like CONFIG_NAMESPACES. I have one router with an ipq807x target. But I'm too busy these days to do this troubleshooting in person. Maybe you can have a check first.

Will check it immediately I have a chance to do it. Thanks. @cyyself Just for reference I don't have this set in my buildconfig. # CONFIG_KERNEL_NAMESPACES is not set Maybe you are right because I ran it OK previously when I didn't touch that setting. But have to confirm this. And maybe the test can be fixed to run without it if that happens to be the reason.

cyyself commented 4 months ago

It should relate to kernel configuration changes on ipq807x target on openwrt since kernel v6.6, which may turn off something like CONFIG_NAMESPACES. I have one router with an ipq807x target. But I'm too busy these days to do this troubleshooting in person. Maybe you can have a check first.

Will check it immediately I have a chance to do it. Thanks. @cyyself Just for reference I don't have this set in my buildconfig. # CONFIG_KERNEL_NAMESPACES is not set Maybe you are right because I ran it OK previously when I didn't touch that setting. But have to confirm this. And maybe the test can be fixed to run without it if that happens to be the reason.

They may have turned off some unused config to reduce the size of the kernel. Since some routers in the ipq807x target cannot boot a fit image larger than 32MB on its factory u-boot, the size of the kernel in v6.6 increased from v6.1 and v5.15.

However, I think netns is a critical future for a router. We can do many hacky things without userspace software changes like VRF. If it doesn't increase the kernel size too much, we can have a PR to OpenWrt to enable it back.

cyyself commented 4 months ago

I ran it OK previously when I didn't touch that setting.

Oh, I missed that. So, the upstream config may work fine.

But have to confirm this. And maybe the test can be fixed to run without it if that happens to be the reason.

For this, my decision is not to fix it. Since I don't know how to prevent local loopback without neither netns nor changing the ip rules and local routing table, the ip rules and the local routing table may be hard to change after the benchmark since this script may run on many routers with complex configurations. Moreover, netns is a critical future for a router. So, there is no reason to turn it off for a standard kernel for a router. A discussion is welcomed if you have any ideas to run without it.

sppmasterspp commented 4 months ago

For this, my decision is not to fix it.

Yep, I agree there is nothing to fix. I completely confirm that the missing NETNS caused the issue. CONFIG_KERNEL_NAMESPACES is required (it has to be enabled) in order to run the wg-bench on OpenWrt. So it will be very useful to add this info to the prerequisites section for OpenWrt into the README. That should be clear enough for anyone to check the setting in OpenWrt make menuconfig. image Additionally the cleanup script doesn't remove the tmpfs as pictured in the first post. Reboot is required. Finally maybe a more clearer error message or a detection mechanism inside the script could be implemented to look for the missing (unsupported) NETNS on OpenWrt. Thanks.