| 1 |
<?xml version='1.0'?> |
| 2 |
<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> |
| 3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 4 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
| 5 |
<!ENTITY % entities SYSTEM "common.ent" > |
| 6 |
%entities; |
| 7 |
]> |
| 8 |
|
| 9 |
<!-- |
| 10 |
SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later |
| 11 |
|
| 12 |
nm-cloud-setup(8) manual page |
| 13 |
|
| 14 |
Copyright 2020 Red Hat, Inc. |
| 15 |
--> |
| 16 |
|
| 17 |
<refentry id="nm-cloud-setup"> |
| 18 |
<refentryinfo> |
| 19 |
<title>nm-cloud-setup</title> |
| 20 |
<author>Automatic Network Configuration in Cloud with NetworkManager</author> |
| 21 |
</refentryinfo> |
| 22 |
|
| 23 |
<refmeta> |
| 24 |
<refentrytitle>nm-cloud-setup</refentrytitle> |
| 25 |
<manvolnum>8</manvolnum> |
| 26 |
<refmiscinfo class="source">NetworkManager</refmiscinfo> |
| 27 |
<refmiscinfo class="manual">Automatic Network Configuration in Cloud with NetworkManager</refmiscinfo> |
| 28 |
<refmiscinfo class="version">&NM_VERSION;</refmiscinfo> |
| 29 |
</refmeta> |
| 30 |
|
| 31 |
<refnamediv> |
| 32 |
<refname>nm-cloud-setup</refname> |
| 33 |
<refpurpose>Overview of Automatic Network Configuration in Cloud</refpurpose> |
| 34 |
</refnamediv> |
| 35 |
|
| 36 |
<refsect1> |
| 37 |
<title>Overview</title> |
| 38 |
|
| 39 |
<para>When running a virtual machine in a public cloud environment, it is |
| 40 |
desirable to automatically configure the network of that VM. |
| 41 |
In simple setups, the VM only has one network interface and the public |
| 42 |
cloud supports automatic configuration via DHCP, DHCP6 or IPv6 autoconf. |
| 43 |
However, the virtual machine might have multiple network |
| 44 |
interfaces, or multiple IP addresses and IP subnets |
| 45 |
on one interface which cannot be configured via DHCP. Also, the administrator |
| 46 |
may reconfigure the network while the machine is running. NetworkManager's |
| 47 |
nm-cloud-setup is a tool |
| 48 |
that automatically picks up such configuration in cloud environments and updates the network |
| 49 |
configuration of the host.</para> |
| 50 |
|
| 51 |
<para>Multiple cloud providers are supported. See <xref linkend="providers"/>.</para> |
| 52 |
</refsect1> |
| 53 |
|
| 54 |
<refsect1> |
| 55 |
<title>Use</title> |
| 56 |
|
| 57 |
<para>The goal of nm-cloud-setup is to be configuration-less and work automatically. |
| 58 |
All you need is to opt-in to the desired cloud providers (see <xref linkend="env"/>) |
| 59 |
and run <command>/usr/libexec/nm-cloud-setup</command>.</para> |
| 60 |
|
| 61 |
<para>Usually this is done by enabling the nm-cloud-setup.service systemd service |
| 62 |
and let it run periodically. For that there is both a nm-cloud-setup.timer systemd timer |
| 63 |
and a NetworkManager dispatcher script.</para> |
| 64 |
</refsect1> |
| 65 |
|
| 66 |
<refsect1> |
| 67 |
<title>Details</title> |
| 68 |
|
| 69 |
<para> |
| 70 |
nm-cloud-setup configures the network by fetching the configuration from |
| 71 |
the well-known meta data server of the cloud provider. That means, it already |
| 72 |
needs the network configured to the point where it can reach the meta data |
| 73 |
server. Commonly that means, that a simple connection profile is activated |
| 74 |
that possibly uses DHCP to get the primary IP address. NetworkManager will |
| 75 |
create such a profile for ethernet devices automatically if it is not configured |
| 76 |
otherwise via <literal>"no-auto-default"</literal> setting in NetworkManager.conf. |
| 77 |
One possible alternative may be to create such an initial profile with |
| 78 |
<command>nmcli device connect "$DEVICE"</command> or |
| 79 |
<command>nmcli connection add type ethernet ...</command>. |
| 80 |
</para> |
| 81 |
|
| 82 |
<para> |
| 83 |
By setting the user-data <literal>org.freedesktop.nm-cloud-setup.skip=yes</literal> |
| 84 |
on the profile, nm-cloud-setup will skip the device. |
| 85 |
</para> |
| 86 |
|
| 87 |
<para>nm-cloud-setup modifies the run time configuration akin to <command>nmcli device modify</command>. |
| 88 |
With this approach, the configuration is not persisted |
| 89 |
and only preserved until the device disconnects.</para> |
| 90 |
|
| 91 |
<refsect2> |
| 92 |
<title>/usr/libexec/nm-cloud-setup</title> |
| 93 |
|
| 94 |
<para>The binary <command>/usr/libexec/nm-cloud-setup</command> does most of the |
| 95 |
work. It supports no command line arguments but can be configured via environment |
| 96 |
variables. |
| 97 |
See <xref linkend="env"/> for the supported environment variables.</para> |
| 98 |
|
| 99 |
<para>By default, all cloud providers are disabled unless you opt-in by enabling one |
| 100 |
or several providers. If cloud providers are enabled, the program |
| 101 |
tries to fetch the host's configuration from a meta data server of the cloud via HTTP. |
| 102 |
If configuration could be not fetched, no cloud provider are detected and the |
| 103 |
program quits. |
| 104 |
If host configuration is obtained, the corresponding cloud provider is |
| 105 |
successfully detected. Then the network of the host will be configured.</para> |
| 106 |
|
| 107 |
<para>It is intended to re-run nm-cloud-setup every time when the configuration |
| 108 |
(maybe) changes. The tool is idempotent, so it should be OK to also run it |
| 109 |
more often than necessary. You could run <command>/usr/libexec/nm-cloud-setup</command> |
| 110 |
directly. However it may be preferable to restart the nm-cloud-setup systemd |
| 111 |
service instead or use the timer or dispatcher script to run it periodically (see below).</para> |
| 112 |
</refsect2> |
| 113 |
|
| 114 |
<refsect2> |
| 115 |
<title>nm-cloud-setup.service systemd unit</title> |
| 116 |
<para>Usually <command>/usr/libexec/nm-cloud-setup</command> is not run directly, |
| 117 |
but only by <command>systemctl restart nm-cloud-setup.service</command>. This |
| 118 |
ensures that the tool only runs once at any time. |
| 119 |
The unit is also used by the nm-cloud-setup systemd timer and allows |
| 120 |
enabling/disabling the service via systemd.</para> |
| 121 |
|
| 122 |
<para>As you need to set environment variable to configure nm-cloud-setup binary, |
| 123 |
you can do so via systemd override files. Try <command>systemctl edit nm-cloud-setup.service</command>.</para> |
| 124 |
</refsect2> |
| 125 |
|
| 126 |
<refsect2> |
| 127 |
<title>nm-cloud-setup.timer systemd timer</title> |
| 128 |
<para><command>/usr/libexec/nm-cloud-setup</command> is intended to run |
| 129 |
whenever an update is necessary. For example, during boot when when |
| 130 |
changing the network configuration of the virtual machine via the cloud |
| 131 |
provider.</para> |
| 132 |
|
| 133 |
<para>One way to do this, is by enabling the nm-cloud-setup.timer systemd timer |
| 134 |
with <command>systemctl enable --now nm-cloud-setup.timer</command>.</para> |
| 135 |
</refsect2> |
| 136 |
|
| 137 |
<refsect2> |
| 138 |
<title>/usr/lib/NetworkManager/dispatcher.d/90-nm-cloud-setup.sh</title> |
| 139 |
|
| 140 |
<para>There is also a NetworkManager dispatcher script that will |
| 141 |
run for example when an interface is activated by NetworkManager. |
| 142 |
Together with the nm-cloud-setup.timer systemd timer this |
| 143 |
script is to automatically pick up changes to the network.</para> |
| 144 |
|
| 145 |
<para>The dispatcher script will do nothing, unless the systemd service is |
| 146 |
enabled. To use the dispatcher script you should therefor run |
| 147 |
<command>systemctl enable nm-cloud-setup.service</command> once.</para> |
| 148 |
</refsect2> |
| 149 |
|
| 150 |
</refsect1> |
| 151 |
|
| 152 |
<refsect1 id="env"> |
| 153 |
<title>Environment Variables</title> |
| 154 |
|
| 155 |
<para>The following environment variables are used to configure <command>/usr/libexec/nm-cloud-setup</command>. |
| 156 |
You may want to configure them with a drop-in for the systemd service. |
| 157 |
For example by calling <command>systemctl edit nm-cloud-setup.service</command> |
| 158 |
and configuring <literal>[Service] Environment=</literal>, as described in |
| 159 |
<link linkend='systemd.exec'><citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry></link> |
| 160 |
manual.</para> |
| 161 |
|
| 162 |
<itemizedlist> |
| 163 |
<listitem> |
| 164 |
<para><literal>NM_CLOUD_SETUP_LOG</literal>: control the logging verbosity. Set it |
| 165 |
to one of <literal>TRACE</literal>, <literal>DEBUG</literal>, <literal>INFO</literal>, |
| 166 |
<literal>WARN</literal>, <literal>ERR</literal> or <literal>OFF</literal>. The program |
| 167 |
will print message on stdout and the default level is <literal>WARN</literal>. When |
| 168 |
run as systemd service, the log will be collected by journald can can be seen with |
| 169 |
<command>journalctl</command>.</para> |
| 170 |
</listitem> |
| 171 |
<listitem> |
| 172 |
<para><literal>NM_CLOUD_SETUP_AZURE</literal>: boolean, whether Microsoft Azure support is enabled. Defaults |
| 173 |
to <literal>no</literal>.</para> |
| 174 |
</listitem> |
| 175 |
<listitem> |
| 176 |
<para><literal>NM_CLOUD_SETUP_EC2</literal>: boolean, whether Amazon EC2 (AWS) support is enabled. Defaults |
| 177 |
to <literal>no</literal>.</para> |
| 178 |
</listitem> |
| 179 |
<listitem> |
| 180 |
<para><literal>NM_CLOUD_SETUP_GCP</literal>: boolean, whether Google GCP support is enabled. Defaults |
| 181 |
to <literal>no</literal>.</para> |
| 182 |
</listitem> |
| 183 |
<listitem> |
| 184 |
<para><literal>NM_CLOUD_SETUP_ALIYUN</literal>: boolean, whether Alibaba Cloud (Aliyun) support is enabled. Defaults |
| 185 |
to <literal>no</literal>.</para> |
| 186 |
</listitem> |
| 187 |
<listitem> |
| 188 |
<para><literal>NM_CLOUD_SETUP_OCI</literal>: boolean, whether Oracle Cloud (OCI) support is enabled. Defaults |
| 189 |
to <literal>no</literal>.</para> |
| 190 |
</listitem> |
| 191 |
</itemizedlist> |
| 192 |
|
| 193 |
</refsect1> |
| 194 |
|
| 195 |
<refsect1 id="debugging"> |
| 196 |
<title>Debugging</title> |
| 197 |
<para>Enable debug logging by setting <literal>NM_CLOUD_SETUP_LOG</literal> environment variable to <literal>TRACE</literal>.</para> |
| 198 |
<para>In the common case where nm-cloud-setup is running as systemd service, this can be done via <command>systemctl edit nm-cloud-setup.service</command> |
| 199 |
and add <literal>Environment=NM_CLOUD_SETUP_LOG=TRACE</literal> to the <literal>[Service]</literal> section. Afterwards, the log can |
| 200 |
be found in syslog via <literal>journalctl</literal>. You may also want to enable debug logging in NetworkManager as descibed |
| 201 |
in the DEBUGGING section in <link linkend='NetworkManager'><citerefentry><refentrytitle>NetworkManager</refentrytitle><manvolnum>5</manvolnum></citerefentry></link> |
| 202 |
manual. When sharing logs, it's best to share complete logs and not preemptively filter for NetworkManager or nm-cloud-setup logs.</para> |
| 203 |
</refsect1> |
| 204 |
|
| 205 |
<refsect1 id="deploy"> |
| 206 |
<title>Example Setup for Configuring and Predeploying nm-cloud-setup</title> |
| 207 |
|
| 208 |
<para>As detailed before, nm-cloud-setup needs to be explicitly enabled. As it |
| 209 |
runs as a systemd service and timer, that basically means to enable and configure |
| 210 |
those. This can be done by dropping the correct files and symlinks to disk. |
| 211 |
</para> |
| 212 |
<para> |
| 213 |
The following example enables nm-cloud-setup for Amazon EC2 cloud: |
| 214 |
<programlisting> |
| 215 |
dnf install -y NetworkManager-cloud-setup |
| 216 |
|
| 217 |
mkdir -p /etc/systemd/system/nm-cloud-setup.service.d |
| 218 |
cat > /etc/systemd/system/nm-cloud-setup.service.d/10-enable-ec2.conf << EOF |
| 219 |
[Service] |
| 220 |
Environment=NM_CLOUD_SETUP_EC2=yes |
| 221 |
EOF |
| 222 |
|
| 223 |
# systemctl enable nm-cloud-setup.service |
| 224 |
mkdir -p /etc/systemd/system/NetworkManager.service.wants/ |
| 225 |
ln -s /usr/lib/systemd/system/nm-cloud-setup.service /etc/systemd/system/NetworkManager.service.wants/nm-cloud-setup.service |
| 226 |
|
| 227 |
# systemctl enable nm-cloud-setup.timer |
| 228 |
mkdir -p /etc/systemd/system/timers.target.wants/ |
| 229 |
ln -s /etc/systemd/system/timers.target.wants/nm-cloud-setup.timer /usr/lib/systemd/system/nm-cloud-setup.timer |
| 230 |
|
| 231 |
# systemctl daemon-reload |
| 232 |
</programlisting> |
| 233 |
</para> |
| 234 |
</refsect1> |
| 235 |
|
| 236 |
<refsect1 id="providers"> |
| 237 |
<title>Supported Cloud Providers</title> |
| 238 |
|
| 239 |
<refsect2> |
| 240 |
<title>Amazon EC2 (AWS)</title> |
| 241 |
|
| 242 |
<para>For AWS, the tools tries to fetch configuration from <literal>http://169.254.169.254/</literal>. Currently, it only |
| 243 |
configures IPv4 and does nothing about IPv6. It will do the following.</para> |
| 244 |
|
| 245 |
<itemizedlist> |
| 246 |
<listitem> |
| 247 |
<para>First fetch <literal>http://169.254.169.254/latest/meta-data/</literal> to determine whether the |
| 248 |
expected API is present. This determines whether EC2 environment is detected and whether to proceed |
| 249 |
to configure the host using EC2 meta data.</para> |
| 250 |
</listitem> |
| 251 |
<listitem> |
| 252 |
<para>Fetch <literal>http://169.254.169.254/2018-09-24/meta-data/network/interfaces/macs/</literal> to get the list |
| 253 |
of available interface. Interfaces are identified by their MAC address.</para> |
| 254 |
</listitem> |
| 255 |
<listitem> |
| 256 |
<para>Then for each interface fetch <literal>http://169.254.169.254/2018-09-24/meta-data/network/interfaces/macs/$MAC/subnet-ipv4-cidr-block</literal> |
| 257 |
and <literal>http://169.254.169.254/2018-09-24/meta-data/network/interfaces/macs/$MAC/local-ipv4s</literal>. |
| 258 |
Thereby we get a list of local IPv4 addresses and one CIDR subnet block.</para> |
| 259 |
</listitem> |
| 260 |
<listitem> |
| 261 |
<para>Then nm-cloud-setup iterates over all interfaces for which it could fetch IP configuration. |
| 262 |
If no ethernet device for the respective MAC address is found, it is skipped. |
| 263 |
Also, if the device is currently not activated in NetworkManager or if the currently |
| 264 |
activated profile has a user-data <literal>org.freedesktop.nm-cloud-setup.skip=yes</literal>, |
| 265 |
it is skipped.</para> |
| 266 |
<para>If only one interface and one address is configured, then the tool does nothing |
| 267 |
and leaves the automatic configuration that was obtained via DHCP.</para> |
| 268 |
<para>Otherwise, the tool will change the runtime configuration of the device. |
| 269 |
<itemizedlist> |
| 270 |
<listitem> |
| 271 |
<para>Add static IPv4 addresses for all the configured addresses from <literal>local-ipv4s</literal> with |
| 272 |
prefix length according to <literal>subnet-ipv4-cidr-block</literal>. For example, |
| 273 |
we might have here 2 IP addresses like <literal>"172.16.5.3/24,172.16.5.4/24"</literal>.</para> |
| 274 |
</listitem> |
| 275 |
<listitem> |
| 276 |
<para>Choose a route table 30400 + the index of the interface and |
| 277 |
add a default route <literal>0.0.0.0/0</literal>. The gateway |
| 278 |
is the first IP address in the CIDR subnet block. For |
| 279 |
example, we might get a route <literal>"0.0.0.0/0 172.16.5.1 10 table=30400"</literal>.</para> |
| 280 |
<para>Also choose a route table 30200 + the interface index. This |
| 281 |
contains a direct routes to the subnets of this interface.</para> |
| 282 |
</listitem> |
| 283 |
<listitem> |
| 284 |
<para>Finally, add a policy routing rule for each address. For example |
| 285 |
<literal>"priority 30200 from 172.16.5.3/32 table 30200, priority 30200 from 172.16.5.4/32 table 30200"</literal>. |
| 286 |
and |
| 287 |
<literal>"priority 30400 from 172.16.5.3/32 table 30400, priority 30400 from 172.16.5.4/32 table 30400"</literal> |
| 288 |
The 30200+ rules select the table to reach the subnet directly, while the 30400+ rules use the |
| 289 |
default route. Also add a rule |
| 290 |
<literal>"priority 30350 table main suppress_prefixlength 0"</literal>. This has a priority between |
| 291 |
the two previous rules and causes a lookup of routes in the main table while ignoring the default |
| 292 |
route. The purpose of this is so that other specific routes in the main table are honored over |
| 293 |
the default route in table 30400+.</para> |
| 294 |
</listitem> |
| 295 |
</itemizedlist> |
| 296 |
With above example, this roughly corresponds for interface <literal>eth0</literal> to |
| 297 |
<command>nmcli device modify "eth0" ipv4.addresses "172.16.5.3/24,172.16.5.4/24" ipv4.routes "172.16.5.0/24 0.0.0.0 10 table=30200, 0.0.0.0/0 172.16.5.1 10 table=30400" ipv4.routing-rules "priority 30200 from 172.16.5.3/32 table 30200, priority 30200 from 172.16.5.4/32 table 30200, priority 20350 table main suppress_prefixlength 0, priority 30400 from 172.16.5.3/32 table 30400, priority 30400 from 172.16.5.4/32 table 30400"</command>. |
| 298 |
Note that this replaces the previous addresses, routes and rules with the new information. |
| 299 |
But also note that this only changes the run time configuration of the device. The |
| 300 |
connection profile on disk is not affected. |
| 301 |
</para> |
| 302 |
</listitem> |
| 303 |
</itemizedlist> |
| 304 |
</refsect2> |
| 305 |
|
| 306 |
<refsect2> |
| 307 |
<title>Google Cloud Platform (GCP)</title> |
| 308 |
|
| 309 |
<para> |
| 310 |
For GCP, the meta data is fetched from URIs starting with <literal>http://metadata.google.internal/computeMetadata/v1/</literal> with a |
| 311 |
HTTP header <literal>"Metadata-Flavor: Google"</literal>. |
| 312 |
Currently, the tool only configures IPv4 and does nothing about IPv6. It will do the following. |
| 313 |
</para> |
| 314 |
|
| 315 |
<itemizedlist> |
| 316 |
<listitem> |
| 317 |
<para>First fetch <literal>http://metadata.google.internal/computeMetadata/v1/instance/id</literal> to detect whether the tool |
| 318 |
runs on Google Cloud Platform. Only if the platform is detected, it will continue fetching the configuration.</para> |
| 319 |
</listitem> |
| 320 |
<listitem> |
| 321 |
<para>Fetch <literal>http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/</literal> to get the list |
| 322 |
of available interface indexes. These indexes can be used for further lookups.</para> |
| 323 |
</listitem> |
| 324 |
<listitem> |
| 325 |
<para>Then, for each interface fetch <literal>http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$IFACE_INDEX/mac</literal> to get |
| 326 |
the corresponding MAC address of the found interfaces. The MAC address is used to identify the device later on.</para> |
| 327 |
</listitem> |
| 328 |
<listitem> |
| 329 |
<para>Then, for each interface with a MAC address fetch <literal>http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$IFACE_INDEX/forwarded-ips/</literal> |
| 330 |
and then all the found IP addresses at <literal>http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/$IFACE_INDEX/forwarded-ips/$FIPS_INDEX</literal>. |
| 331 |
</para> |
| 332 |
</listitem> |
| 333 |
<listitem> |
| 334 |
<para>At this point, we have a list of all interfaces (by MAC address) and their configured IPv4 addresses.</para> |
| 335 |
<para>For each device, we lookup the currently applied connection in NetworkManager. That implies, that the device is currently activated |
| 336 |
in NetworkManager. If no such device was in NetworkManager, or if the profile has user-data <literal>org.freedesktop.nm-cloud-setup.skip=yes</literal>, |
| 337 |
we skip the device. Now for each found IP address we add a static route "$FIPS_ADDR/32 0.0.0.0 100 type=local" and reapply the change.</para> |
| 338 |
<para>The effect is not unlike calling <command>nmcli device modify "$DEVICE" ipv4.routes "$FIPS_ADDR/32 0.0.0.0 100 type=local [,...]"</command> for all relevant |
| 339 |
devices and all found addresses.</para> |
| 340 |
</listitem> |
| 341 |
</itemizedlist> |
| 342 |
</refsect2> |
| 343 |
|
| 344 |
<refsect2> |
| 345 |
<title>Microsoft Azure</title> |
| 346 |
|
| 347 |
<para> |
| 348 |
For Azure, the meta data is fetched from URIs starting with <literal>http://169.254.169.254/metadata/instance</literal> with a |
| 349 |
URL parameter <literal>"?format=text&api-version=2017-04-02"</literal> and a HTTP header <literal>"Metadata:true"</literal>. |
| 350 |
Currently, the tool only configures IPv4 and does nothing about IPv6. It will do the following. |
| 351 |
</para> |
| 352 |
|
| 353 |
<itemizedlist> |
| 354 |
<listitem> |
| 355 |
<para>First fetch <literal>http://169.254.169.254/metadata/instance?format=text&api-version=2017-04-02</literal> to detect whether the tool |
| 356 |
runs on Azure Cloud. Only if the platform is detected, it will continue fetching the configuration.</para> |
| 357 |
</listitem> |
| 358 |
<listitem> |
| 359 |
<para>Fetch <literal>http://169.254.169.254/metadata/instance/network/interface/?format=text&api-version=2017-04-02</literal> to get the list |
| 360 |
of available interface indexes. These indexes can be used for further lookups.</para> |
| 361 |
</listitem> |
| 362 |
<listitem> |
| 363 |
<para>Then, for each interface fetch <literal>http://169.254.169.254/metadata/instance/network/interface/$IFACE_INDEX/macAddress?format=text&api-version=2017-04-02</literal> |
| 364 |
to get the corresponding MAC address of the found interfaces. The MAC address is used to identify the device later on.</para> |
| 365 |
</listitem> |
| 366 |
<listitem> |
| 367 |
<para>Then, for each interface with a MAC address fetch <literal>http://169.254.169.254/metadata/instance/network/interface/$IFACE_INDEX/ipv4/ipAddress/?format=text&api-version=2017-04-02</literal> |
| 368 |
to get the list of (indexes of) IP addresses on that interface. |
| 369 |
</para> |
| 370 |
</listitem> |
| 371 |
<listitem> |
| 372 |
<para>Then, for each IP address index fetch the address at |
| 373 |
<literal>http://169.254.169.254/metadata/instance/network/interface/$IFACE_INDEX/ipv4/ipAddress/$ADDR_INDEX/privateIpAddress?format=text&api-version=2017-04-02</literal>. |
| 374 |
Also fetch the size of the subnet and prefix for the interface from |
| 375 |
<literal>http://169.254.169.254/metadata/instance/network/interface/$IFACE_INDEX/ipv4/subnet/0/address/?format=text&api-version=2017-04-02</literal>. |
| 376 |
and |
| 377 |
<literal>http://169.254.169.254/metadata/instance/network/interface/$IFACE_INDEX/ipv4/subnet/0/prefix/?format=text&api-version=2017-04-02</literal>. |
| 378 |
</para> |
| 379 |
</listitem> |
| 380 |
<listitem> |
| 381 |
<para>At this point, we have a list of all interfaces (by MAC address) and their configured IPv4 addresses.</para> |
| 382 |
<para>Then the tool configures the system like doing for AWS environment. That is, using source based policy routing |
| 383 |
with the tables/rules 30200/30400.</para> |
| 384 |
</listitem> |
| 385 |
</itemizedlist> |
| 386 |
</refsect2> |
| 387 |
|
| 388 |
<refsect2> |
| 389 |
<title>Alibaba Cloud (Aliyun)</title> |
| 390 |
|
| 391 |
<para>For Aliyun, the tools tries to fetch configuration from <literal>http://100.100.100.200/</literal>. Currently, it only |
| 392 |
configures IPv4 and does nothing about IPv6. It will do the following.</para> |
| 393 |
|
| 394 |
<itemizedlist> |
| 395 |
<listitem> |
| 396 |
<para>First fetch <literal>http://100.100.100.200/2016-01-01/meta-data/</literal> to determine whether the |
| 397 |
expected API is present. This determines whether Aliyun environment is detected and whether to proceed |
| 398 |
to configure the host using Aliyun meta data.</para> |
| 399 |
</listitem> |
| 400 |
<listitem> |
| 401 |
<para>Fetch <literal>http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/</literal> to get the list |
| 402 |
of available interface. Interfaces are identified by their MAC address.</para> |
| 403 |
</listitem> |
| 404 |
<listitem> |
| 405 |
<para>Then for each interface fetch <literal>http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/vpc-cidr-block</literal>, |
| 406 |
<literal>http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/private-ipv4s</literal>, |
| 407 |
<literal>http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/netmask</literal> and |
| 408 |
<literal>http://100.100.100.200/2016-01-01/meta-data/network/interfaces/macs/$MAC/gateway</literal>. |
| 409 |
Thereby we get a list of private IPv4 addresses, one CIDR subnet block and private IPv4 addresses prefix.</para> |
| 410 |
</listitem> |
| 411 |
<listitem> |
| 412 |
<para>Then nm-cloud-setup iterates over all interfaces for which it could fetch IP configuration. |
| 413 |
If no ethernet device for the respective MAC address is found, it is skipped. |
| 414 |
Also, if the device is currently not activated in NetworkManager or if the currently |
| 415 |
activated profile has a user-data <literal>org.freedesktop.nm-cloud-setup.skip=yes</literal>, |
| 416 |
it is skipped. Also, there is only one interface and one IP address, the tool does nothing.</para> |
| 417 |
<para>Then the tool configures the system like doing for AWS environment. That is, using source based policy routing |
| 418 |
with the tables/rules 30200/30400. One difference to AWS is that the gateway is also fetched via metadata instead |
| 419 |
of using the first IP address in the subnet.</para> |
| 420 |
</listitem> |
| 421 |
</itemizedlist> |
| 422 |
</refsect2> |
| 423 |
|
| 424 |
<refsect2> |
| 425 |
<title>Oracle Cloud (OCI)</title> |
| 426 |
|
| 427 |
<para>For OCI, the tools tries to fetch configuration from <literal>http://169.254.169.254/</literal>. Currently, it only |
| 428 |
configures IPv4 and does nothing about IPv6. It will do the following.</para> |
| 429 |
|
| 430 |
<itemizedlist> |
| 431 |
<listitem> |
| 432 |
<para>First fetch <literal>http://169.254.169.254/opc/v2/instance</literal> to determine whether the |
| 433 |
expected API is present. This determines whether OCI environment is detected and whether to proceed |
| 434 |
to configure the host using OCI meta data.</para> |
| 435 |
</listitem> |
| 436 |
<listitem> |
| 437 |
<para>Fetch <literal>http://169.254.169.254/opc/v2/vnics</literal> to get the configuration |
| 438 |
for all the VNICs, getting their MAC address, private IP address, gateway and subnet block.</para> |
| 439 |
</listitem> |
| 440 |
<listitem> |
| 441 |
<para>Then nm-cloud-setup iterates over all interfaces for which it could fetch a configuration. |
| 442 |
If no ethernet device for the respective MAC address is found, it is skipped. |
| 443 |
Also, if the device is currently not activated in NetworkManager or if the currently |
| 444 |
activated profile has a user-data <literal>org.freedesktop.nm-cloud-setup.skip=yes</literal>, |
| 445 |
it is skipped. Also, there is only one interface and one IP address, the tool does nothing.</para> |
| 446 |
<para>Then the tool configures the system like doing for AWS environment. That is, using source based policy routing |
| 447 |
with the tables/rules 30200/30400.</para> |
| 448 |
</listitem> |
| 449 |
</itemizedlist> |
| 450 |
</refsect2> |
| 451 |
|
| 452 |
</refsect1> |
| 453 |
|
| 454 |
<refsect1> |
| 455 |
<title>See Also</title> |
| 456 |
<para> |
| 457 |
<link linkend='NetworkManager'><citerefentry><refentrytitle>NetworkManager</refentrytitle><manvolnum>8</manvolnum></citerefentry></link> |
| 458 |
<link linkend='nmcli'><citerefentry><refentrytitle>nmcli</refentrytitle><manvolnum>1</manvolnum></citerefentry></link> |
| 459 |
</para> |
| 460 |
</refsect1> |
| 461 |
</refentry> |