Learn how to create and manage systemd services that depend on network connectivity. This scenario teaches you to build robust services that wait for network availability before starting, ensuring your applications have the network resources they need.
Network-dependent services are crucial for applications that require internet connectivity, such as web servers, database connections, API clients, and cloud services. Understanding the difference between network.target and network-online.target is essential for creating reliable services that wait for actual connectivity, not just network interfaces.
network.target
- Network interfaces are upnetwork-online.target
- Network is actually reachableAfter=network-online.target
- Start after network is onlineWants=network-online.target
- Depend on network connectivityNetworkManager-wait-online.service
- Ensures true connectivity