root@smileserv:~# vi /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:
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:
ethernets:
enp0s8:
dhcp4: no
addresses: [192.168.56.110/24]
gateway4: 192.168.56.1
nameservers:
addresses: [8.8.8.8]
version: 2
예전방식 ( /etc/network/interface) 으로 설정하고 싶은 경우에는 ifupdown 패키지를 설치하고 설정하면 됩니다.
root@smileserv:~# apt-get install ifupdown
Reading package lists… Done
Building dependency tree
Reading state information… Done
ifupdown is already the newest version (0.8.17ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@smileserv:~# reboot
기존 우분투 네트워크 설정과 동일하게 설정하시면 됩니다 .
root@smileserv:~# vi /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp
# The primary network interface
auto enp0s8
iface enp0s8 inet static
address 192.168.56.101
netmask 255.255.255.0
gateway 192.168.56.1
dns-nameservers 164.124.101.2