The NetworkManager Daemon
The NetworkManager daemon runs with root privileges and is, by default, configured to start up at boot time. You can determine whether the NetworkManager daemon is running by entering this command:~]$ systemctl status NetworkManager
NetworkManager.service - Network Manager
Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled)
Active: active (running) since Fri, 08 Mar 2013 12:50:04 +0100; 3 days ago
The systemctl status
command will report NetworkManager
as Active: inactive (dead)
if the NetworkManager
service is not running. To start it for the current session enter the following command as the root
user:
~]# systemctl start NetworkManager
Run the systemctl enable
command to ensure that NetworkManager
starts up every time the system boots:
~]# systemctl enable NetworkManager
For more information on starting, stopping and managing services, see the
Red Hat Enterprise Linux 7 System Administrator's Guide.
1.4.2. Interacting with NetworkManager
Users do not interact with the NetworkManager system service directly. Instead, users perform network configuration tasks using graphical and command-line user interface tools. The following tools are available in Red Hat Enterprise Linux 7:- A simple curses-based text user interface (TUI) for NetworkManager, nmtui, is available.
- A command-line tool, nmcli, is provided to allow users and scripts to interact with NetworkManager. Note that nmcli can be used on systems without a GUI such as servers to control all aspects of NetworkManager. It is on an equal footing with the GUI tools.
- The GNOME Shell also provides a network icon in its Notification Area representing network connection states as reported by NetworkManager. The icon has multiple states that serve as visual indicators for the type of connection you are currently using.
- A graphical user interface tool called control-center, provided
by the GNOME Shell, is available for desktop users. It incorporates a Network settings
tool. To start it, press the Super key to enter the Activities Overview, type
control network
and then press Enter. The Super key appears in a variety of guises, depending on the keyboard and other hardware, but often as either the Windows or Command key, and typically to the left of the Space key. - A graphical user interface tool, nm-connection-editor, is available
for certain tasks not yet handled by control-center. To start it, press the
Super key to enter the Activities Overview, type
network connections
ornm-connection-editor
and then press Enter.
1.7. Network Configuration Using the Command-Line Interface (CLI)
The commands for the ip utility, sometimes referred to as iproute2 after the
upstream package name, are documented in the man ip(8)
page. The package
name in Red Hat Enterprise Linux 7 is iproute. If necessary, you can check that the ip
utility is installed by checking its version number as follows:
~]$ ip -V
ip utility, iproute2-ss130716
The ip commands can be used to add and remove addresses and routes to interfaces in
parallel with NetworkManager, which will preserve them and recognize them in
nmcli, nmtui, control-center, and the D-Bus API.
Note that the ip utility replaces the ifconfig
utility
because the net-tools package (which provides ifconfig
) does not support
InfiniBand addresses. The command ip help
prints a usage message. Specific
help is available for OBJECTS, for example: ip link help
and
ip addr help
.
ip commands given on the command line will not persist after
a system restart. Where persistence is required, make use of configuration files (ifcfg
files) or add the commands to a script.
Running Network Script
Run the script only with the systemctl utility which will clear any existing environment variables and ensure clean execution. The command takes the following form:systemctl start|stop|restart|status network
Note that in Red Hat Enterprise Linux 7, NetworkManager is started first, and
/etc/init.d/network
checks with NetworkManager to avoid
tampering with NetworkManager's connections. NetworkManager is intended
to be the primary application using sysconfig configuration files and /etc/init.d/network
is intended to be secondary, playing a fallback role.
The /etc/init.d/network
script is not event-driven, it runs either:
- manually (by one of the
systemctl
commandsstart|stop|restart network
), - on boot and shutdown if the network service is enabled (as a result of the command
systemctl enable network
).
ifup
and ifdown
manually.
Custom Commands and the Network Scripts
Custom commands in the scripts/sbin/ifup-local
,
ifdown-pre-local
, and ifdown-local
are only
executed when those devices are controlled by the /etc/init.d/network
service. The ifup-local
file does not exist by default. If required, create
it under the /sbin/
directory.
The ifup-local
script is readable only by the initscripts and not by
NetworkManager. To run a custom script using NetworkManager, create
it under the dispatcher.d
directory. See
Section 1.8, "Running Dispatcher scripts" for an explanation of the dispatcher scripts.
Red Hat does not provide support if a user modifies any files included with the initscripts package or related rpms.
There are ways to perform custom tasks when network connections go up and down, both with the old network scripts and with NetworkManager. When NetworkManager is enabled, theifup
and ifdown
script will ask
NetworkManager whether NetworkManager manages the interface in question, which
is found from the "DEVICE=" line in the ifcfg
file. If NetworkManager
does manage that device, and the device is not already connected, then ifup
will ask NetworkManager to start the connection.
- If the device is managed by NetworkManager and it is already connected, nothing is done.
- If the device is not managed by NetworkManager, then the scripts will start the connection using the older, non-NetworkManager mechanisms that they have used since the time before NetworkManager existed.
ifdown
and the device is managed by NetworkManager,
then ifdown
will ask NetworkManager to terminate the
connection.
The scripts dynamically check NetworkManager, so if NetworkManager is not running, the scripts will fall back to the old, pre-NetworkManager script-based mechanisms.
Running Dispatcher scripts
NetworkManager provides a way to run additional custom scripts to start or stop services based on the connection status. By default, the/etc/NetworkManager/dispatcher.d
directory exists and NetworkManager runs scripts there, in alphabetical order. Each
script must be an executable file owned by root
and
must have write permission
only for the file owner. For more information
about running NetworkManager dispatcher scripts, see the Red Hat Knowledgebase solution
How to write a NetworkManager
dispatcher script to apply ethtool commands.
|
Switchboard | ||||
Latest | |||||
Past week | |||||
Past month |
NEWS CONTENTS
- 190317 : 1.9. Network Configuration Using sysconfig Files ( softpanorama.org, )
Old News ;-)
1.9. Network Configuration Using sysconfig Files
TheThe file/etc/sysconfig/
directory is a location for configuration files and scripts. Most network configuration information is stored there, with the exception of VPN, mobile broadband and PPPoE configuration, which are stored in/etc/NetworkManager/
subdirectories. Interface specific information for example, is stored inifcfg
files in the/etc/sysconfig/network-scripts/
directory.
/etc/sysconfig/network
is for global settings. Information for
VPNs, mobile broadband and PPPoE connections is stored in /etc/NetworkManager/system-connections/
.
In Red Hat Enterprise Linux 7 when you edit an ifcfg
file,
NetworkManager is not automatically aware of the change and has to be prompted to notice the
change. If you use one of the tools to update NetworkManager profile settings, then
NetworkManager does not implement those changes until you reconnect using that profile.
For example, if configuration files have been changed using an editor, NetworkManager
must be told to read the configuration files again. To do that, issue the following command as
root
:
~]# nmcli connection reload
The above command reads all connection profiles. Alternatively, to reload only one changed file,
ifcfg-ifname
, issue a command as follows:
~]# nmcli con load /etc/sysconfig/network-scripts/ifcfg-ifname
The command accepts multiple file names. These commands require root
privileges. For more information on user privileges and gaining privileges, see the
Red Hat Enterprise Linux 7 System Administrator's Guide and the
su(1)
and sudo(8)
man pages.
Changes made using tools such as nmcli do not require a reload but do require the associated interface to be put down and then up again. That can be done by using commands in the following format:
nmcli dev disconnect interface-nameFollowed by:
nmcli con up interface-nameNetworkManager does not trigger any of the network scripts, though the network scripts will try to trigger NetworkManager if it is running when
ifup
commands are used. See
Section 1.8, "NetworkManager and the Network Scripts" for an explanation of the network scripts.
The ifup
script is a generic script which does a few things and then
calls interface-specific scripts like ifup-ethX
,
ifup-wireless
, ifup-ppp
, and so on. When
a user runs ifup eth0
manually, the following occurs:
ifup
looks for a file called/etc/sysconfig/network-scripts/ifcfg-eth0
;- if the
ifcfg
file exists,ifup
looks for theTYPE
key in that file to determine which type-specific script to call; ifup
callsifup-wireless
orifup-eth
orifup-XXX
based onTYPE
;- the type-specific scripts do type-specific setup;
- and then the type-specific scripts let common functions perform
IP
-related tasks likeDHCP
or static setup.
/etc/init.d/network
reads through all the
ifcfg
files and for each one that has ONBOOT=yes
,
it checks whether NetworkManager is already starting the DEVICE from that
ifcfg
file. If NetworkManager is starting that device
or has already started it, nothing more is done for that file, and the next ONBOOT=yes
file is checked. If NetworkManager is not yet starting that device, the initscripts
will continue with their traditional behavior and call ifup
for that
ifcfg
file.
The end result is that any ifcfg
file that has
ONBOOT=yes
is expected to be started on system bootup, either by
NetworkManager or by the initscripts. This ensures that some legacy network types which
NetworkManager does not handle (such as ISDN or analog dial-up modems) as well as any
new application not yet supported by NetworkManager are still correctly started by
the initscripts even though NetworkManager is unable to handle them.
It is recommended not to store backup ifcfg
files
in the same location as the live ones. The script literally does ifcfg-*
with an exclude only for these extensions: .old
,
.orig
, .rpmnew
, .rpmorig
,
and .rpmsave
. The best way is not to store backup files anywhere within
the /etc
directory.
Recommended Links
Google matched content |
Softpanorama Recommended
Top articles
Sites
Top articles
Sites
man(1)
man page - Describes man pages and how to find them.NetworkManager(8)
man page - Describes the network management daemon.NetworkManager.conf(5)
man page - Describes theNetworkManager
configuration file./usr/share/doc/initscripts-version/sysconfig.txt
- Describesifcfg
configuration files and their directives as understood by the legacy network service./usr/share/doc/initscripts-version/examples/networking/
- A directory containing example configuration files.
Etc
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: March 12, 2019