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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. CentOS / RHEL 7 : How to Modify GRUB2 Arguments with grubby
  2. How to Recover Corrupted Root Partition from Rescue Mode in CentOS/RHEL 5,6
  3. How to gzip all or specific files in Linux
  4. Troubleshooting kdump Issues in CentOS/RHEL
  5. Which network ports are reserved by the Linux Operating System?
  6. How to use FTP under Linux to transfer files
  7. Supported and Recommended File Systems on Linux
  8. Beginners Guide to Samba (Installation and Configuration)
  9. How To Create a Local Yum Repository for MySQL Enterprise Packages
  10. How to Change Timezone from CST To EST in CentOS/RHEL 7 Server

You May Also Like

Primary Sidebar

Recent Posts

  • What are different Oracle Database Vault Roles
  • Unable to export realm protected table using data pump
  • Beginners Guide to Oracle Database Vault
  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary