As of now, putting in a value for network-namespaces does not actually create the namespace or move the interface to that namespace. It simply informs the 128T fastLane process what network-namespace it should look in to check for link status on the kni interface. The work of creating the namespace and moving the interface should be handled by creating an init script using the network plugin infrastructure. The name of the namespace in the configuration will also be passed as the second option to the init script.
Furthermore, the namespace needs to be created with an NSID. There are functions that should be leveraged in the init scripts that can be found in /etc/128technology/plugins/network-scripts/common/namespace_helpers.
Here is an example init script to setup and move an interface to a namespace
#!/bin/bash
KNI_NAME=$1
NS=$2
# Import common functions related to namespace operations
source /etc/128technology/plugins/network-scripts/common/namespace_helpers
source /etc/sysconfig/network-scripts/ifcfg-$1
# create namespace if it doesn't exist
if [ ! -e "/var/run/netns/$NS" ]; then
echo "$NS namespace does not exist...creating it."
create_namespace $NS
ip netns exec $NS ip link set lo up
echo "NS created."
echo "Setting ip_forwarding in namespace $NS."
ip netns exec $NS sysctl -w net.ipv4.ip_forward=1
fi
# set up KNI if it exists in the default namespace
if [ -d "/sys/devices/virtual/net/$KNI_NAME" ]; then
echo "$KNI_NAME found in default namespace."
echo "Moving $KNI_NAME to $NS namespace."
ip link set $KNI_NAME netns $NS
ip netns exec $NS ip a add $IPADDR/$PREFIX dev $KNI_NAME
ip netns exec $NS ip l set $KNI_NAME up
fi
------------------------------
Lane Shields
Sales Engineer
GA
------------------------------
Original Message:
Sent: 01-05-2019 14:06
From: Reid Stidolph
Subject: Using the network-namespace setting on a device-interface
Question about the `network-namespace` setting on a `host` device interface: If I specify a pre-existing ns name here, what should I expect 128T to do when it adds the KNI? Will it place the interface in the specified namespace automatically, or will I need to move it there with a plugin network-script? Currently I'm seeing that I need to move it into the ns I configure myself. Perhaps the intention of this setting is that 128T would create the namespace, and it wouldn't pre-exist?
Any clarification on how this is supposed to work would be appreciated.
------------------------------
- Reid
------------------------------