Thursday, April 4, 2013

openSUSE; disable ifup networkmanager checking

So you are running KVM or maybe you just want to run some fancy networking beyond what networkmanager can do in openSUSE then you have noticed that you get a message similar to the below.
# ifup virbr1.300
Network is managed by 'NetworkManager.service' -> skipping
Sad, Sad. Some other Linux distributions don't do this kind of checking, but i guess that leaves open some holes there especially if you don't know what your doing. Pat on the back for SUSE in making things more secure here.

So you think your an expert. Then look no further.

To disable the networkmanager checking in openSUSE 12.3 use the following:

1) make a backup copy of /sbin/ifup
2) open /sbin/ifup for editing
3) Find the following lines:

###############################################################
# Check if /etc/init.d/network (network.service) is enabled, otherwise
# (masked by e.g. the NetworkManager.service) inform the user and exit.
#
network_service_id=`get_network_service_id`
if [ "x$network_service_id" != "xnetwork.service" ] ; then
mesg "Network is managed by '$network_service_id' -> skipping"
exit $R_NOTIMPL
fi
case $SCRIPTNAME in
ifup)
# start everything in network service cgroup
if ! in_network_service_cgroup ; then
add_to_network_service_cgroup
fi
;;
esac

4) Modify the following lines by commenting them out like below:

###############################################################
# Check if /etc/init.d/network (network.service) is enabled, otherwise
# (masked by e.g. the NetworkManager.service) inform the user and exit.
#
network_service_id=`get_network_service_id`
#if [ "x$network_service_id" != "xnetwork.service" ] ; then
# mesg "Network is managed by '$network_service_id' -> skipping"
# exit $R_NOTIMPL
#fi
case $SCRIPTNAME in
ifup)
# start everything in network service cgroup
if ! in_network_service_cgroup ; then
add_to_network_service_cgroup
fi
;;
esac

You are now able to execute ifup without any networkmanager checking in openSUSE 12.3.

To disable the networkmanager checking in openSUSE 12.2 use the following:

1) make a backup copy of /sbin/ifup
2) open /sbin/ifup for editing
3) Find the following lines:

# Check if NetworkManager is running, inform the user and exit
#
if [ "$NETWORKMANAGER" = yes ] && ! netcontrol_running ; then
if [ "$SCRIPTNAME" != ifdown -a "$INTERFACE" != lo ] ; then
mesg "Network interface is managed by the NetworkManager ->
skipping"
exit $R_NOTIMPL
fi
elif nm_running && [ "$INTERFACE" != lo ] ; then
mesg "Network interface is managed by the NetworkManager -> skipping"
exit $R_NOTIMPL
fi

4) Modify the following lines by commenting them out like below:

# Check if NetworkManager is running, inform the user and exit
#
#if [ "$NETWORKMANAGER" = yes ] && ! netcontrol_running ; then
#if [ "$SCRIPTNAME" != ifdown -a "$INTERFACE" != lo ] ; then
#mesg "Network interface is managed by the NetworkManager -> skipping"
# exit $R_NOTIMPL
#fi
#elif nm_running && [ "$INTERFACE" != lo ] ; then
# mesg "Network interface is managed by the NetworkManager -> skipping"
# exit $R_NOTIMPL
#fi

You are now able to execute ifup without any networkmanager checking in openSUSE 12.2.