пятница, 23 августа 2019 г.

Настройка статического ip Ubuntu 18.04.3 server

$ sudo cat /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:
        enp1s0:
            dhcp4: true
    version: 2

$ sudo nano /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:
# Закомментировать:
#       enp1s0:
#            dhcp4: true
#   version: 2

# Добавить:
         enp1s0:
            dhcp4: false
            dhcp6: false
            addresses: [192.168.10.24/24]
            gateway4: 192.168.10.1
            nameservers:
              addresses: [8.8.8.8, 8.8.4.4]
#     version: 2


Сохранить.

Применть:
$ sudo netplan apply
или
$ sudo netplan --debug apply

Комментариев нет:

Отправить комментарий