背景介绍
近期公司新装了一批测试环境的机器,系统是Debian11,第一次配置Debian的静态网络IP,特此记录一下。
(debian11默认的配置文件中的网卡名称未必是对的,请使用ip -a 进行确认后进行修改。)
配置文件
root@server20x:~# cat /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 enp11s0
iface enp11s0 inet static
address 192.168.0.20x/24
gateway 192.168.0.x