DEV Community

kevin
kevin

Posted on

Debian 12.x 添加多IP

一、编辑配置文件
sudo nano /etc/network/interfaces

二、设置所要添加的IP

auto enp3s0
iface enp3s0 inet static
address 192.168.1.10/24
gateway 192.168.1.1

# 添加额外的附加 IP
up ip addr add 192.168.1.11/24 dev enp3s0
up ip addr add 192.168.1.12/24 dev enp3s0

# 对应地,在网卡关闭时移除这些 IP
down ip addr del 192.168.1.11/24 dev enp3s0
down ip addr del 192.168.1.12/24 dev enp3s0
Enter fullscreen mode Exit fullscreen mode

Top comments (0)