• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Linux OS Service ‘NetworkManagerDispatcher’

by admin

The NetworkManager daemon attempts to keep an active network connection available at all times. The NetworkManager facility offers a tool called NetworkManagerDispatcher which executes commands in /etc/NetworkManager/dispatcher.d according to the changing state of the network interfaces. All scripts in this directory are invoked for every state change of any network interface; the scripts must decide whether to process the event.

The companion service NetworkManager must be running to generate the network status change events to which NetworkManagerDispatcher responds.

Service Control

To obtain the NetworkManagerDispatcher service, install the NetworkManager RPM package:

# yum install NetworkManager

To manage the NetworkManagerDispatcher service on subsequent shutdowns and reboots, use the chkconfig tool:

# chkconfig NetworkManager on
# chkconfig NetworkManagerDispatcher on
# service NetworkManager start
Setting network parameters...
Starting dhcdbd:                                           [  OK  ]
Starting NetworkManager daemon:                            [  OK  ]
# service NetworkManagerDispatcher start
Starting NetworkManagerDispatcher daemon:                  [  OK  ]
# chkconfig --list NetworkManager
NetworkManager  0:off   1:off   2:off   3:on    4:on    5:on    6:off
# chkconfig --list NetworkManagerDispatcher
NetworkManagerDispatcher 0:off   1:off   2:off   3:on    4:on    5:on    6:off

To control the NetworkManagerDispatcher service immediately, use the service tool:

# service NetworkManagerDispatcher
Usage: /etc/init.d/NetworkManagerDispatcher {start|stop|restart|reload|status}

Start this daemon:

# service NetworkManagerDispatcher start
Starting NetworkManagerDispatcher daemon:                  [  OK  ]

Stop this daemon:

# service NetworkManagerDispatcher stop
Stopping NetworkManagerDispatcher daemon:                  [  OK  ]

Configuration

Below is a sample script provided with the NetworkManager package located in the /etc/NetworkManager/dispatcher.d directory.

# cat /etc/NetworkManager/dispatcher.d/00-netreport
#!/bin/sh

cd /etc/sysconfig/network-scripts
. ./network-functions

[ -f ../network ] && . ../network

# Notify programs that have requested notification
do_netreport

exit 0
[root@NVMBD1S12BKPMED15 dispatcher.d]# cat 20-chrony
#!/bin/sh
# This is a NetworkManager dispatcher script for chronyd to set its NTP sources
# online/offline when a default route is configured/removed on the system.

export LC_ALL=C

if [ "$2" = "up" ]; then
        /sbin/ip route list dev "$1" | grep -q '^default' &&
                /usr/bin/chronyc online > /dev/null 2>&1
fi

if [ "$2" = "down" ]; then
        /sbin/ip route list | grep -q '^default' ||
                /usr/bin/chronyc offline > /dev/null 2>&1
fi

exit 0

Notes

The NetworkManager facility was designed to facilitate mobile network users, such as laptop users, as they move from one wireless hot-spot to another. System administrators should carefully consider whether to enable the NetworkManager facility on servers connected to a fixed network.

Filed Under: Linux, Linux Services

Some more articles you might also be interested in …

  1. pacman –deptest Command Examples
  2. ‘nestat -s’ showing a large number for “packet reassembles failed” errors in CentOS/RHEL
  3. rkhunter Command Examples in Linux
  4. dpkg-query: command not found
  5. CentOS / RHEL : How to determine which SNMP version is being used
  6. whoami: command not found
  7. CentOS / RHEL : How to find if a network port is open or not?
  8. ssh-add Command Examples in Linux
  9. ipcrm Command Examples in Linux
  10. How to verify if NX/XD is Enabled or Disabled in CentOS/RHEL 7 and 8

You May Also Like

Primary Sidebar

Recent Posts

  • “aws s3 mv” Command Examples
  • “aws s3 mb” Command Examples
  • “aws s3 ls” Command Examples
  • “aws s3 cp” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright