You need to config your /etc/network/interfaces
Example Config:
# for loopback
auto lo
iface lo inet loopback
dhcp for eth0
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
you can do the same for ensp1
auto ensp1
allow-hotplug ensp1
iface ensp1 inet dhcp
# manual ip for eth0
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
# YOU CAN ADD MORE IP'S TO THE INTERFACES WITH eth0:0, eth0:1 eth0:2, etc..
# more than one ip for eth0
auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet static
address 10.0.0.100
netmask 255.255.0.0
# You can do the same for ensp1
auto ensp1
allow-hotplug ensp1
iface ensp1 inet static
address 192.178.178.10
netmask 255.255.255.0
# You can do the same for ensp1:0
auto ensp1:0
allow-hotplug ensp1:0
iface ensp1:0 inet static
address 10.10.10.10
netmask 255.255.0.0
On one machine we use DHCP and 3 STATIC IP's for 1 interface
# You can add also a nameserver for eth0, ensp1:0, etc..,
# but i prefer the nameserver in /etc/resolve.conf
auto ensp1:0
allow-hotplug ensp1:0
iface ensp1:0 inet static
address 10.10.10.10
netmask 255.255.0.0
dns-nameserver 10.10.x.x
dns-nameservers 8.8.8.8
nameserver x.x.x.x
For nameserver edit /etc/resolve.conf
nameserver 192.168.x.x # local `
nameserver 8.8.8.8 # google
nameserver x.x.x.x # whatever`
Defining the (DNS) Nameservers, The resolv.conf configuration file
How can I refresh resolv.conf after changing the resolv options in the interfaces file?
After edit you can restart and check the network status with:
systemctl restart networking
or
systemctl restart networking.service
or
/etc/init.d/networking restart
Status
systemctl status networking.service
Fit your /etc/netwotk/interfaces to your needs
Check this post if you need more informations from your interfaces:
network devices/interfaces informations
Check the Debian NetworkConfiguration:
Debian NetworkConfiguration
/etc/network/interfaces.d/setup(what is in it?), or no configuration was done ? – QuartzCristal Sep 06 '22 at 05:53