Tools/NetworkManager/Testing

From FedoraProject

Jump to: navigation, search

For debugging NetworkManager in a more or less clean environment, you can use the following script. It kills NetworkManager and dhclient instances, sets down eth0 and eth1, flushes global addresses and starts NetworkManager with debug saved into ~/nm.debug.

#!/bin/bash -x

NM="/opt/NetworkManager/sbin/NetworkManager"
KILL="NetworkManager dhclient"
LINKS="eth0 eth1"
DEBUG="$HOME/nm.debug"

for name in $KILL; do
	killall $name 2>/dev/null && echo "TERM: $name" && sleep 1
	killall -9 $name 2>/dev/null && echo "KILL: $name" && sleep 1
done

ps -ef | grep -iE 'network|dhc' | grep -v ' grep -iE '

for link in $LINKS; do
	ip link set $link down
done

ip address flush scope global

sleep 1

$NM --no-daemon --log-level=debug 2>$DEBUG