• 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. Volume “test_vg/lvol0” is not active locally – Error while running lvcreate
  2. ‘ulimit: max user processes: cannot modify limit:operation not permitted’ Shown When Login
  3. CentOS / RHEL : How to Disable and Blacklist Linux Kernel Module to prevent it from loading automatically
  4. How To Create a Local Yum Repository for MySQL Enterprise Packages
  5. CentOS / RHEL 7 : How to Enable the Old ethX Style Network Interfaces Names
  6. How To Send Mails To an External User With Mailx on Linux
  7. How to Use the ssh-keygen Command to configure passwordless ssh
  8. How to Create and Query a BTRFS File System
  9. How to set children-max for udev Service in CentOS/RHEL 7
  10. fprintd Logs Messages into /var/log/messages Even If USEFPRINTD=no in /etc/sysconfig/authconfig (CentOS/RHEL 7)

You May Also Like

Primary Sidebar

Recent Posts

  • How to disable ACPI in CentOS/RHEL 7
  • How to Use real-time query to access data on a physical standby database
  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary