Closed EvanGoss closed 4 years ago
Yes, the setup_interfaces.sh
script does assign each interface to its own network namespace, however I have added a step to the script (after the main interface configuration loop) that checks to see if there are any interfaces assigned to the root network namespace. If there are none, the script moves the test execution interface to the root network namespace. The user is notified via a message if this is being done.
Having an interface in the root network namespace is useful for a couple of reasons; aside from providing an interface for the various dashboard web page related services to bind to, it provides network connectivity for additional services outside the scope of the project that users may wish to run on the same Raspberry Pi (e.g. Pi-hole).
Here's the relevant bit of code from the revised setup_interfaces.sh
script:
###### Check for interfaces in the root network namespace. If there are none, move the test execution interface to it.
# This will provide a network interface for services that need a network connection (e.g. the dashboard application).
root_ns_if_name=""
for s in "${selected[@]}"
do
if [[ "${interface_namespaces[$s]}" == "root" ]]; then
root_ns_if_name="$s"
break
fi
done
if [[ "$root_ns_if_name" == "" ]]; then
whiptail --title "$TITLE" --msgbox "There are no network interfaces assigned to the root network namespace.\nThe test exectution interface $test_execution_interface will be moved to the root network namespace." 10 80 3>&1 1>&2 2>&3
interface_namespaces["$test_execution_interface"]="root"
fi
Accessing the Dashboard web page says:
Aren't non-root namespaces typically applied to all interfaces when
setup_interfaces.sh
is run? I've got 2 interfaces dedicated to the bandwidth monitor, 1 for 2.4Ghz monitoring (ns_wlan0), and 1 for test execution, all of which have non-root namespaces.