title: Debian系networking服务配置单网卡多IP
date: 2024-09-20 23:41:25.732
updated: 2024-09-20 23:42:35.463
url: https://liumou.site/doc/743
categories:

  • Linux
  • Debian
    tags:
  • Linux
  • Debian

root@debian:~# grep -v ^# /etc/network/interfaces

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug ens18
iface ens18 inet static
        address 172.20.9.123
        netmask 255.255.255.0
        gateway 172.20.9.254
        up ip addr add 172.20.9.124/24 brd + dev ens18
        up ip addr add 172.20.9.125/24 brd + dev ens18


root@debian:~# ip a | grep inet4
root@debian:~# ip a | grep inet | grep -v inet6
    inet 127.0.0.1/8 scope host lo
    inet 172.20.9.123/24 brd 172.20.9.255 scope global ens18
    inet 172.20.9.124/24 brd 172.20.9.255 scope global secondary ens18
    inet 172.20.9.125/24 brd 172.20.9.255 scope global secondary ens18
root@debian:~#