Как настроить статический IP-адрес в Ubuntu 18.04
How to restart network on Ubuntu 18.04
How to configure static IP address on Ubuntu 18.04 Bionic Beaver Linux
Ubuntu 18.04: Network configuration
Постоянно отключить NetworkManager
$ ip a
>> inet 192.168.0.53/24 brd 192.168.0.255 scope global dynamic enp0s3
$ cd /etc/netplan/
$ ls
50-cloud-init.yaml
$ sudo cp 50-cloud-init.yaml 50-cloud-init.yaml.bac
$ sudo nano 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:
addresses: []
dhcp4: true
version: 2
Корректируем так:
# 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:
version: 2
renderer: networkd
ethernets:
enp0s3:
addresses: [192.168.0.53/24,]
gateway4: 192.168.0.1
dhcp4: no
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Сохранить.
$ sudo netplan apply
.
Для десктопа можно настроить через сетевой мененджер.
Или снести сетевой менеджер и настроить вручную, как для сервера.
$ ip a
....................
inet 192.168.0.242/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s3
....................
$ cd /etc/netplan/
$ ls
01-network-manager-all.yaml
Имя будет разное
$ sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bac
$ sudo nano 01-network-manager-all.yaml
можно удалить и создать свое:
$ sudo nano 01.yaml
Меняем содержимое:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
addresses: [192.168.0.242/24,]
gateway4: 192.168.0.1
dhcp4: no
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Сохранить.
$ sudo netplan apply
# отключим сетевой менеджер
$ sudo systemctl stop NetworkManager.service
$ sudo systemctl disable NetworkManager.service
$ sudo systemctl status NetworkManager.service
$ mv /lib/systemd/system/NetworkManager.service /lib/systemd/syste/NetworkManager.service.bak
$ sudo reboot
$ sudo systemctl status NetworkManager.service
Unit NetworkManager.service could not be found.
How to restart network on Ubuntu 18.04
How to configure static IP address on Ubuntu 18.04 Bionic Beaver Linux
Ubuntu 18.04: Network configuration
Постоянно отключить NetworkManager
$ ip a
>> inet 192.168.0.53/24 brd 192.168.0.255 scope global dynamic enp0s3
$ cd /etc/netplan/
$ ls
50-cloud-init.yaml
$ sudo cp 50-cloud-init.yaml 50-cloud-init.yaml.bac
$ sudo nano 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:
addresses: []
dhcp4: true
version: 2
Корректируем так:
# 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:
version: 2
renderer: networkd
ethernets:
enp0s3:
addresses: [192.168.0.53/24,]
gateway4: 192.168.0.1
dhcp4: no
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Сохранить.
$ sudo netplan apply
.
Для десктопа можно настроить через сетевой мененджер.
Или снести сетевой менеджер и настроить вручную, как для сервера.
$ ip a
....................
inet 192.168.0.242/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s3
....................
$ cd /etc/netplan/
$ ls
01-network-manager-all.yaml
Имя будет разное
$ sudo cp 01-network-manager-all.yaml 01-network-manager-all.yaml.bac
$ sudo nano 01-network-manager-all.yaml
можно удалить и создать свое:
$ sudo nano 01.yaml
Меняем содержимое:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
addresses: [192.168.0.242/24,]
gateway4: 192.168.0.1
dhcp4: no
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Сохранить.
$ sudo netplan apply
# отключим сетевой менеджер
$ sudo systemctl stop NetworkManager.service
$ sudo systemctl disable NetworkManager.service
$ sudo systemctl status NetworkManager.service
$ mv /lib/systemd/system/NetworkManager.service /lib/systemd/syste/NetworkManager.service.bak
$ sudo reboot
$ sudo systemctl status NetworkManager.service
Unit NetworkManager.service could not be found.
Комментариев нет:
Отправить комментарий