RED HAT ENTERPRISE LINUX
Managing
Network Services
Start, stop, and check the status of network services
CIS126RH | RHEL System Administration 1
Mesa Community College
Network services — SSH, HTTP, firewall, DNS, and others — are managed as systemd
units on RHEL 9. Administrators must know how to start and stop them, check whether
they are running and why, enable them to start automatically at boot, and diagnose
why a service failed. The systemctl command is the central tool for all
of these tasks. This module covers service management with a focus on network services
and is tested extensively on the RHCSA exam.
Learning Objectives
-
Start and stop services —
Use
systemctl startandsystemctl stopto manage the running state of a service -
Enable and disable services at boot —
Use
systemctl enableandsystemctl disableto control whether a service starts automatically -
Check service status and diagnose failures —
Use
systemctl statusto interpret service state and read recent log output, and usejournalctl -ufor deeper investigation -
Reload and restart services after configuration changes —
Distinguish between
reload,restart, andrestart --forceand choose the right action
systemd Services on RHEL
On RHEL 9, all services are managed as systemd units. A service unit file defines how to start the service, what to do if it fails, and what other units it depends on.
- Service unit files end in
.serviceand live in/usr/lib/systemd/system/(package-installed) or/etc/systemd/system/(administrator-created) - The service name used with
systemctlis the unit file name without the.servicesuffix - Common network service names:
sshd,httpd,firewalld,NetworkManager,chronyd
# List all loaded service units
$ systemctl list-units --type=service
# List only services that have failed
$ systemctl list-units --type=service --state=failed
# Show all installed unit files (including disabled ones)
$ systemctl list-unit-files --type=service | grep enabled
Starting and Stopping Services
These commands change the running state of a service right now. They have no effect on whether the service starts at the next boot.
# Start a service immediately
$ sudo systemctl start sshd
$ sudo systemctl start httpd
# Stop a running service
$ sudo systemctl stop sshd
# Restart a service (stop then start)
$ sudo systemctl restart httpd
# Reload configuration without stopping the service
$ sudo systemctl reload sshd
# Reload if the service supports it, otherwise restart
$ sudo systemctl reload-or-restart httpd
# Confirm the result
$ systemctl is-active sshd
active
Starting a service with systemctl start is temporary — if the service
is disabled, it will not start on the next reboot. To make it persistent, also run
systemctl enable.
Enabling and Disabling Services at Boot
These commands control whether a service starts automatically at boot. They have no immediate effect on the currently running state.
# Enable a service — creates a symlink so it starts on boot
$ sudo systemctl enable sshd
Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service →
/usr/lib/systemd/system/sshd.service.
# Disable a service — removes the symlink
$ sudo systemctl disable sshd
# Enable AND start in one command — the most common pattern
$ sudo systemctl enable --now httpd
# Disable AND stop in one command
$ sudo systemctl disable --now httpd
# Check if a service is enabled (will start at boot)
$ systemctl is-enabled sshd
enabled
sudo systemctl enable --now SERVICENAME starts the service right
now AND ensures it starts on every future boot. This single command completes
most service deployment tasks on the exam.
Checking Service Status
systemctl status shows a complete summary: running state,
enabled state, PID, memory usage, and the most recent log entries.
$ systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Mon 2026-05-25 07:00:00 MST; 14 days ago
Main PID: 872 (sshd)
Tasks: 1 (limit: 49152)
Memory: 5.2M
CPU: 203ms
CGroup: /system.slice/sshd.service
└─872 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
May 25 09:05:21 servera sshd[872]: Accepted publickey for student
May 25 09:10:04 servera sshd[872]: pam_unix(sshd:session): session opened
Line 1: unit description. Line 2: file location and enabled/disabled (boot state). Line 3: active/inactive/failed (running state) and how long. Lines at the bottom: the most recent log entries — often show exactly why the service failed.
Interpreting Service States
The Active line in systemctl status shows the current
running state. The Loaded line shows the boot-time configuration.
| Active state | Meaning | Action |
|---|---|---|
active (running) |
Service is running with at least one process | Normal — no action needed |
active (exited) |
Service started successfully and its process has completed | Normal for one-shot services (setup scripts) |
inactive (dead) |
Service is not running and has not been started | Start with systemctl start if needed |
failed |
Service exited with a non-zero status or was killed | Read the log lines below status; fix the problem then start |
activating |
Service is in the process of starting up | Wait; re-check status if it stays in this state too long |
deactivating |
Service is in the process of stopping | Normal during shutdown; investigate if it stays here |
Diagnosing a Failed Service
When systemctl status shows failed, the diagnostic
information is right there — read it carefully before taking action.
$ systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Mon 2026-05-25 10:00:00 MST
Process: 5432 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 5432 (code=exited, status=1/FAILURE)
May 25 10:00:00 servera httpd[5432]: AH00526: Syntax error on line 47 of /etc/httpd/conf/httpd.conf
May 25 10:00:00 servera httpd[5432]: Invalid command 'ServerNam', perhaps misspelled
May 25 10:00:00 servera systemd[1]: httpd.service: Main process exited, code=exited
May 25 10:00:00 servera systemd[1]: httpd.service: Failed with result 'exit-code'.
# Get more detail from the journal
$ journalctl -u httpd --since "10 minutes ago"
The lines at the bottom of systemctl status are the last few journal
entries from the service. In this example, the error message identifies the exact
file and line number of the configuration problem. Fix the problem first, then
restart the service.
reload vs restart: Choosing the Right Action
After changing a service's configuration file, the service must be told about the change. Choose based on what the service supports and how much disruption is acceptable.
| Command | What happens | Connection disruption | Use when |
|---|---|---|---|
reload |
Service re-reads its config without stopping its process | None — existing connections continue | Service supports SIGHUP reload (sshd, httpd, nginx) |
restart |
Service is stopped and then started again | All existing connections dropped | Config change requires full restart, or service does not support reload |
reload-or-restart |
Reload if supported; otherwise restart | Minimal — no disruption if reload works | Safe default when unsure whether the service supports reload |
# Apply a sshd_config change without dropping active SSH sessions
$ sudo systemctl reload sshd
# Restart httpd after changing the server's IP binding
$ sudo systemctl restart httpd
Common Network Services on RHEL
| Service name | Purpose | Default state | Config file(s) |
|---|---|---|---|
sshd |
Secure Shell remote access | Enabled, running | /etc/ssh/sshd_config |
firewalld |
Dynamic firewall management | Enabled, running | /etc/firewalld/ |
httpd |
Apache HTTP web server | Installed, disabled | /etc/httpd/conf/httpd.conf |
NetworkManager |
Network interface management | Enabled, running | /etc/NetworkManager/ |
chronyd |
NTP time synchronisation | Enabled, running | /etc/chrony.conf |
rsyslog |
System log processing and routing | Enabled, running | /etc/rsyslog.conf |
named |
DNS server (BIND) | Installed, disabled | /etc/named.conf |
The Full Service Lifecycle
Deploying a new network service follows a consistent pattern on every RHEL system.
-
Install the package
sudo dnf install httpd -
Edit the configuration file
sudo vim /etc/httpd/conf/httpd.conf -
Enable and start the service
sudo systemctl enable --now httpd -
Check the status
systemctl status httpd -
Open the firewall port
sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --reload -
Verify the service is reachable
curl http://localhostorss -tlnp | grep :80
Verifying Network Service Accessibility
A service can be running but still unreachable — due to the firewall, a wrong listen address, or a configuration error. Verify at multiple layers.
# Check what ports the service is listening on
$ ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=872))
LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("httpd",pid=1234))
# Check that the firewall allows the service
$ sudo firewall-cmd --list-services
cockpit dhcpv6-client ssh
# http is not listed — firewall is blocking it!
# Test connectivity to the service locally
$ curl -s http://localhost | head -3
# Test SSH connectivity to the server
$ ssh -o ConnectTimeout=5 localhost
RHEL enables firewalld by default. A service can be running and listening correctly but completely unreachable from the network if its port is not allowed in the firewall.
Masking Services
Masking prevents a service from being started, even accidentally or by another service. It is stronger than disabling.
# Disable a service — can still be started manually
$ sudo systemctl disable httpd
# Mask a service — cannot be started by any means
$ sudo systemctl mask httpd
Created symlink /etc/systemd/system/httpd.service → /dev/null.
# Attempting to start a masked service fails
$ sudo systemctl start httpd
Failed to start httpd.service: Unit httpd.service is masked.
# Unmask to restore normal behaviour
$ sudo systemctl unmask httpd
Removed /etc/systemd/system/httpd.service.
# Confirm the service is no longer masked
$ systemctl is-enabled httpd
disabled
systemd implements masking by creating a symlink pointing to /dev/null
in /etc/systemd/system/. This symlink overrides the real unit file,
making the service impossible to start.
Service Management Quick Reference
| Task | Command |
|---|---|
| Start a service now | sudo systemctl start SERVICE |
| Stop a running service | sudo systemctl stop SERVICE |
| Restart a service | sudo systemctl restart SERVICE |
| Reload config without stopping | sudo systemctl reload SERVICE |
| Reload or restart (safe default) | sudo systemctl reload-or-restart SERVICE |
| Enable at boot only | sudo systemctl enable SERVICE |
| Enable at boot AND start now | sudo systemctl enable --now SERVICE |
| Disable at boot only | sudo systemctl disable SERVICE |
| Disable AND stop now | sudo systemctl disable --now SERVICE |
| Check running and boot state | systemctl status SERVICE |
| Check if running | systemctl is-active SERVICE |
| Check if enabled | systemctl is-enabled SERVICE |
| Read service logs | journalctl -u SERVICE |
| Follow service logs live | journalctl -u SERVICE -f |
| Prevent service from starting | sudo systemctl mask SERVICE |
| Restore masked service | sudo systemctl unmask SERVICE |
Troubleshooting Service Failures
A systematic approach finds the cause of most service failures in under a minute.
-
Check status — read the log lines at the bottom
systemctl status SERVICENAME -
If the log lines are insufficient, read the full journal
journalctl -u SERVICENAME --since "5 minutes ago" -
Check the service's own log file if it has one
sudo tail -n 50 /var/log/httpd/error_log -
Verify the configuration file syntax
httpd -t,sshd -t,named-checkconf -
Fix the problem, then start the service
sudo systemctl start SERVICENAME -
Confirm the service is running
systemctl status SERVICENAME
Common Mistakes
| Mistake | What goes wrong | Correct approach |
|---|---|---|
| Starting a service without enabling it | Service runs until reboot then never starts again | Use systemctl enable --now SERVICE to do both at once |
| Enabling a service without starting it | Service will start at the next boot but is not running now | Use systemctl enable --now SERVICE to start immediately |
| Not checking status after start | Service silently failed — task appears complete but service is not running | Always run systemctl status SERVICE after starting |
| Using restart when reload would work | All active connections are dropped unnecessarily | Use reload for config changes when the service supports it |
| Forgetting to open the firewall port | Service is running and listening but unreachable from the network | Always check firewall-cmd --list-services after starting a network service |
Editing a unit file in /usr/lib/systemd/system/ |
Changes overwritten by the next package update | Create override files in /etc/systemd/system/SERVICE.d/override.conf |
Knowledge Check
Answer these before moving to the next slide.
- Write the single command to install
httpd, then the single command to ensure it is running now AND will start automatically on every future boot. - What is the difference between
systemctl enable sshdandsystemctl start sshd? - After editing
/etc/ssh/sshd_config, you want to apply the changes without dropping any active SSH sessions. What command do you use? - The output of
systemctl status httpdshowsActive: failed. What is the first thing you look at in the output, and what do you do next? - Write the command to check which TCP ports
sshdis listening on and which process owns each socket. - What does masking a service do, and how is it different from disabling it?
Knowledge Check — Answers
- Install:
sudo dnf install -y httpd
Enable and start:sudo systemctl enable --now httpd— the--nowflag both enables for boot AND starts immediately. systemctl enable sshdconfigures the service to start automatically at the next boot — it does not start the service now.systemctl start sshdstarts the service right now in the current session — it has no effect on future boots.sudo systemctl reload sshd— reload sends SIGHUP to the sshd process, causing it to re-read its configuration without stopping. Existing sessions are not interrupted.- First, read the log lines at the bottom of the status output — they almost
always show the error message that caused the failure (syntax error, missing file,
permission denied, etc.). If the status output does not provide enough detail,
run
journalctl -u httpd --since "5 minutes ago"to see the full log context. ss -tlnp—-tfor TCP,-lfor listening,-nfor numeric ports,-pfor process name and PID.- Masking creates a symlink to
/dev/nullthat prevents the service from starting by any means — manually, by another service, or at boot. Disabling only removes the boot-time symlink; the service can still be started manually withsystemctl start. Masking is a stronger, absolute prevention.
Key Takeaways
-
start/stop controls running state now; enable/disable controls boot state.
These are independent — a service can be running but disabled, or enabled but stopped.
Use
systemctl enable --now SERVICEto do both at once. -
Always check status after starting a service.
systemctl status SERVICEshows running state, boot state, PID, and the last few log lines. A failed service always leaves evidence in those log lines. If status is insufficient, usejournalctl -u SERVICE. -
Use reload instead of restart when the service supports it.
reloadapplies configuration changes without dropping existing connections.restartdrops all connections. Usereload-or-restartwhen unsure which the service supports. -
A running service may still be unreachable — check the firewall.
ss -tlnpconfirms the service is listening on the expected port.firewall-cmd --list-servicesshows what is allowed through. A service that is not in that list is blocked from external access.
Graded Lab
- Check whether
sshdis running and enabled withsystemctl status sshd. Note both the Active state and the enabled/disabled state on the Loaded line. - Install
httpdwithdnf install httpd. After installation, check its status — it should be installed but not running and not enabled. - Enable and start
httpdwith a singlesystemctl enable --now httpdcommand. Verify it is active and enabled withsystemctl status httpd. - Use
ss -tlnpto confirmhttpdis listening on port 80. Then checksudo firewall-cmd --list-servicesto see whether the firewall allows HTTP traffic. - Stop
httpdwithsystemctl stop. Confirm it is inactive but still enabled. Start it again and confirm it returns to active. - Use
journalctl -u httpd --since todayto view today's log entries for the httpd service.
"Start, stop, and check the status of network services."
The exam pattern is: install, enable --now, verify with
status, check firewall. These four steps complete most
service deployment tasks.