Re: Evolution request for managing namespaces
Roy Marples
Tue Apr 07 15:57:43 2020
On 07/04/2020 12:40, Stéphane Veyret wrote:
This might be as simple as not running the dhcpcd instance on the host in master
mode - limit it to a single interface and do the same in your containers.
You're right, but I think it is a workaround. I mean that at the
moment, almost everything is done automatically. If I only use dhcpcd
with a single named interface and I need to change my hardware and
this makes the interface name change, I will have to think that I also
need to change the way dhcpcd service is starting.
Do you think a “--nomaster” option (which would simply ignore the
socket) would be complicated to implement?
Actually yes it is complicated :)
What if you run --nomaster and there are two interfaces?
You can achieve this on linux as it stands with a simple shell script, pasted below.
Let me know how it works for you!
Roy
#!/bin/sh
list_interfaces()
{
for iface in /sys/class/net/*; do
[ -h $iface/device ] && echo ${iface##*/}
done
}
set -- $(list_interfaces)
iface=$1
if [ -n "$2" ]; then
echo "More than one physical interface found:" >&2
echo $*
exit 1
fi
if [ -z "$iface" ]; then
echo "No physical interface found" >&2
exit 1
fi
# Start dhcpcd in non master mode
echo "Starting dhcpcd on interface $iface"
dhcpcd $iface
Archive administrator: postmaster@marples.name