Redhat Linux 9: Kiểm tra trạng hái kết nối mạng, thiết bị mạng và fille thiết lập mạng
ylist: https://www.youtube.com/playlist?list=PLIpLw6v7Z1ql8BMl4SC01aAtvN7qA_BD_
Link playlist
Red Hat Enterprise Linux Administration
2024 01 14 11 59 21
.
Network Configuration Services
If there’s trouble with a network configuration, one thing to check is the current status of
the network. To do so, run the following command:
# systemctl status NetworkManager
RHEL 9 uses a service known as Network Manager to monitor and manage network
settings. Using the nmcli command-line tool, you can interact with Network Manager and
display the current status of network devices:
# nmcli dev status
The command should list configured and active devices. If a key device such as eth0 is not
listed as connected, your network connection is probably down or the device is not configured.
Key configuration files are located in the /etc/NetworkManager/system-connections directory.
03-ch03.indd 101 17/11/23 2:06 PM
102 Chapter 3 Managing Basic Networking
CertPrs_2015/ RHCSA® Red Hat® Enterprise Linux® 9 Certification Study Guide/Jang/207-2/Chapter 3
Sometimes mistakes happen. If you’ve deactivated an adapter or just lost a wireless
connection, try something simple: restart networking. The following command restarts
networking with current configuration files:
# systemctl restart NetworkManager
If a simple restart of networking services doesn’t work, then it’s time to get into the files.
The /etc/NetworkManager/system-connections directory is where Red Hat Enterprise
Linux stores and retrieves networking information. With available Red Hat configuration
tools, you don’t have to touch these files, but it’s good to know they’re there. Each installed
network adapter, such as ens3, gets its own name.nmconnection configuration file, where
name is the name of the device or the name of the connection. For example, eth0 is given file
eth0.nmconnection. This file includes the IP address information required to identify this
adapter on a network.
What you see in the *.nmconnection files depends on how an Ethernet network adapter
was configured. For example, look at the situation where networking was set up only for the
purposes of installation. If you did not configure networking when setting the hostname
during the GUI installation process, the network interface would have retrieved its IP settings
from a DHCP server.
Generally, the network options configured through a DHCP server include the IP address,
the network mask, the gateway address for access to external networks, and the IP address of
any DNS servers for that network.
When a network interface is configured to get its IP settings from a DHCP server, the
corresponding nmconnection file would contain at least the following directives:
[connection]
id=eth0
type=ethernet
[ipv4]
method=auto
Network Manager includes nmcli to control the status of the service and apply network
configuration changes. Rather than modifying the configuration via nmcli, you can change a
device configuration file directly. For that purpose, the configuration file shown in Figure 3-2
provides a guide.
Most of these directives are straightforward. They define a configuration for an Ethernet
network interface with name eth0, using a defined IP address, a netmask, a default gateway,
and a DNS server.
After saving the file, you still have to notify Network Manager of the changes. This is
achieved by running the following commands (con is short for connection):
# nmcli con reload
# nmcli con down eth0
# nmcli con up eth0
Shortly, you’ll see how to use Network Manager’s command-line tool to modify the
configuration of a network device.
by Le Hoang Long Long
linux dhcp server