Ubuntu 16.04LTS 버전에서는 /etc/network/interfaces 에서 네트워크 설정을 했었지만,
Ubuntu 18.04LTS 버전 이상에서는 네트워크 설정 시, /etc/netplan/*.yaml 파일을 설정하여 사용해야 합니다.
아래는 Ubuntu Netplan 설정 파일을 사용하여 인터페이스에 여러 개의 Secendary IP를 할당한 예제입니다.
설정 파일 예제
/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:
eno1:
addresses:
- 192.168.0.21/24
- 192.168.0.22/24
- 192.168.0.23/24
- 192.168.0.24/24
gateway4: 192.168.0.1
nameservers:
addresses:
- 8.8.8.8
version: 2
설정 적용
$ sudo netplan apply