Running Linux Server in Network Namespace

Hi,

I'm trying to run a Linux VH server on an embedded ARM64 target, however the target's physical interfaces are bound by a virtual bridge, meaning they cannot be used by userspace applications like the VHUSB server. 

Prior to using VH, the solution has been to create a separate network namespace and a virtual ethernet pair between the bridge and the namespace (convoluted, I know), and then run needed daemons and services from within the context of the namespace using ip netns exec <network_namespace> <script or binary to execute>. This allows devices connected to either end of the bridged physical interfaces to interact with processes running on the embedded target. 

Trying to run the VH server daemon in this manner results in a "Failed to load serial number" error like so:

LOG_INFO    >>> Starting VirtualHere USB Server v4.6.4 (Built: Apr  5 2024, 10:14:47)<<<
LOG_INFO    Using configuration /etc/virtualhere/config.ini
LOG_ERR     Failed to load serial number
LOG_INFO    >>> Shutdown <<<
If the daemon is started outside of the network namespace, it runs just fine however no external devices can connect to it due to the virtual bridge. If the virtual bridge is removed and the daemon is started outside of the network namespace, it works perfectly, however in this scenario the two networks connected to either of the embedded device's physical interfaces are isolated, which is unfortunately not an option as I need them to be connected to eachother.

So my question is: Is it possible to run the VH server from within a network namespace? I had a look on the forums and can see that it can't be run from within a VM which makes sense, however the network namespace is not a VM and the daemon has access to the embedded device's physical hardware from within the namespace, so it should be possible, right?

Any assistance would be greatly appreciated.

#2

Is there anything in /sys/class/net ?

#3

The contents of /sys/class/net varies depending on whether you are inside or outside of the namespace. Outside of the namespace it contains the two physical interfaces, the bridge, and one of the virtual interfaces: eth0 eth1 br0 veth0. Inside of the namespace, there is only the other "end" of the virtual interface - veth1

#4

Can you post cat /proc/cpuinfo

#5

Output is the same regardless of whether we are looking from inside or outside of the network namespace. It's a 4-core Arm Cortex A53 if that helps.

 

processor       : 0
BogoMIPS        : 16.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
BogoMIPS        : 16.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
BogoMIPS        : 16.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
BogoMIPS        : 16.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

 

#6

What is the contents of /sys/class/net/veth1/address ? Can you pass through the host MAC?

#7

The veth1 MAC is 66:26:99:01:8d:b1. What do you mean by pass through the host MAC? Spoof one of the ethX MACs on the veth1 interface?

#8

I found the bug. Give this version a test and see how it goes.

#9

Thanks for working so promptly on this, Michael. Much appreciated!

Unfortunately we now have a slightly different but likely related error:

LOG_INFO    >>> Starting VirtualHere USB Server v4.6.4 (Built: Apr 30 2024, 17:07:24)<<<
LOG_INFO    Using configuration /etc/virtualhere/config.ini
LOG_INFO    Server licensed to=unlicensed max_devices=1
LOG_INFO    Using large URB's
LOG_ERR     Error 'Name has no usable address' (101) calling getaddrinfo for (null):7575
LOG_ERR     Error starting server
LOG_INFO    >>> Shutdown <<<

#10

Im not sure unfortunately, the server is calling getaddrinfo to find an available interface to listen to TCP messages on and its returning that error. I dont know what that error exactly means.