본문으로 건너뛰기
전용 서버기술

[DEMO] Configure additional IPs

Add an additional IP to the network interface on Ubuntu (netplan) or Debian (ifupdown).

이 문서는 아직 한국어로 제공되지 않습니다. 영어 버전을 보고 계십니다.
이 페이지의 내용

Find the interface name

bash
ip addr show

Look for the interface that holds your main IP (for example eth0 or enp1s0).

Add the IP

Edit the existing file in /etc/netplan/:

/etc/netplan/50-cloud-init.yaml
network:
  version: 2
  ethernets:
    [INTERFACE]:
      addresses:
        - [MAIN_IP]/[PREFIX]
        - [ADDITIONAL_IP]/32

Apply with automatic rollback if something goes wrong:

bash
sudo netplan try

Add these lines under the main interface:

/etc/network/interfaces
up ip addr add [ADDITIONAL_IP]/32 dev [INTERFACE]
down ip addr del [ADDITIONAL_IP]/32 dev [INTERFACE]

Then restart networking:

bash
sudo systemctl restart networking