1NM-ONLINE(1) General Commands Manual NM-ONLINE(1)
2
3
4
6 nm-online - ask NetworkManager whether the network is connected
7
9 nm-online [OPTIONS...]
10
12 nm-online is a utility to find out whether we are online. It is done by
13 asking NetworkManager about its status. When run, nm-online waits until
14 NetworkManager reports an active connection, or specified timeout
15 expires. On exit, the returned status code should be checked (see the
16 return codes below).
17
18 This tool is not very useful to call directly. It is however used by
19 NetworkManager-wait-online.service with --wait-for-startup argument.
20 This is used to delay the service and indirectly network-online.target,
21 until networking is up. Don't order your own systemd services after
22 NetworkManager-wait-online.service directly. Instead if necessary,
23 order your services after network-online.target. Even better is to have
24 your services react to network changes dynamically and don't order them
25 with respect to network-online.target at all.
26
27 By default, connections have the ipv4.may-fail and ipv6.may-fail
28 properties set to yes; this means that NetworkManager waits for one of
29 the two address families to complete configuration before considering
30 the connection activated. If you need a specific address family
31 configured before network-online.target is reached, set the
32 corresponding may-fail property to no.
33
35 -h | --help
36 Print help information.
37
38 -q | --quiet
39 Don't print anything.
40
41 -s | --wait-for-startup
42 Wait for NetworkManager startup to complete, rather than waiting
43 for network connectivity specifically. Startup is considered
44 complete once NetworkManager has activated (or attempted to
45 activate) every auto-activate connection which is available given
46 the current network state. This corresponds to the moment when
47 NetworkManager logs "startup complete". This mode is generally only
48 useful at boot time. After startup has completed, nm-online -s will
49 just return immediately, regardless of the current network state.
50
51 There are various ways to affect when startup complete is reached.
52 For example, by setting a connection profile to autoconnect, such a
53 profile possibly will activate during startup and thus delay
54 startup complete being reached. Also, a profile is considered ready
55 when it fully reached the logical connected state in
56 NetworkManager. That means, properties like ipv4.may-fail and
57 ipv6.may-fail affect whether a certain address family is required.
58 Also, the connection property connection.wait-device-timeout
59 affects whether to wait for the driver to detect a certain device.
60 Generally, a failure of NetworkManager-wait-online.service
61 indicates a configuration error, where NetworkManager won't be able
62 to reach the desired connectivity state during startup. An example
63 for that are bridge or bond master profiles, that get autoconnected
64 but without activating any slaves. Such master devices hang in
65 activating state indefinitely, and cause
66 NetworkManager-wait-online.service to fail.
67
68 -t | --timeout seconds
69 Time to wait for a connection, in seconds. If the option is not
70 provided, the environment variable NM_ONLINE_TIMEOUT is honored.
71 The default timeout is 30 seconds.
72
73 -x | --exit
74 Exit immediately if NetworkManager is not running or connecting.
75
77 nm-online exits with status 0 if it succeeds, a value greater than 0 is
78 returned if an error occurs.
79
80 0
81 Success – already online or connection established within given
82 timeout.
83
84 1
85 Offline or not online within given timeout.
86
87 2
88 Unknown or unspecified error.
89
91 nmcli(1), NetworkManager(8).
92
93
94
95NetworkManager 1.26.6 NM-ONLINE(1)