Image

Knowledge base → Setting up a network with multiple IPs in Linux Debian 11

[Virtual servers]
Date of publication: 09.10.2023

By default, when installing Linux Debian 11 from an ISO image, a field is available for assigning 1 IP address to the network interface. If you need to add several more IP addresses to this network interface, use the following configuration:

vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens3
iface ens3 inet static
address 89.111.186.200
netmask 255.255.255.0
broadcast +
up route -A inet add 89.111.186.1 dev ens3
up route -A inet add default gw 89.111.186.1 dev ens3

auto ens3:1
iface ens3:1 inet static
address 89.111.186.201
netmask 255.255.255.0
broadcast +

auto ens3:2
iface ens3:2 inet static
address 89.111.186.202
netmask 255.255.255.0
broadcast +

auto ens3:3
iface ens3:3 inet static
address 89.111.186.203
netmask 255.255.255.0
broadcast +

iface ens3 inet6 manual
pre-down ip -6 addr flush dev ens3 scope global || :

After making changes, you must restart the network service:

/etc/init.d/networking restart

DNS servers are specified in the file:

vi /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4




No Comments Yet