From Fedora Project Wiki

Network connectivity guidelines for services

1) Services that require to be started after network is fully configured should pull in network-online.target and order itself after it.

[Unit]
# Ensure service waits for network connectivity and stops before tearing it down
Wants=network-online.target
After=network-online.target

Note that pulling in network-online.target may extend the overall boot time.

2) Services that don't need to wait for network configuration but would should be stopped before network is taken down should order itself after network.target.

[Unit]
# Ensure service is stopped before tearing down network connectivity
After=network.target

3) Services that don't have any of the requirements above should not reference those targets.