A
A
at0m1x2019-08-15 11:06:28
ubuntu
at0m1x, 2019-08-15 11:06:28

How to set up a static IP address?

Ubuntu Server 18.04 uses the Netplan utility to configure the network.

The configs for it are stored in yaml files in the /etc/netplan/ folder

In my installed Ubuntu there is only one config /etc/netplan/50-cloud-init.yaml

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp0s3:
            dhcp4: true
    version: 2


Of course, I can write the settings I need directly into it. BUT, at the beginning of this file it is written that it was generated automatically and, as far as I understand, it is used by the cloud-init utility.

You can also create another yaml config and add your settings there. But all the same, misunderstandings with the 50-cloud-init.yaml config are confusing, all of a sudden it will somehow affect my network settings, somehow replace them with my own settings or something like that.

Questions:
What is the cloud-init utility?
Why did she generate this file?
Is it correct to add your settings to it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hint000, 2019-08-15
@hint000

suddenly it will somehow affect my network settings
Yet it is written:
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}

those. find the file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg and write the line network: {config: disabled} into it,
and after that:
you can create another yaml config and write your settings there

those. in this case, cloud-init promises to no longer interfere with network settings. Whether the promise will be fulfilled - it is necessary to check empirically.
What is cloud-init utility?
Yes, Google knows it. https://cloud.croc.ru/blog/byt-v-teme/cloud-init/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question