Debian 12 bookworm
Sponsored Link

Initial Settings : Network Settings2023/06/14

 
Change to static IP addres if you use Debian as a server.
[1] The interface name [enp1s0] is different on each environment, replace it to your own one.
root@localhost:~#
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
allow-hotplug enp1s0
# comment out
#iface enp1s0 inet dhcp

# add static settings
iface enp1s0 inet static
# IP address
address 10.0.0.30
# network address
network 10.0.0.0
# subnet mask
netmask 255.255.255.0
# broadcast address
broadcast 10.0.0.255
# default gateway
gateway 10.0.0.1
# name server
dns-nameservers 10.0.0.10

root@localhost:~#
systemctl restart ifup@enp1s0
root@localhost:~#
ip address

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:43:5b:f5 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe43:5bf5/64 scope link
       valid_lft forever preferred_lft forever

# For nameservers,
# if resolvconf or Networkmanager programs have not been installed and also
# you set static IP address, it needs to edit [/etc/resolv.conf] by hand
# if you installed OS with only [Standard system utilties], they have not been installed like follows

root@localhost:~#
systemctl status resolvconf.service NetworkManager.service

Unit resolvconf.service could not be found.
Unit NetworkManager.service could not be found.
root@localhost:~#
vi /etc/resolv.conf
# set your domainame and nameserver
domain srv.world
search srv.world
nameserver 10.0.0.10
[2] Disable IPv6 if you do not need it.
root@localhost:~#
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf

root@localhost:~#
sysctl -p

net.ipv6.conf.all.disable_ipv6 = 1
root@localhost:~#
ip address

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:43:5b:f5 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.30/24 brd 10.0.0.255 scope global enp1s0
       valid_lft forever preferred_lft forever
Matched Content