เซิร์ฟเวอร์เฉพาะเชิงเทคนิค
[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 showLook 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]/32Apply with automatic rollback if something goes wrong:
bash
sudo netplan tryAdd 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