NetworkManager

From DikapediaV2
Jump to: navigation, search

In RHEL7, the default networking service is provided by NetworkManager, which is a dynamic network control and configuration daemon that attempts to keep network devices and connections up and active when they are available.

  • Introduced in RHEL7
  • Can configure network aliases IP addresses, static routes, DNS information, and VPN connections, as well as many connection-specific parameters.
  • Traditional ifcfg type configuration files are still supported.


Nmcli


nmcli is a command-line interface tool that controls NetworkManager. Think of NetworkManager as the engine that manages your system's network connections, and nmcli as the dashboard that lets you interact with it.


Dispatcher.d Directory


The /etc/NetworkManager/dispatcher.d directory is used by NetworkManager to execute custom scripts in response to network events. It's part of the NetworkManager-dispatcher service, which listens for changes in network state and triggers scripts accordingly.

🛠️ What Happens in This Directory?

  • It contains executable scripts that are run when specific network events occur.
  • These scripts are typically written by system administrators to automate tasks like:
    • Configuring additional routes when an interface comes up
    • Restarting services when a VPN connects
    • Logging network changes for auditing
    • Adjusting firewall rules dynamically

📦 How It Works Scripts in /etc/NetworkManager/dispatcher.d are executed in alphabetical order.

Each script receives two arguments:

  • Interface name (e.g., eth0, wlan0)
  • Action (e.g., up, down, pre-up, vpn-up, hostname, dns-change, etc.)


Real world example: Having a script that disables/enables Wifi depending on the eth state. If the Ethernet connection is active (up), it disables WiFi; if the Ethernet connection is inactive (down), it enables WiFi.